Desired outcome
agentrace show <id> tells the user when the id they gave is ambiguous, instead of silently picking one run.
Why it matters
cmd_show() in agentrace/cli.py:
match = [r for r in runs if r.tool_use_id.endswith(args.id)]
if not match:
console.print(f"[red]No run matching {args.id!r}[/]")
return 1
r = match[0]
The command deliberately accepts a short id, and cmd_list prints exactly that short form (r.tool_use_id[-8:]), so short ids are the normal way to use this. But endswith is a suffix match on an arbitrary user string. agentrace show 1 matches every run whose id ends in "1", and the user is shown match[0] with no indication that seven other runs matched. The header prints the full tool_use_id, but nobody re-reads an id they just typed, and across sessions run ids are not shown side by side.
Silently showing the wrong run in a triage tool is worse than an error: the user reads a result, forms a judgement, and attributes it to a different agent run.
Steps
- When
len(match) > 1, print the matching ids with their descriptions and return non-zero, asking the user to be more specific.
- Allow the obvious escape hatch: if one of the matches is an exact
tool_use_id, use it without complaint.
r.description can be None, in which case the header currently prints the literal "None". cmd_list already handles this with (r.description or "(none)"), so reuse that.
- Add a test in
tests/test_agentrace.py with two runs sharing an id suffix, asserting a non-zero exit.
Claiming this
Comment below to claim it. A reply usually comes within a day.
Desired outcome
agentrace show <id>tells the user when the id they gave is ambiguous, instead of silently picking one run.Why it matters
cmd_show()inagentrace/cli.py:The command deliberately accepts a short id, and
cmd_listprints exactly that short form (r.tool_use_id[-8:]), so short ids are the normal way to use this. Butendswithis a suffix match on an arbitrary user string.agentrace show 1matches every run whose id ends in "1", and the user is shownmatch[0]with no indication that seven other runs matched. The header prints the fulltool_use_id, but nobody re-reads an id they just typed, and across sessions run ids are not shown side by side.Silently showing the wrong run in a triage tool is worse than an error: the user reads a result, forms a judgement, and attributes it to a different agent run.
Steps
len(match) > 1, print the matching ids with their descriptions and return non-zero, asking the user to be more specific.tool_use_id, use it without complaint.r.descriptioncan beNone, in which case the header currently prints the literal "None".cmd_listalready handles this with(r.description or "(none)"), so reuse that.tests/test_agentrace.pywith two runs sharing an id suffix, asserting a non-zero exit.Claiming this
Comment below to claim it. A reply usually comes within a day.