Skip to content

feat(task_step): target a deployment by env_step_id in the env setup steps - #797

Merged
tejas-latupalli merged 4 commits into
mainfrom
claude/env-step-id-setup-steps
Nov 19, 2026
Merged

tejas-latupalli merged 4 commits into
mainfrom
claude/env-step-id-setup-steps

Conversation

@tejas-latupalli

@tejas-latupalli tejas-latupalli commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Why

When a task deploys one env several times, sync_env_clock, modify_env_tool_access and register_env_triggers each took the first deployment of their env_id. The clock, tool-access and trigger setup landed on that first deployment only.

What changed

  • The three steps take an optional env_step_id, carried through __init__, to_dict and from_dict. It names the deploy_env step whose deployment a step acts on. The steps resolve it through deploy_agent's bound_deployment(), as set_env_clock_rate already does.
    • An env_step_id that names no deployment of the env raises.
    • Without env_step_id, a single deployment resolves as before.
    • Several deployments without env_step_id raise, as deploy_agent and load_artifact already did.
  • load_artifact drops its own copy of that resolver and calls bound_deployment().
  • Agents follow the clock of the deployment they are bound to. DeployedAgent records env_bindings: for each env, the deploy step of the deployment deploy_agent resolved, with or without env_step_id. An agent with no recorded binding, such as one agent-env didn't deploy, follows any deployment. sync_env_clock, late-deployed agents picking up the clock, and follower retirement all match on it, and the clock and follower records keep the deploy step. Before this, setting the clock on one deployment moved the other deployment's agents onto it.

Behaviour change: a stored task that deploys one env_id more than once and runs one of these steps without env_step_id now fails instead of using the first deployment. Such a task already has to set env_step_id on deploy_agent, which raises the same error.

Tests

  • New tst/unit/task_step/test_env_setup_steps_env_binding.py, run for each of the three steps:
    • two deployments of one env, with the step targeting the second by env_step_id
    • an unmatched env_step_id and ambiguity without one, both raising before any request
    • the single-deployment path, the not-deployed error and the env_step_id round trip
  • The load_artifact binding tests run execute with the artifact store and env loading mocked.
  • agent_clock_test.py adds tests with two deployments of one env and an agent bound to each. One test deploys an agent without env_step_id, then adds a second deployment and arms its clock; the agent stays on the first.
  • All 47 env-binding tests pass, and so do the existing sync_env_clock, modify_env_tool_access and register_env_triggers tests.
  • Locally, 3 unit tests fail the same way on main, in files this PR does not touch: 2 in test_mcp_cli_builder.py (the generated CLI's interpreter has no click) and 1 in test_disk_recipe.py.

Rollout

The hub picks this up only after an agent-env release and an agentenvhub-sdk pin bump.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new blocking issues were found.

Summary

Adds deployment-specific environment setup and keeps agents on the clock of their bound deployment.

  • Environment setup steps can target a specific deployment.
  • Agents stay with the deployment whose clock they follow.

No new actionable issues found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  S[Setup step with env_step_id] --> R[bound_deployment]
  R --> D[Selected environment deployment]
  A[deploy_agent] --> R
  A --> B[Saved agent env_bindings]
  D --> C[Deployment clock]
  B --> F[Match agent to deployment]
  C --> F
  F --> G[Agent follows its bound clock]
Loading

Reviews (9) · Last reviewed commit: "Merge origin/main into claude/env-step-i..." · Reviewed by Greptile

…steps

sync_env_clock, modify_env_tool_access and register_env_triggers took the
first deployment of their env_id, so a task that deploys one env several
times armed the clock, tool access and triggers on the first one only.
They now take an optional env_step_id and resolve through deploy_agent's
bound_deployment(), which load_artifact now uses as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tejas-latupalli
tejas-latupalli requested a review from a team as a code owner November 19, 2026 00:38
…bound to

sync_env_clock had every agent registered with its env_id follow the
clock it armed, so arming one of two deployments of an env moved the
other deployment's agents onto it. DeployedAgent now records the
env_step_id deploy_agent bound it with; sync_env_clock, late follow and
follower retirement match on it, and the clock and follower records keep
the deploy step. The load_artifact binding tests now run execute.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tejas-latupalli

Copy link
Copy Markdown
Contributor Author

@greptileai review — please re-review the latest commit (96fcda8), which addresses the clock-follower and binding-test comments.

An agent deployed without env_step_id recorded no binding, so it counted
as bound to any deployment of its env, and arming the clock of a later
deployment of that env moved it off the one its tools use. DeployedAgent
now keeps env_bindings, the deploy step of the deployment deploy_agent
resolved for each env, and the clock matches on it; an agent with no
recorded binding, as one agent-env didn't deploy, still follows any.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tejas-latupalli

Copy link
Copy Markdown
Contributor Author

@greptileai review

Resolve the agent_clock_test helper conflict by keeping both the
env_bindings argument and main's control_token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tejas-latupalli
tejas-latupalli merged commit d927185 into main Nov 19, 2026
35 checks passed
@tejas-latupalli
tejas-latupalli deleted the claude/env-step-id-setup-steps branch November 19, 2026 20:15
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.

3 participants