Conversation
OpenCode v2 no longer emits the deprecated session.idle event, nor an idle session.status, so the V1 idle handler that drives auto-capture and user-profile learning never fired. Map a finished session execution (succeeded/failed/interrupted) back to session.idle so the existing idle pipeline runs again.
|
OpenCode v2 support is already on main (#311). It just isn't in a release yet, so npm still installs v2.26.0, which does not load on OpenCode v2. I'll cut the release once I'm a maintainer again. Until then a current maintainer has to publish it. |
|
I traced this against current main and the OpenCode v2 event path. The mapping itself looks consistent: opencode-mem's shared consumer only starts auto-capture/profile learning from legacy session.idle, while OpenCode v2 treats session.execution.succeeded, session.execution.failed, and session.execution.interrupted as terminal states that return a session to idle. |
|
Independent confirmation on OpenCode v2.0.19 (Linux, plugin built from Symptom reproduced: every prompt was still written to Root cause confirmed by instrumenting the v2 event bridge. No Fix verified. With The memory was then read back from the store and its content matched the session. It also fires correctly in a real TUI session, not only in a headless test. One note for whoever ships the release: this only reaches users once #322 (npm |
|
Closing as superseded by #332 (v2 auto-capture / session.execution → session.idle already merged). Thanks for the investigation and fix! |
Problem
On OpenCode v2, auto-capture and user-profile learning silently stop working: every user prompt is still recorded into
user-prompts.db(so nothing looks broken), butcapturednever flips to1, and noAuto-capture memory persistedentries are written.Root cause
The V1 idle handler (
src/index.ts) drives auto-capture and profile learning from thesession.idleevent. OpenCode v2 no longer emitssession.idleat all, and it does not emit an idlesession.statuseither — both are deprecated in the v2 schema. A finished turn is now signalled by the durablesession.execution.succeeded/session.execution.failed/session.execution.interruptedevents.The v2 adapter (
src/v2/legacy-client.ts,toLegacyEvent) only translatedsession.compaction.ended→session.compacted, so the idle handler was never invoked under v2.Verified by subscribing to the live host event stream: over a full turn there were zero
session.idleand zerosession.statusevents, whilesession.execution.succeededfired on every completed turn.Fix
Map a finished session execution back to
session.idleso the existing idle pipeline runs again:The existing
session.statusidle mapping is kept for host versions that still emit it.Testing
session.idlemapping (and thatsession.execution.startedis not treated as a turn end).bun test tests/v2-legacy-client.test.ts→ 8 pass / 0 fail.Auto-capture memory persistedentries appear again andcapturedflips to1inuser-prompts.db.