Repository navigation
fix(capture): read session.idle and message.updated from the 2.x data envelope - #79
Merged
Merged
Conversation
… envelope On opencode 2.x the bus payload is under event.data. Auto-capture read only sessionID/properties.sessionID, so every session.idle was skipped and capture never ran. The measured-usage handler likewise missed data.info. Both now fall back to event.data, the same defensive read the identity handler already uses. Tests use a 2.x-shape fake host. Closes abogartz#78. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🎉 This PR is included in version 0.8.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
abogartz
pushed a commit
that referenced
this pull request
Oct 25, 2026
…er eats it The compaction cliff is where episodic detail dies: one round retains ~53% of exact-wording rules. The session.compaction hook already pushes the memory anchor onto the summarizer's system parts; now it ALSO fires the auto-capture pipeline (same runWriteGate path as the idle trigger - never a direct write) against the hook payload's PRE-compaction transcript, so the facts are mined while they still exist. Rows land tagged auto-capture + auto_capture_compaction, evidence as auto_capture_compaction_<action> with a trigger field on every capture line, so decay/status can attribute capture by trigger and the real-world hit-rate comparison is log analysis, not new plumbing. captureOnCompact defaults on under the autoCapture master switch (zero-token default unchanged; setting it alone warns instead of silently costing tokens). Cooldowns are per-session AND per-trigger so measuring one trigger is not confounded by the other. Payload-less hosts fall back to session.context - the #79 envelope lesson, pinned by test. bench/capture-trigger-compare.ts measures the claim (49 queries, 3 worlds, 6 self-checks incl. a must-fail negative control): R@3 43% at-compaction vs 24% idle-after-the-cliff vs 0% off; the bench EXITS RED on src without this commit. Fixes #41.
abogartz-opencode-self-improvement Bot
pushed a commit
that referenced
this pull request
Oct 25, 2026
# [0.14.0](v0.13.2...v0.14.0) (2026-10-25) ### Features * **capture:** mine the transcript AT compaction, before the summarizer eats it ([c531e27](c531e27)), closes [#79](#79)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #78, done as the issue specifies.
Change (
src/index.ts):session.idle(line 919):event.sessionID ?? event.properties?.sessionID ?? event.data?.sessionID, your one-liner.message.updated(line 856):ev.properties?.info ?? ev.info ?? ev.data?.info. This came out of the audit you suggested, below.Both are additive fallbacks, so the 1.x shapes behave exactly as before.
The audit of reads on the event-bus path:
session.created/execution.started/moved), line 847ev.data ?? ev.propertiesmessage.updated), line 856ev.properties?.info ?? ev.infopropertiesand top-level, notdata?? ev.data?.infosession.idle), line 919event.sessionID ?? event.properties?.sessionID?? event.data?.sessionIDCapture reads nothing else from the bus event. The evidence for
message.updatedis@opencode/schema2.0.32'sdist/v1/session.d.ts(the version in this repo'sbun.lock). It types the event as{ type: "message.updated", …, data: { sessionID, info } }, the same envelope assession.idle.One thing only you can check: if the measured cache figure in
memory_statusor the TUI badge shows real numbers on your 2.x host, then the bus is deliveringpropertiesor top-levelinfothere after all, and this second fallback is just a harmless extra read. If it has always read "not measured", this fixes it too.Tests, both with a fake 2.x-shape host, payload under
data:test/capture.test.ts:{ type: "session.idle", data: { sessionID } }calls the capture model and writes anauto_capture_*evidence row.test/status.test.ts:{ type: "message.updated", data: { info } }lands the measured usage in the status file.The existing 1.x-shape tests are unchanged. With the source change reverted, both new tests fail: capture times out with no model call, and measured stays
undefined.Checks (Linux, Bun 1.4.4, on 0.8.8):
bun test ./test/326 pass, 4 skip, 0 fail.bun run test:e2eagainst opencode 2.0.26: 9 pass.tsc --noEmitis clean, andbiome lintexits 0 with warnings unchanged frommain.🤖 Generated with Claude Code