Repository navigation
fix: a multi-turn step's trajectory readers offer every turn, not only the last - #979
Merged
Merged
Conversation
…ly the last An always_on step's prompt response already records each wake's trajectory, in wake order, under target_agent_per_turn_trajectory_s3_uris / _object_urls. agent_trajectory_s3_uri is the last wake alone (on a 7-wake run, 15 of its 353 tool calls). Every verifier that scores reads the per-turn list or no trajectory, so no score came from one wake. Two readers here did read only the last: - `agent-env task run` printed only agent_trajectory_object_url. It now lists every turn's url too, when there is more than one, and keeps the existing line. - The explorer's download bar offered only the last turn of each prompt response. It now gives one entry per turn, labelled by turn, reading turns that share an atif/1 document once. PromptResponse.trajectory_object_urls() and the UI's runTrajectoryUrls() name the rule once: each turn's url in order, without gaps or repeats, then the last url if the list lacks it. It is the same rule agentenvhub-sdk's trajectory_validation already applies. A test pins that an always_on run's stored prompt response carries every wake under both stored keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or a multi-turn step Two kinds of step store one trajectory per turn in target_agent_per_turn_trajectory_object_urls: an always_on step, one per wake, and a multi-turn prompt_agent step, one per turn (a user-sim conversation). The previous commit made the download bar offer every turn, but as one button per turn, so a 20-turn conversation put 20 buttons in the bar. The bar now has one entry per prompt response: - A response with one trajectory keeps its label, tooltip and button exactly as before. - A response whose turns stored several distinct trajectories gets a button that downloads its last turn, labelled "Trajectory (turn n of n)" (or "<step> (turn n of n)"), and a chevron that opens a turn picker listing every turn as "turn k of n". In the collapsed dropdown it is one row with the turns in a submenu. - A Claude Code atif/1 run, whose turns share one document, still gets one plain button. Both use the explorer's existing Radix Themes DropdownMenu. The collapse threshold now counts responses. Tests: the bar smoke covers a single trajectory (unchanged), an always_on run of several wakes, a 20-turn prompt_agent conversation beside a single-turn step, and atif shared turns; the trajectory-url smoke and the `task run` CLI tests add a multi-turn prompt_agent case. No grader or score reads any of this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…un list's last entry The bar's main button took the last entry of runTrajectoryUrls. An atif/1 run whose middle turn's copy failed stores per-turn [A, B, A]; the de-duplicated list is [A, B], so the button downloaded B while agent_trajectory_object_url is A. It now downloads the response's own url (trajectoryUrl), labelled by the last turn that stored it, falling back to the list's last entry when the response has none. The picker still lists every distinct trajectory. A url the per-turn list lacks is labelled "last available", not "last turn". agent_trajectory_object_url is the last available trajectory, not always the last turn's: both writers (always_on, prompt_agent) take the last turn that stored one. Say so in PromptResponse, trajectory_object_urls() and the explorer's helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as a nudge An always_on step's per-turn lists hold a wake's nudge turn beside the wakes, so the bar's "turn k of n" counted nudges and turn k wasn't wake k. Each turn's record (TurnTrajectory) now names its wake and marks a nudge (wake, nudge), kept through a stored round trip. The bar labels a wake "wake k of n" and a nudge "nudge after wake k", and the picker counts wakes. Other steps' turns, and runs recorded before this, keep "turn k of n". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and shows a shared one once
Review findings on the multi-turn trajectory readers:
- `task run` listed a run's trajectories with no turn numbers. The list skips turns that stored
none, so for [w1, None, w3] the second url read as turn 2. Each line now names its turn, "turn
k of n", with the wake on an always_on step ("wake j" / "nudge after wake j"), and "last
available" for a response url the per-turn list lacks.
- One file had two turn labels. For per-turn [A, B, A] the bar's button placed A at its last turn
("turn 3 of 3") while runTrajectoryUrls kept its first ("turn 1 of 3"). An atif/1 document is
rewritten each turn, so it holds its last turn's copy: runTrajectoryUrls and core both list a
url several turns stored once, at the last such turn, in turn order, and the button reads its
label from that list.
- The collapsed bar's "Download any of N files" / "Download Trajectories (N)" counted responses,
not files; barDownloadFileCount counts a turn picker's turns.
- The trajectory viewer fanned a response out per turn with no dedupe: an atif/1 run of N turns
rendered its one document N times. It now builds its sections with trajectorySections, one per
distinct trajectory, a shared document's section holding each of its turns' trigger strips, and
shows a response url the per-turn list lacks. Within a step, sections keep response order, then
turn order.
Also: PromptResponse.trajectory_object_urls() is distinct_trajectory_object_urls(), returning
(turn, url) pairs (every caller is in this PR); its field comments name prompt_agent as well as
always_on; the bar's menu item and turn list are one component each and its buttons share one
class string; the smokes compare with isDeepStrictEqual, not JSON.stringify.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…by wake, as the bar does The viewer still labelled every section "Turn k/n". On an always_on run the per-turn list holds each wake's nudge beside the wakes, so turn k need not be wake k, and the bar beside it already said "wake k of n". turnLabel moves from bar-downloads to trajectory-url, and the viewer names a section's turn through it (sectionTurnLabel): "wake k of n", "nudge after wake k", "turn k of n" for a step or run whose records name no wake, "last available" for a url the per-turn list lacks, and nothing for a response of one section. Other steps' sections now read "turn k of n" too, the bar's wording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AhmedArifK
approved these changes
Dec 3, 2026
sarah-chitty-1
deleted the
sarahchitty/always-on-per-wake-trajectories
branch
December 3, 2026 03:52
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.
What was broken
Two kinds of step run several turns and store one trajectory per turn in
target_agent_per_turn_trajectory_object_urls:always_onstep, one per wake;prompt_agentstep, one per turn, e.g. a user-sim conversation.agent_trajectory_object_urlholds only the last turn's. The explorer's download bar and theagent-env task runoutput read only that field, so the earlier turns could not be downloaded from either.What changes
One rule for every reader.
PromptResponse.distinct_trajectory_object_urls()and the UI'srunTrajectoryUrls()hold it, one place each: every turn's URL in turn order, with the turn it belongs to. Turns that stored none are skipped. A URL that several turns stored is listed once, at the last of them: an atif/1 document is rewritten each turn, so it holds the last turn's copy. Then the response URL comes last, with no turn, if the per-turn list lacks it.Explorer download bar. One entry per prompt response.
TurnTrajectory) now names its wake and marks a nudge (wake,nudge). The picker counts wakes. Runs recorded before this, and other steps, keep "turn k of n".The picker uses the explorer's existing Radix Themes
DropdownMenu. No new UI library.Explorer trajectory viewer. It already showed every turn, but showed a document once per turn that stored it, so an atif/1 run of N turns rendered the same conversation N times. It now shows each distinct trajectory once (
trajectorySections). A shared document's section keeps the trigger strip of every turn that stored it. A response URL that the per-turn list lacks now gets a section too. Each section names its turn as the bar does: an always_on run's by wake ("wake k of n", "nudge after wake k"), other steps' "turn k of n" (they read "Turn k/n" before). A response with one section names no turn.CLI.
agent-env task runkeeps itsagent_trajectory_object_urlline. When a response has more than one trajectory, it also lists each one in turn order with its turn, e.g.- turn 3 of 3: s3://…, and on an always_on step its wake, e.g.- turn 2 of 3 (nudge after wake 1): s3://….What is not affected
No grader or score changes. Every verifier that scores already reads the per-turn list or no trajectory.
Tests
bar-downloads.smoke.ts: a single trajectory (unchanged), an always_on run of several wakes, a 20-turn prompt_agent conversation beside a single-turn step, and atif shared turns. The multi-turn cases fail both on the first commit (one button per turn) and onmain(last turn only). For [A, B, A], the button and the picker both call A "turn 3 of 3". The file count covers a picker's turns.trajectory-url.smoke.ts:runTrajectoryUrlsfor always_on wakes, a multi-turn prompt_agent run, atif shared turns, [A, B, A], and a single trajectory.trajectorySectionsfor shared turns, [A, B, A], and a URL the list lacks.sectionTurnLabel, the viewer's name for a section, for an always_on run with a nudge, a step with no wake records, and a one-section response (fails on the previous head, which said "Turn k/n").bar-downloads.smoke.tsandtrajectory-url.smoke.tscover an always_on run with a nudge (turn 2 is "nudge after wake 1", not wake 2), a run whose last turn is a nudge, and a record with no wake.test_always_on_trajectory_formats.pychecks each turn'swakeandnudgethrough a stored round trip.distinct_trajectory_object_urls()cases, [A, B, A] included. Thetask runoutput for always_on and multi-turn prompt_agent steps names each URL's turn, skips a turn that stored none, labels a nudge, and lists a shared document at its last turn. These tests fail on the previous head.psi-ts-rw-fender-bender-9lwjdrec(31 wakes, no nudges). The instance came from the run's stored always_on timeline, since the hub tools don't return the per-turn lists. The run predates thewakefield, so for the wake labels each turn's record was rebuilt from the timeline (turn k is wake k when there are no nudges). Result: 31 sections, one per distinct trajectory, labelled "wake 1 of 31" … "wake 31 of 31", and a loaded wake read from S3. Without the records the same run reads "turn k of 31" and the bar reads "Trajectory (turn 31 of 31)".tsc --noEmit, eslint on the changed files (no new warnings),tst/unit/cliwith the trajectory and judge-batch unit tests (526 passed), andruff check.Follow-up
The hub has the same gap:
get_run_statusandget_task_runreturn only the last turn's trajectory URL.🤖 Generated with Claude Code
Confidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.Summary
The latest changes make the viewer and download bar use the same turn labels.
Both earlier, unnumbered findings are fixed: the documentation says “last available,” and the main download selects the response’s URL for
[A, B, A].Reviews (9) · Last reviewed commit: "fix(explorer): the trajectory viewer lab..." · Reviewed by Greptile