Repository navigation
Description
This was generated by AI during triage.
What happens
Run metrics take tokens only from the Harness's own event stream: Claude's result event and Codex's turn.completed. When a session starts another agent CLI itself, its tokens are never counted and only its elapsed time lands in the Step. Examples are claude -p … or codex exec … run through Bash, which an orchestrating skill does for each sub-agent. Claude Code's own Agent-tool subagents are probably included in the root result, but that is inferred, not documented.
So a Custom process whose skill Step orchestrates sub-agents across providers looks nearly free next to a Built-in process, even when it spends several times the tokens. That undermines any comparison of Processes or Arms (#1468), as well as the per-Command cost and token figures a Day shift reads. The details, with file and line evidence, are in docs/research/process-comparison-cost-accounting.md. The hand-run comparison in #1628 has to parse the sub-agents' streams with its own script to work around this.
What it could look like
- (a) Each session's environment names a directory, such as
THIRDSHIFT_CHILD_STREAMS. Skills are asked to write each child CLI'sstream-json/--jsonoutput there, and thirdshift sums it into the session's Run metrics by observed model, as it does for its own sessions. - (b) thirdshift wraps the
claudeandcodexbinaries on the session'sPATHwith shims that tee each child's stream into that directory, so skills need no changes. This is more invasive, and it is harness-version-sensitive. - (c) Only record that child CLIs ran, and flag the session's tokens as incomplete rather than counting them.
Either way, report child tokens separately from the session's own, so nothing that is counted today changes meaning.
Open questions
- Is a convention that skills opt into (a) enough, or must it work for skills that don't know about it, which means (b)?
- Should Run metrics carry a "tokens incomplete" flag whenever a session ran a known agent CLI that wasn't captured?
- Does any of this belong in the Experiment's Arms, so that Spec: Custom-runner Arms for process Experiments #1468's Process-defined Arms count the same way?
Activity
JacobStephens2 commentedon Nov 10, 2026
Investigation summary
Investigated #1639 against main at 0009a53. The shell-launched child-CLI accounting gap is supported by the current code, but the capture and completeness contract needs a Day shift decision before implementation.
Evidence:
This is distinct from open #1651, which covers native Codex subagents and observed Model attribution, and #1655, which covers Custom process metric persistence. The latter also qualifies this report's claim that a Custom process currently retains ordinary Run metrics: src/logs/command_record.rs:373 still excludes Process records.
Recommended direction: start with an opt-in child-stream contract, keep existing Session measurements unchanged, and expose captured child measurements separately by observed Model. Reuse the existing interpreters and usage rules. Preserve child evidence through worktree cleanup, identify ownership per Session/invocation, and handle repeated files, nested children, interrupted streams and Resumes without double counting. Define completeness explicitly; an empty directory cannot establish that no child CLI ran. Propose the implementation split through the questionnaire below. No duplicate issue or GitHub comment is proposed.
Questionnaire
For the Day shift deciding #1639: repository inspection supports the missing shell-launched child usage, but does not settle the capture policy. These decisions will make the work implementable.
Is an opt-in stream directory sufficient for the first release, or must unmodified skills be captured automatically? Recommend the opt-in convention first. Requiring transparent capture means separately shaping PATH wrappers, supported CLI versions and bypass behavior.
Approve or amend this proposed split: (A) Session-owned child registration, stream collection and retained evidence, initially for Claude and Codex; (B), blocked by A, separate child usage and coverage reporting in Run metrics, CLI/Console views and documentation; (C), blocked by A and the shared reporting contract, Experiment discovery and frozen-price accounting for those children. Keep native Codex accounting in Codex sessions miss native sub-agent tokens and record no observed Model #1651 and Custom process metric persistence in Custom process Commands record no Run metrics, and their header shows the default harness #1655. Automatic wrappers would be a separate follow-up if required by question 1.
What coverage guarantee should the opt-in contract promise? Recommend distinguishing unknown coverage, explicitly declared complete capture, and known missing/partial capture. Should a missing declared child stream become an Experiment accounting gap? An absent registration alone cannot prove completeness, and shell-command matching cannot guarantee detection of every invocation.
Should Experiment Arms consume the same captured child evidence automatically, without a new Arm setting? Recommend preserving existing own-Session figures, showing child figures separately, and using the existing frozen-price/accounting-gap rules for comparison totals. Child durations must not be added to elapsed wall time, and native subagents already represented by Harness usage must not be imported again.