fix(telemetry): opencode reads journal.cjs where the build puts it - #812
Merged
Conversation
`opencode-plugin.js` spawned `./journal.cjs` as its own sibling. Since the build stopped materialising every hook script flat into `.opencode/plugin/` and started namespacing them under `.opencode/hooks/<plugin>/`, that path names nothing: every spawn exited MODULE_NOT_FOUND, the plugin's own try/catch swallowed it, and OpenCode recorded no session at all while still reading as covered. Measured, not inferred: a real `opencode run` in an installed project wrote zero journal lines; the same run after repointing the path wrote session_start, task_declared and turn_end, and `telemetry read` returned 2 requests, 16,303 input and 39,104 cache-read tokens. The literal now matches what the generated bridge two files away already resolves, `../hooks/<plugin>/`. Two guards, because neither alone would have caught it. build.unit.test.ts reads the JOURNAL_SCRIPT literal out of the shipped module and resolves it against the path the build contract declares — red on flipping the literal back, red on moving OPENCODE_HOOKS_DIR. opencode-plugin.test.js staged its fixture in the layout the build no longer writes, so it agreed with the bug; it now mirrors the split the loader actually sees, and goes red 2 of 3 on the old path. The plugin README drops to what a reader needs to understand the thing: what it is, why it exists, how it works, how to start, what each tool can answer. Every partly-measurable tool keeps its reason, since a limit a reader has to look up gets read as a zero. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp AIDD-Session-Id: 2c21d903-3a7e-47ac-83f8-d8b7ae3aa579
This was referenced Sep 10, 2026
blafourcade
added a commit
that referenced
this pull request
Sep 10, 2026
…nal line (#820) v5.10.0 shipped an OpenCode telemetry plugin that spawned a journal.cjs the build no longer puts beside it (#812): every session journalled nothing, and smoke:real's real `opencode run` still passed, because it installs the smoke fixture, which journals nothing, and only asks whether the bridge loads. smoke:real now installs this repository's own aidd-telemetry into a throwaway project for opencode, turns measurement on, runs `opencode run` and reads the run journal. A session opens on its first call, so only a turn that completed can prove an empty journal: a completed turn with no session_start line is a failure, a model that never answered is a skip that says so. Refs #814 Claude-Session: https://claude.ai/code/session_011x4ms5qcGuZgYhCxfdHMUb AIDD-Session-Id: 4acc9a1c-19bc-4468-b8b6-e86644bcba60 Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.
What
opencode-plugin.jsspawned./journal.cjsas its own sibling. The build stopped putting every hook script flat into.opencode/plugin/and now namespaces them under.opencode/hooks/<plugin>/, so that path names nothing: every spawn exitedMODULE_NOT_FOUND, the plugin's owntry/catchswallowed it, and OpenCode recorded no session at all while still reading as covered.This is in the published release, not only on
next.Evidence
A real
opencode runin an installed project wrote zero journal lines. The same run after repointing the path:telemetry readthen returned 2 requests, 16,303 input and 39,104 cache-read tokens, and all 12 axes reconciled to the totals.Re-proved through rebuild,
aidd setup, thenopencode runagainst the untouched installed file, not a hand-edited one.Guards
Neither existing test could catch this: the pure-seam tests never touch the path, and
opencode-plugin.test.jsstaged its fixture in the layout the build no longer writes, so it agreed with the bug.build.unit.test.tsreads theJOURNAL_SCRIPTliteral out of the shipped module and resolves it against the path the build contract declares. Red on flipping the literal back; red on movingOPENCODE_HOOKS_DIR.opencode-plugin.test.jsnow mirrors the split layout the loader actually sees. Red 2 of 3 on the old path.Also
The plugin README drops from 231 to 141 lines: what it is, why it exists, how it works, how to start, what each tool can answer. Every partly-measurable tool keeps its reason, since a limit a reader has to look up gets read as a zero.
Gates
451 test files / 5441 tests, 441 repository script tests, typecheck clean, bundle 645.0 KB / 654 KB.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp