Skip to content

CORE (signing sitting): wire transcriptPath into the session-end hook (WO-TRACE-BRIDGE-01 last mile) - #48

Merged
githubscum merged 1 commit into
lotor-lane/subagent-receiptsfrom
lotor-lane/hook-wire-transcriptpath
Sep 7, 2026
Merged

githubscum merged 1 commit into
lotor-lane/subagent-receiptsfrom
lotor-lane/hook-wire-transcriptpath

Conversation

@githubscum

Copy link
Copy Markdown
Owner

CORE (signing sitting). Stacked on #47 (base branch: lotor-lane/subagent-receipts) — this diff is one new test file; everything else in the compare view is #47's, already reviewed there.

What this closes

WO-TRACE-BRIDGE-01's write half landed the reader (src/ingest/subagents.js) and the wiring into ingestSession (opts.transcriptPath -> a bound subagents summary), both non-core and both in #47. The one remaining piece is the production caller: the session-end hook, which is the only caller that runs in real use. As of main plus #47, it still calls ingestSession without transcriptPath, so the reader that PR #47 proves works never actually fires outside a test.

What's in this PR

One fail-first test (test/hook-session-end-subagents.test.js) that runs the real hook binary against a real transcript with a real, non-empty subagents sidecar directory, and asserts today's dark result: the receipt the hook writes carries no subagents field. It is written to flip, not to pass forever — the assertion message says so and names what to do instead of deleting it when the fix lands.

The fix itself, for the signing sitting

bin/hook-session-end.js is core (bin/hook-*) and the self-mod gate denied this lane's attempt to edit it unsigned (request logged, denial receipted). The change is one word:

- const result = ingestSession(text, { transcriptBytes: bytes });
+ const result = ingestSession(text, { transcriptBytes: bytes, transcriptPath });

transcriptPath is already in scope in main() two lines above — no new variable, no new import.

What was tested

Full suite on this branch: 953/953 (952 from #47 + 1 new). The new test passes today because it asserts the absence of the field; it should be re-run and flipped to assert presence plus the expected count/totals (shape mirrors the second case in test/subagent-ingest-wiring.test.js) once the one-line fix lands in the same signing sitting.

What a reviewer should doubt

🤖 Generated with Claude Code

ingestSession already reads opts.transcriptPath and binds a subagents
summary onto the receipt when a sibling <basename>/subagents/ directory
exists (test/subagent-ingest-wiring.test.js, PR #47). The session-end
hook -- the only caller that matters in production -- does not pass
transcriptPath through, so the reader never fires outside a test.

This adds one fail-first test that runs the real hook binary against a
real transcript with a real subagents sidecar and asserts today's dark
result: no `subagents` field on the receipt. It is meant to flip, not
pass forever.

The core file (bin/hook-session-end.js) is gated and this lane cannot
land the one-line fix unsigned (self-mod denial on attempt). The fix,
for the signing sitting:

  bin/hook-session-end.js, ~line 127
    - const result = ingestSession(text, { transcriptBytes: bytes });
    + const result = ingestSession(text, { transcriptBytes: bytes, transcriptPath });

Suite: 953/953 (952 baseline on this branch + 1 new).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@githubscum
githubscum merged commit c2938e6 into lotor-lane/subagent-receipts Sep 7, 2026
githubscum added a commit that referenced this pull request Sep 7, 2026
land #48 on main (merged into #47's branch before retarget)
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