Observation
environment.stream({ prompt, sessionId }) fails on the first OpenCode raw frame of a live run stream with Tangle exact session event identified a different sessionId.
The sidecar writes a live raw frame's data as the harness event itself (agent-dev-container apps/sidecar/src/routes/agents-stream.ts:1103-1113 on 9bb408e9f7).
OpenCode's events carry their own session id at the top level, for example { type: "step_start", timestamp, sessionID: "ses_f67f4b273ffeq38073UGm8RzAK", part }.
sandboxEventIdentity reads data.sessionID as the run-frame session position (packages/agent-provider-tangle/src/tangle-events.ts), and environmentEventFromSandboxEvent exempts that position only for session.updated.
The replay lane is unaffected: it sends the buffered { type: "raw", backend: "opencode", event } envelope, where the native id sits under event.
Reproduction
Frames recorded from production execution s19 of run mech-interp-foundations-astra-b-20260912a (the fixture added in #327), streamed through environment.stream({ prompt, sessionId: <runtime session id> }) on the #327 branch:
| frame shape |
result |
| replay envelope, as recorded |
63 events delivered |
live shape (data = the inner OpenCode event plus sandboxId) |
throws after 8 events, on the first step_start |
The live shape is reconstructed from the sidecar and SDK source; no live session-bound OpenCode stream was captured.
Ask
Treat the run-frame session position of a raw frame as backend content, as the adapter already does for session.updated on a stream-bound iterator and for properties.part on unshaped frames.
Keep comparing the envelope positions the sidecar rewrites.
Observation
environment.stream({ prompt, sessionId })fails on the first OpenCoderawframe of a live run stream withTangle exact session event identified a different sessionId.The sidecar writes a live
rawframe's data as the harness event itself (agent-dev-containerapps/sidecar/src/routes/agents-stream.ts:1103-1113on9bb408e9f7).OpenCode's events carry their own session id at the top level, for example
{ type: "step_start", timestamp, sessionID: "ses_f67f4b273ffeq38073UGm8RzAK", part }.sandboxEventIdentityreadsdata.sessionIDas the run-frame session position (packages/agent-provider-tangle/src/tangle-events.ts), andenvironmentEventFromSandboxEventexempts that position only forsession.updated.The replay lane is unaffected: it sends the buffered
{ type: "raw", backend: "opencode", event }envelope, where the native id sits underevent.Reproduction
Frames recorded from production execution
s19of runmech-interp-foundations-astra-b-20260912a(the fixture added in #327), streamed throughenvironment.stream({ prompt, sessionId: <runtime session id> })on the #327 branch:data= the inner OpenCode event plussandboxId)step_startThe live shape is reconstructed from the sidecar and SDK source; no live session-bound OpenCode stream was captured.
Ask
Treat the run-frame session position of a
rawframe as backend content, as the adapter already does forsession.updatedon a stream-bound iterator and forproperties.parton unshaped frames.Keep comparing the envelope positions the sidecar rewrites.