feat(trace): trace ordinary tool calls - #147
Open
rgao-coreweave wants to merge 4 commits into
Open
Conversation
This was referenced Jul 22, 2026
rgao-coreweave
force-pushed
the
109-11-tool-spans
branch
from
July 23, 2026 01:43
5ffba92 to
62fd1bb
Compare
This was referenced Jul 23, 2026
rgao-coreweave
marked this pull request as ready for review
July 23, 2026 05:44
rgao-coreweave
force-pushed
the
109-11-tool-spans
branch
2 times, most recently
from
July 23, 2026 16:24
6094f02 to
81f846a
Compare
ro31337
reviewed
Jul 23, 2026
| if (session.calls.byToolUseId.has(input.tool_use_id) | ||
| || session.calls.toolUseTombstones.has(input.tool_use_id)) return; | ||
|
|
||
| const turn = this.ensureTurn(session, input.prompt_id); |
There was a problem hiding this comment.
after a daemon restart, could this create an empty turn and miss the prompt and the model response that triggered the tool?
For example, if the transcript already has one response, responseOffset will be 1 and userText will be undefined, so the recovered turn will miss both the prompt and that response, right?
Contributor
Author
There was a problem hiding this comment.
Good catch! Matching SessionEnd currently repairs the turn, but Stop, a subsequent prompt, or shutdown can finalize it first. I’ll recover the owning transcript turn by exact tool_use_id, retain the fail-closed fallback when no match exists, and add regression coverage.
rgao-coreweave
force-pushed
the
109-11-tool-spans
branch
from
July 23, 2026 22:46
81f846a to
24230c5
Compare
rgao-coreweave
force-pushed
the
109-11-tool-spans
branch
from
August 4, 2026 21:28
24230c5 to
307124b
Compare
This was referenced Aug 6, 2026
rgao-coreweave
force-pushed
the
109-11-tool-spans
branch
from
August 7, 2026 19:24
914d95e to
2eb8521
Compare
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.
Summary
Trace ordinary tool calls as children of their owning turn.
ToolLifecyclecorrelates exacttool_use_idvalues, ignores duplicate terminal hooks, recovers restart-first results, and closes tool spans before their parent turn.HookHandlerhandles ordinary pre- and post-tool hooks.Sessionkeeps turns open while their tool children are active.tool_use_id; completed historical turns are bounded so later responses cannot leak into them.The special
Agenttool remains deferred to its dedicated lifecycle.Validation
npm run check