Skip to content

fix(task-steps): a run-wide agent pick of another agent no longer takes the step's pinned version - #842

Merged
cikowski merged 5 commits into
mainfrom
fix/agent-override-version
Dec 1, 2026
Merged

cikowski merged 5 commits into
mainfrom
fix/agent-override-version

Conversation

@cikowski

@cikowski cikowski commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

A step's a2a_agent_version is the pinned version of the agent that step names. When a run picks a different agent for the whole run (user_overrides.a2a_agent_id: task run --a2a-agent-id, a hub run's agent pick) and gives no version, deploy_agent and install_agent asked the store for the picked agent at the step's pinned version. On main, a step pinned to theirs v4 run with a pick of mine asks for mine v4: a version that does not exist, or an unrelated build of the other agent.

Now a run-wide pick that names another agent is deployed or installed at the run-wide a2a_agent_version, or at its latest version when none is given. A pick that names the step's own agent (or the configured default agent, for a step that names none) keeps the step's pin.

An eval instance's version plan (#961, on main since this PR opened) reads each step's agent through the same two resolvers, so it now pins a picked agent at its latest version too; its test (tst/unit/eval/resolve_test.py) asserted the old rule and is updated here. The --a2a-agent-id help now says a picked agent runs at latest and that user_overrides.a2a_agent_version in --context-json pins it.

Unchanged: a step's own step_params override, a run-wide version with no run-wide id (applies to deploy_agent steps only, as before), and deploy_user_sim_agent, which never takes the run-wide pick.

Rollout

How it was tested

Validation: head b392af99 (main df247358 merged in; the PR's own diff is unchanged from 9061e6b1, where the local counts below were taken; CI is 34 of 34 green on b392af99). Each case runs the step's execute() and reads the (id, version) it asks the agent store for.

Done when Status Evidence
a pick of another agent does not take the step's pin (deploy and install) MET test_a_pick_of_another_agent_does_not_take_the_steps_pinned_version x3: fails on main (('mine', 4)), passes on head
a pick of another agent with a version uses that version MET test_a_pick_of_another_agent_with_a_version_deploys_that_version x3; the install case fails on main
a pick of the step's own agent, and no pick at all, keep the pin MET test_a_pick_of_the_steps_own_agent_keeps_its_pin x3, test_a_step_with_no_pick_keeps_its_agent_and_pin x3
a step naming no agent keeps its pin only for the default agent MET test_a_step_naming_no_agent_keeps_its_pin_only_for_the_default_agent x2: fails on main
a pick still runs where the default agent cannot be read from the config MET test_a_pick_runs_where_the_default_agent_cannot_be_read x2: fails on main on the version, and without the ConfigError catch
an eval plan pins a picked agent at latest, as the step reads it MET test_an_agent_overridden_without_a_version_is_pinned_as_its_step_reads_it x2: its new first assertion fails with main's resolvers ({}, read at the step's v1)
  • .venv/bin/python -m pytest -n0 tst/unit/task_step/run_wide_agent_pick_test.py tst/unit/bundle/agent_override_test.py tst/unit/task_step/test_step_overrides_agent_and_model.py tst/unit/task_step/test_deploy_user_sim_agent.py tst/unit/task_step/install_agent_test.py tst/unit/cli/task_run_agent_pick_test.py: 144 passed on 9061e6b1; pytest -n0 tst/unit/eval: 126 passed.
  • ruff check: clean on 9061e6b1.
  • With main's two resolvers, 8 of the 18 cases in run_wide_agent_pick_test.py fail (the rows marked above: 3 + 1 + 2 + 2).
  • On 61dcf8d (before the main merge), pytest tst/unit/task_step tst/unit/cli tst/unit/bundle -n 4: 5,793 passed, 14 skipped, 6 failed. The six (computer_exec_test.py, test_mcp_cli_builder.py) fail the same way with main's src on my machine, do not import this code, and pass in CI. A stale assertion of the old behaviour in tst/unit/bundle/agent_override_test.py is updated here.
  • Not run locally: integration suites (need Docker and a registry), the rest of tst/unit. The repo has no type-check or ruff format gate.
  • Screenshots: none (the only visible change is one --help line).

Quality bar

Head b392af99 (main merge only since 9061e6b1).

Gate Ran on Result
Local CI (ruff check, pytest on the touched suites) 9061e6b1 144 passed on the pick suites, 126 on tst/unit/eval; ruff clean (on 61dcf8d: 5,793 passed, 14 skipped, 6 failed, all six also on main)
Baseline: same tests with origin/main's resolvers 1db49dd 8 of 18 pick cases fail, as intended; the six unrelated local failures also on main
Test review: reran the tests and mutated the changed lines b392af99 PASS: PR diff unchanged by the main merge; 63 passed on the touched files, 3 of 3 mutants killed (earlier rounds: 8 of 8, 8 of 18 cases fail on main)
Adversarial review: probes for bad input, config and caller edges b392af99 PASS: main's run-lock and eval changes do not touch the pick path, 85 passed including run_lock_test (earlier: base-against-head matrix, every difference intended)
Conformance review: the spec and this description's claims b392af99 PASS after a stale neighbour-PR line was fixed
Greptile b392af99 5/5
CI b392af99 34 of 34 green; two integration shards rerun to green after a registry rate limit (429) in Docker builds
pr_gate.py check b392af99 runs at ready

Relaxations: none.

Not in this PR

Known limitations:

  • install_agent ignores a step_params override that sets only a2a_agent_version, where deploy_agent honours one (pre-existing on main; out of this PR's run-wide pick scope).
  • The --a2a-agent-id help names the key as user_overrides.a2a_agent_version; in the --context-json file it sits under metadata (the codebase's usual name for context.metadata["user_overrides"]; a top-level user_overrides is ignored, as on main).
  • Agents are compared by the id string, so a pick that names the step's agent through an alias counts as another agent and deploys latest (safe direction; resolving aliases here would need the installed-bundle lookup at step run time).
  • A pick over a step that names no agent reads the configured default agent to tell whether the pick is another agent. A default that the config cannot resolve is treated as another agent, but a default stored as a secret whose backend raises for that key fails the step, where main did not read it. Waived: catching every backend error here would hide an infrastructure failure that the same step hits on any run without a pick.
  • A pick of the step's own agent that also carries a run-wide version: deploy_agent takes that version and install_agent keeps its pin (pre-existing on main; install_agent has never read a run-wide version for its own agent).

🤖 Generated with Claude Code

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

A run-wide pick of another agent no longer inherits the step's pinned version.

  • A different run-wide agent pick uses that agent’s version.
  • Eval plans pin a different picked agent at its latest version.

Reviews (13) · Last reviewed commit: "merge main into fix/agent-override-versi..." · Reviewed by Greptile

…es the step's pinned version

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@cikowski
cikowski requested a review from a team as a code owner November 20, 2026 10:36
…ng state which version a picked agent runs at

@agutmanstein-scale agutmanstein-scale left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 61dcf8d. No blockers. Step overrides and a run-wide a2a_agent_version still win. Otherwise a run-wide pick of another agent gets its latest version and never the step's pin, and picking the step's own agent keeps the pin. install_agent behaves the same way. This is the UGML-1860 fix that synthetic-pipelines #2367 needs before re-registering.

@yzabelle-go yzabelle-go left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right fix: picking mine used to deploy mine at theirs's pin. The 144 touched tests pass locally, and merge-tree with main is clean. Two small comments: the CLI can't set the version the new help mentions, so a CLI pick always floats to latest, and the _resolve_agent_ref docstring now contradicts the own-agent case. Approving.

src/agent_env/task_step/task_steps/deploy_agent.py:335: This docstring still says an overridden id never takes the stored pin, but with this PR a pick of the step's own agent (or the default agent for an unnamed step) keeps it, as test_a_pick_of_the_steps_own_agent_keeps_its_pin checks. Worth updating it to the rule picks_another_agent now implements.

Comment thread src/agent_env/cli/task/run.py Resolved
cikowski and others added 3 commits November 30, 2026 14:15
…port lines (ConfigError, run_api_key/run_endpoint)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… at latest, as the step now reads it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cikowski
cikowski merged commit 2ef637f into main Dec 1, 2026
64 of 67 checks passed
@cikowski
cikowski deleted the fix/agent-override-version branch December 1, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants