Summary
The V2 adapter translates only session.created and session.deleted, so session.updated is dropped. The shared handler uses created and updated together to close a session that was registered as a root and later revealed a parentID — that is the fix for #1131. On OpenCode V2 that fix is therefore not in force.
Where
v1SessionEvent() (the V2 → V1 event translation):
if (event.type === "session.created") { ... }
if (event.type === "session.deleted") { ... }
return undefined
The shared handler it feeds:
if (event.type === "session.created" || event.type === "session.updated") {
const parentID = info?.parentID
const isSubAgent = !!parentID
...
// Issue #1131: a session registered as a root that now reveals a
// parentID was misregistered.
if (isSubAgent && registrationAttempts.has(sessionId)) {
await closeKnownSession(sessionId)
}
Evidence
OpenCode 2.0.19 does emit the event: type:"session.updated" is a declared event in the runtime, so the adapter is dropping a signal that exists rather than one that never arrives.
Impact
A session that is first observed without a parentID and reveals one later stays misregistered as a root on V2, which is precisely the accumulation #1131 was about. Nothing surfaces it.
What I could not confirm
Whether V2 ever emits session.created without a parentID and supplies it in a later session.updated. If it guarantees the parent at creation, this is latent rather than live. Either way the adapter currently depends on that being true without enforcing it, and the sub-agent exclusion it feeds is load-bearing for attribution.
Suggested fix
Translate session.updated into the same shape as session.created ({ type, properties: { info: { id, parentID, projectID } } }), or document explicitly that V2 guarantees the parent is present at creation and drop the branch from the V2 contract knowingly.
Found while reviewing the OpenCode V2 adapter as installed (OpenCode 2.0.19, engram 2.2.1). Related: #1541 (the #1131 test suite is inert since #1228).
Summary
The V2 adapter translates only
session.createdandsession.deleted, sosession.updatedis dropped. The shared handler usescreatedandupdatedtogether to close a session that was registered as a root and later revealed aparentID— that is the fix for #1131. On OpenCode V2 that fix is therefore not in force.Where
v1SessionEvent()(the V2 → V1 event translation):The shared handler it feeds:
Evidence
OpenCode 2.0.19 does emit the event:
type:"session.updated"is a declared event in the runtime, so the adapter is dropping a signal that exists rather than one that never arrives.Impact
A session that is first observed without a
parentIDand reveals one later stays misregistered as a root on V2, which is precisely the accumulation #1131 was about. Nothing surfaces it.What I could not confirm
Whether V2 ever emits
session.createdwithout aparentIDand supplies it in a latersession.updated. If it guarantees the parent at creation, this is latent rather than live. Either way the adapter currently depends on that being true without enforcing it, and the sub-agent exclusion it feeds is load-bearing for attribution.Suggested fix
Translate
session.updatedinto the same shape assession.created({ type, properties: { info: { id, parentID, projectID } } }), or document explicitly that V2 guarantees the parent is present at creation and drop the branch from the V2 contract knowingly.Found while reviewing the OpenCode V2 adapter as installed (OpenCode 2.0.19, engram 2.2.1). Related: #1541 (the #1131 test suite is inert since #1228).