Repository navigation
fix: count sub-agent tokens in scode-shepherd status - #516
Merged
Merged
Conversation
`shepherd status` is where a run's token totals come from, and the supervisor's final report repeats them. It counted only each worker and reviewer session's own thread. Codex runs a session's native sub agents as threads of their own, and their tokens never reach the parent's total. In a benchmark run, one worker session started ten sub agents, and those used more tokens than all five worker sessions together, so the reported worker use was about half the real one. The runner now adds each session's sub agents, at any depth, found through the parent link codex writes at the top of every sub agent's session file, and `status` says how many sub-agent threads the worker and reviewer totals include. Under `shepherd drive`, the headless mode where the script runs the supervisor and so records its token use (an interactive supervisor's is not recorded at all), that total includes the supervisor's sub agents the same way, with their count. A `codex exec` that a session starts from its shell has no parent link and is still not counted. The same run's supervisor did its read-only research with `codex exec --ephemeral`, which writes no session file, so those sessions could be neither counted nor checked afterwards for what they were told and read. The skill now tells the supervisor not to pass that flag.
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.
shepherd statusis where a run's token totals come from, and the supervisor's final report repeats them. It countedonly each worker and reviewer session's own thread. Codex runs a session's native sub agents as threads of their own,
and their tokens never reach the parent's total. In a benchmark run, one worker session started ten sub agents, and
those used more tokens than all five worker sessions together, so the reported worker use was about half the real one.
The runner now adds each session's sub agents, at any depth, found through the parent link codex writes at the top of
every sub agent's session file, and
statussays how many sub-agent threads the worker and reviewer totals include.Under
shepherd drive, the headless mode where the script runs the supervisor and so records its token use (aninteractive supervisor's is not recorded at all), that total includes the supervisor's sub agents the same way, with
their count. A
codex execthat a session starts from its shell has no parent link and is still not counted.The same run's supervisor did its read-only research with
codex exec --ephemeral, which writes no session file, sothose sessions could be neither counted nor checked afterwards for what they were told and read. The skill now tells the
supervisor not to pass that flag.