Skip to content

fix: a multi-turn step's trajectory readers offer every turn, not only the last - #979

Open
sarah-chitty-1 wants to merge 3 commits into
mainfrom
sarahchitty/always-on-per-wake-trajectories
Open

sarah-chitty-1 wants to merge 3 commits into
mainfrom
sarahchitty/always-on-per-wake-trajectories

Conversation

@sarah-chitty-1

@sarah-chitty-1 sarah-chitty-1 commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

What was broken

Two kinds of step run several turns and store one trajectory per turn in target_agent_per_turn_trajectory_object_urls:

  • an always_on step, one per wake;
  • a multi-turn prompt_agent step, one per turn, e.g. a user-sim conversation.

agent_trajectory_object_url holds only the last turn's. The explorer's download bar and the agent-env task run output read only that field, so the earlier turns could not be downloaded from either.

What changes

Explorer download bar. One entry per prompt response.

  • A response with one trajectory keeps today's label, tooltip and behavior.
  • A response with several distinct turn trajectories gets a button that downloads its last turn, labelled "Trajectory (turn n of n)" (or " (turn n of n)" beside other steps). A chevron next to it opens a turn picker that lists every turn as "turn k of n".
  • When the bar collapses into its dropdown, such a response is one row, with its turns in a submenu.
  • A Claude Code atif/1 run, whose turns share one document, still shows one button.

The picker uses the explorer's existing Radix Themes DropdownMenu. No new UI library.

CLI. agent-env task run keeps its agent_trajectory_object_url line. When a response has more than one trajectory, it also lists every turn's URL in turn order.

PromptResponse.trajectory_object_urls() and the UI's runTrajectoryUrls() hold the rule in one place each: every turn's URL in order, without gaps or repeats, then the last URL if the list lacks it.

What is not affected

No grader or score changes. Every verifier that scores already reads the per-turn list or no trajectory.

The explorer's trajectory viewer already showed every turn of both kinds of step, so it is unchanged.

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 previous commit (one button per turn) and on main (last turn only).
  • trajectory-url.smoke.ts: runTrajectoryUrls for always_on wakes, a multi-turn prompt_agent run, atif shared turns, and a single trajectory.
  • Python: trajectory_object_urls() cases; the task run output for always_on and multi-turn prompt_agent steps (these fail with the CLI change reverted); an always_on run's stored prompt response carries every wake under both stored keys.
  • Ran: all explorer smokes (15 ran, 2 skipped for missing fixtures, 0 failed), strict tsc --noEmit, eslint on the changed files, tst/unit/cli plus the trajectory unit tests (all pass), and ruff check.

Follow-up

The hub has the same gap: get_run_status and get_task_run return only the last turn's trajectory URL.

🤖 Generated with Claude Code

Confidence Score: 5/5RetriggerView in Greptile

The PR appears safe to merge; the previous main-download issue is fixed.

Summary

The PR makes every distinct turn trajectory available through the explorer download bar and CLI.

  • The explorer lets readers download every distinct turn trajectory.
  • Task-run output lists every distinct trajectory when a response has several.

Reviews (3) · Last reviewed commit: "fix(explorer): a response's download is ..." · Reviewed by Greptile

…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>
@sarah-chitty-1
sarah-chitty-1 requested a review from a team as a code owner December 1, 2026 18:39
Comment thread src/agent_env/task_step/context.py Resolved
…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>
@sarah-chitty-1 sarah-chitty-1 changed the title fix(always_on): readers of a run's trajectory read every wake, not only the last fix: a multi-turn step's trajectory readers offer every turn, not only the last Dec 1, 2026
…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>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant