Repository navigation
Refactor: Share the tool-call pairing between the timeline and the export #2041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
4162082
Refactor: Share the tool-call pairing between the timeline and the ex…
mrsabath 84d4e09
Fix: Remove the extraction's dead duplicates and make lostFor fail cl…
mrsabath 410966e
Fix: Alias the agent keys, and scope the export claims to what ships
mrsabath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package timeline | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/rossoctl/cortex/core/session/toolpair" | ||
| ) | ||
|
|
||
| // TestLostForFailsClosedOnAnUnknownReason is the guard on the mapping's DIRECTION. | ||
| // | ||
| // lostFor used to name the no-result reasons, so a reason added to toolpair later matched none | ||
| // of them and read as "not lost" — and a call that ended without a result then rendered as | ||
| // still running, forever, on a pane whose job is showing what finished. Deriving it from HasEnd | ||
| // inverts that: an unknown reason is lost until someone says otherwise. A future reason must | ||
| // not need an edit here, and this test fails if the derivation goes back to a list. | ||
| func TestLostForFailsClosedOnAnUnknownReason(t *testing.T) { | ||
| if !lostFor(toolpair.EndReason("some_reason_added_later")) { | ||
| t.Error("lostFor(unknown) = false, want true: an unrecognised reason must read as lost, not as open") | ||
| } | ||
| // The zero reason is the one exception: still open is not a kind of loss. | ||
| if lostFor("") { | ||
| t.Error(`lostFor("") = true, want false: an open call has no end at all`) | ||
| } | ||
| for _, r := range []toolpair.EndReason{toolpair.ReasonResult, toolpair.ReasonBackground} { | ||
| if lostFor(r) { | ||
| t.Errorf("lostFor(%q) = true, want false: it carries an end", r) | ||
| } | ||
| } | ||
| for _, r := range []toolpair.EndReason{toolpair.ReasonEndedRun, toolpair.ReasonStopped, toolpair.ReasonAbandoned} { | ||
| if !lostFor(r) { | ||
| t.Errorf("lostFor(%q) = false, want true", r) | ||
| } | ||
| } | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Good change. The comment around it is a bit off, though:
agentLabeldoesn't exist in this package.agentLabel/agentLabelInlive incore/session(summary.go,fold.go) and have nothing to do with these keys. The comparison you mean islinkAgents'switch id { case MainAgent: … case UnseparatedAgent: … }(agents.go:253-261).UnseparatedAgentdrifted, thec.agent != UnseparatedAgentguard on theresentline would stop excluding the shared bucket, so its turns would start being flagged as retries.linkAgentswould also miss thecase, so the bucket would lose its "subagents (not separated)" label and go through spawn matching like a real subagent.The argument for aliasing is the same either way. Only the example should match the code. Something like
(buildAgents' resent guard, and linkAgents' label switch) … the shared bucket's turns read as retries and it is linked as if it were a real subagent.