Repository navigation
WO-TRACE-BRIDGE-01: wire the subagent summary into ingestSession (write half, non-core) - #47
Merged
Merged
Conversation
…half) The subagent path leaves no child receipt on the chain and no usage figures, so the most common shape of agentic work today is invisible to the witness. This is the non-core half of the fix: a pure reader that derives the sidecar directory from a transcript path and summarises each child. collectSubagents distinguishes "no sidecar directory" (found:false) from "directory present, no readable child" (found:true, children:[]), and summarizeSubagents returns null only for the first, so a caller omits the field rather than recording a false zero. All summing is defensive: a usage field that is not a finite number contributes 0. Imports nothing from the project and writes no files, so it is grantable under the repo's own frozen core classification for ingest. The one line that supplies opts.transcriptPath in the session-end hook is core and waits for a signing sitting; until it is signed this ships dark and the receipt is byte-identical to today's. Tests: 7 new cases including the false-null guard. Full suite 948 pass / 0 fail. Written off-meter by glm-5.2:cloud via dispatch-to-ollama.ps1; verified by reading the artifacts and running the suite, not by the executor's report. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… write half continued) Non-core continuation of 4bfe127. summarizeSubagents existed and nothing called it. ingestSession now accepts opts.transcriptPath and, when a sibling <sessionId>/subagents/ directory exists, binds the summary onto receiptSummary.subagents before the chain append -- same precedent as the thought sidecar (2026-08-29): bind by summary, omit when absent, never a false zero. When transcriptPath is missing or summarizeSubagents returns null, the field is left off the payload entirely, verified by three tests alongside the one that proves the field appears with correct totals. This is still core-adjacent by one line, not by this file: nothing calls ingestSession with transcriptPath yet. bin/hook-session-end.js needs exactly one argument added to its existing ingestSession(text, opts) call -- opts.transcriptPath, which the hook already has in scope as the local `transcriptPath` variable -- and that file is bin/hook-* core, so it queues for Isaac's signing sitting rather than landing here. Until it is signed, this ships dark: the receipt is byte-identical to today's. Verification: the first draft's test file reused one sessionId across all four cases against a shared store, which triggered ingestSession's own no-change guard (a session whose transcript size has not grown is skipped) on three of the four -- caught by running the suite rather than trusting the executor's report, not a defect in the wiring itself. Fixed by giving each case its own sessionId. Suite 952 pass / 0 fail, up from 948 on main. Written off-meter by glm-5.2:cloud via dispatch-to-ollama.ps1 (the charter's named executor and fallback, deepseek-v4-flash:cloud and glm-5.3-flash:cloud, are not present in this host's ollama list; glm-5.2 is the nearest available match, same substitution run 20 made and verified). Test-fixture fix applied directly after verification found it. Co-Authored-By: Claude Sonnet 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.
WO
WO-TRACE-BRIDGE-01, Isaac's top-priority item for this lane (2026-09-02
09:3x CDT): "Lotor lane needs to solve for this... best trace ever needs
to bridge across." The Agent-tool subagent path leaves no chain row and
no usage figures per child, which is invisible under a herded policy
config and a billing blind spot regardless.
What this closes
Two commits on this branch:
4bfe127(run 20):src/ingest/subagents.js, a pure reader that turnsa child transcript sidecar directory into a structured summary. Nothing
called it.
6796c25(this run): wires it in.ingestSessionnow acceptsopts.transcriptPath; when a sibling<sessionId>/subagents/directoryexists it binds the summary onto
receiptSummary.subagentsbefore thechain append, same precedent as the 2026-08-29 thought sidecar (bind by
summary, omit when absent, never a false zero).
It still ships dark. Nothing calls
ingestSessionwithtranscriptPathyet.bin/hook-session-end.jsneeds one argument addedto its existing call -- the hook already has the value in scope as its
local
transcriptPath-- and that file isbin/hook-*core, so it isnot applied here and queues for the signing sitting. Until it is
signed, this receipt is byte-identical to today's.
What a reviewer should doubt
lane's charter (core changes queue, never apply outside a signing
sitting). It is exactly:
ingestSession(text, { transcriptBytes: bytes, transcriptPath })inbin/hook-session-end.js'smain(), wheretranscriptPathis alreadythe function's local variable. Small, but it is the switch that turns
the feature on.
priceTableDateis plumbed but never populated by any caller. Thefield exists in
subagents.js's output shape and this wiring passesopts.priceTableDatethrough unchanged; nothing supplies it yet, soevery
subagentsblock on a real receipt will lack that field until acaller is written. Not a defect in this PR, just an honest gap in what
"wired" means so far.
the suite rather than trusting the executor's report: it reused one
sessionIdacross all four cases sharing one store, which trippedingestSession's own no-change guard (three of four calls came backskipped: true). Fixed by giving each case a distinct session id.Worth a second look because it is exactly the kind of test that looks
right and silently proves nothing.
Tested
npm test: 952 pass / 0 fail, up from 948 on main. Four new cases:no-sidecar-dir omits the field, one-child sidecar produces exact totals,
and both existing call shapes (
ingestSession(text),ingestSession(text, { transcriptBytes })) keep working with the fieldabsent.
Provenance
Drafted off-meter by
glm-5.2:cloudviadispatch-to-ollama.ps1. Neitherthe charter's named executor (
deepseek-v4-flash:cloud) nor its fallback(
glm-5.3-flash:cloud) is present in this host'sollama list;glm-5.2is the nearest available match and the same substitution run 20 made and
verified. The production diff (
src/ingest/index.js) matched spec onfirst read; the test-fixture bug above was found and fixed after running
the suite, not accepted from the executor's summary.