Repository navigation
Description
What I found
While reviewing #170 (which relocates the event-stream identity read from src/index.ts into src/host.ts), I checked every event name in that path against the live recording that test/event-fidelity.test.ts treats as the authority:
| event name the identity path waits on | declared in manifest | in test/fixtures/host-events.jsonl |
in the raw SSE captures (/tmp/sse2-4.txt, 2026-10-26) |
|---|---|---|---|
session.created |
yes | yes (count 4) | yes (1, 1, 2) |
session.execution.started |
yes | yes (count 4) | yes (1, 1, 2) |
session.moved |
yes | no | no (0, 0, 0) |
session.moved is therefore the one identity trigger in this plugin with no live evidence anywhere, and it is exactly the category test/event-fidelity.test.ts describes in its own header: "Names the manifest declares but the live host never sent during the recording. A subscriber on any of these is dead code — which is precisely #136."
Why the fidelity net cannot catch it
test/event-fidelity.test.ts has two strengths of assertion and they do not cover the same set:
- declared — the source scanner (
/\b(?:ev|event)\??\.type\b/oversrc/*.ts) requires every name on such a line to be indeclaredSet ∪ LEGACY_HOST_EVENTS. - observed — asserted only for
CAPTURE_EVENT_TYPES(the capture triggers).
session.moved is an identity event, not a capture trigger, so only the weak declared check applies and it passes. The scanner does read the line (src/host.ts:32 is event.type !== "session.moved"), so the mechanism is working as written — the coverage rule is what has the hole. message.updated shows the escape hatch that exists for a deliberate read (LEGACY_HOST_EVENTS); session.moved is not in it, so nothing marks it as "accepted on paper, never seen".
Consequence if it never fires
Workspace-change rebinding silently does not happen: a session whose workspace moves keeps the directory bound from session.created / session.execution.started, and the fallback bindSessionFromApi is only reached when an identity event arrives with no directory. There would be no warning and no evidence line — the same invisibility that let #136 ship dead for several releases. Note this is not introduced by #170: the same three-name check has been inline in src/index.ts since the identity path landed. #170 just makes it the documented compatibility boundary, which is why it deserves to be true there.
Options (pick one, or record a decision)
- Prove it: stream
GET /api/eventwhile moving/renaming a session's workspace (opencode desktop orserve) and add the line totest/fixtures/host-events.jsonl. Then movesession.created/session.execution.started/session.movedinto a sharedIDENTITY_EVENT_TYPESexport and extend the observed assertion to it, the wayCAPTURE_EVENT_TYPESalready is. - Mark it: add
session.movedto an explicitly-named unverified set (theLEGACY_HOST_EVENTSpattern) so the file states the read is on paper only, and stop implying the whole boundary is recording-backed. - Delete it if a live host turns out not to emit it, and let the
session.execution.started-per-turn path do the rebinding.
Also worth a look while here: src/host.ts:30 is the only place the identity type list lives, while sessionDirectoryFromMessages / sessionDirectoryFromRow (the API fallbacks) are reached from bindSessionFromApi, so option 1's shared export would also make the two paths reviewable together.
Activity
WhollyMindless commentedon Oct 30, 2026
Live follow-up: I can now confirm
session.movedis emitted by opencode v2.2.2 on Windows, and the current adapter at main525ed89reads its destination correctly.I started an isolated
serve --servicehost with fresh HOME/XDG/config/data directories, subscribed toGET /api/event, created a temporary session in directory A, and calledPOST /api/session/:sessionID/movewith{ "directory": B }. Creation returned 200, move returned 204, the subsequent session row reported B, and the SSE stream includedsession.moved. No model prompt or existing user session was involved.The relevant recorded envelope, with IDs and temporary paths normalized (unrelated metadata omitted), was:
{ "type": "session.moved", "location": { "directory": "A" }, "data": { "sessionID": "session-under-test", "location": { "directory": "B" }, "projectID": "global", "subpath": "" } }Passing the actual received object to
sessionIdentityEventreturned the original session ID and B. The destination indata.locationmust take precedence over the old directory in the outerlocation; the current adapter already does this.This supports option 1: preserve this separate recording with its version/procedure, share the identity-event list, and extend the observed-event assertion to identity events. The original two-turn 2.1.4 recording should keep its own provenance rather than silently gaining a count from another run/version. Its absence there does not establish that this event is dead. I would keep the handler.
Limits: this establishes emission on 2.2.2 and correct adapter interpretation. It does not retroactively prove 2.1.4 behavior or exercise the plugin's complete asynchronous rebinding path. The fixture/coverage gap remains open; no overlapping PR or active claim was visible when checked.
WhollyMindless commentedon Oct 30, 2026
Taking the recording/coverage follow-up now: preserve the separate 2.2.2 move observation and its provenance, share the identity-event list, and pin destination-directory precedence using the recorded payload. Existing handler behavior and the original 2.1.4 recording stay intact. Please redirect if this overlaps work in progress.
abogartz-opencode-self-improvement commentedon Oct 31, 2026
🎉 This issue has been resolved in version 0.14.28 🎉
The release is available on:
Your semantic-release bot 📦🚀