Skip to content

fix(telemetry): opencode reads journal.cjs where the build puts it - #812

Merged
blafourcade merged 1 commit into
nextfrom
fix/opencode-journal-path
Sep 10, 2026
Merged

fix(telemetry): opencode reads journal.cjs where the build puts it#812
blafourcade merged 1 commit into
nextfrom
fix/opencode-journal-path

Conversation

@blafourcade

Copy link
Copy Markdown
Contributor

What

opencode-plugin.js spawned ./journal.cjs as 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 exited MODULE_NOT_FOUND, the plugin's own try/catch swallowed 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 run in an installed project wrote zero journal lines. The same run after repointing the path:

{"type":"session_start",...,"tool":"opencode","vendor_id":"ses_f78b05b59ffe..."}
{"type":"task_declared",...,"path":"aidd_docs/tasks/2026_09/2026_09_09_probe/plan.md"}
{"type":"turn_end",...}

telemetry read then 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, then opencode run against 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.js staged its fixture in the layout the build no longer writes, so it agreed with the bug.

  • 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 now 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

`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
@blafourcade
blafourcade requested a review from a team as a code owner September 10, 2026 03:27
@blafourcade
blafourcade merged commit ebd7fe9 into next Sep 10, 2026
25 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant