Skip to content

fix(deploy_env): deploy the env version a run's step_params pin - #739

Open
revan-aleti wants to merge 1 commit into
mainfrom
revan/deploy-env-env-version-override
Open

revan-aleti wants to merge 1 commit into
mainfrom
revan/deploy-env-env-version-override

Conversation

@revan-aleti

@revan-aleti revan-aleti commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Tl;dr

deploy_env ignored a run's per-step env_version override, so a run pinned to an earlier env version deployed whatever the stored step names (usually the latest). It now deploys the pinned version; a run with no override is unchanged.

For Reviewers

  • The whole source change is DeployEnvTaskStep.run_env_version plus one call site in execute (src/agent_env/task_step/task_steps/deploy_env.py).
  • Subtle: preflight() still checks the stored version on purpose. It runs at save time, when no run overrides exist.
  • An override that is not a positive int or null raises ValueError before the env loads. bool is refused explicitly because True == 1. This is stricter than deploy_agent / install_agent, which pass version overrides through unchecked, and matches load_artifact's check of its artifact_id override.
  • Verify: pytest tst/unit/task_step/deploy_env_test.py (77 passed). Of the 13 new cases, 9 fail on main; the other 4 are the no-override regression cases.

For Agents

  • What Changed:
    • deploy_env.py: new run_env_version(context) reads step_param_overrides(context)["env_version"]; execute calls Env.get(self.env_id, self.run_env_version(context)).
    • tst/unit/task_step/deploy_env_test.py: 6 tests (13 cases): override honoured, override wins and leaves the stored step as stored, null means latest, no override unchanged (4 cases), bad values refused before load (5 cases), a missing version fails as a stored one does.
  • Constraints:
    • Uses the existing per-run seam TaskStep.step_param_overrides (task_step.py:152-158), the same one load_artifact, deploy_agent, install_agent and deploy_user_sim_agent read.
    • The stored step and its to_dict are never mutated by an override.
    • No version bump: releases are cut by automation (AGENTS.md).
  • Not in Scope:
    • preflight() / deploys_env() (save-time, stored version).
    • bundle/preflight.py stored_infra, which still reads the stored version for the CLI's local task run.
    • Printing the env version in the deploy log line.
    • The scaleapi worker and hub pin bumps that deliver this to runs.
  • Assumptions:
    • The hub already writes the override in this shape: scaleapi agent_env_hub/routers/qc.py _pinned_step_params builds {<step id>: {"env_version": <int>}} and _with_pins places it at user_overrides.step_params, which is what step_param_overrides reads.
    • A resumed run reattaches through the deployed env's recorded version (env.py), so it needs no change.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

deploy_env now uses the run’s per-step env_version override without changing the stored step.

  • Run-specific pins choose which environment version deploy_env loads.

Intentional exclusions acknowledged by revan-aleti: save-time preflight() and deploys_env() keep using stored versions; CLI stored_infra, version logging, and delivery pin bumps remain outside this change.

Reviews (1) · Last reviewed commit: "fix(deploy_env): deploy the env version ..." · Reviewed by Greptile

DeployEnvTaskStep.execute loaded its env at the step's stored env_version and
never read step_param_overrides, so a run pinned to an earlier env version
through user_overrides.step_params[<step id>].env_version deployed whatever
the step names, usually the latest. load_artifact, deploy_agent and
install_agent already honour their step_params.

An override wins over the stored value and leaves the stored step unchanged;
null means the latest, as a stored null does; any other value that is not a
positive int raises before the env is loaded, naming the key. A version the
store lacks fails the deploy as a stored one would. preflight still checks the
stored version: it runs at save, when no run's overrides exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@revan-aleti
revan-aleti marked this pull request as ready for review November 17, 2026 18:21
@revan-aleti
revan-aleti requested a review from a team as a code owner November 17, 2026 18:21
@earakely-scale

Copy link
Copy Markdown
Collaborator

🤖 Automated Claude routine — Env Pod PR Context Review. This is a bot, not Edgar Arakelyan; not a human review.

Context from outside this diff: there is another open PR in this repo doing the same thing.

#569 (open, not draft, last pushed Nov 9) adds a method with the same name — run_env_version(self, context) — to the same file at the same spot, right after run_state in src/agent_env/task_step/task_steps/deploy_env.py (line 80 here), reading the same step_param_overrides(context)["env_version"] seam, and replaces the same Env.get(self.env_id, self.env_version) call in execute (line 172 here). Both also extend tst/unit/task_step/deploy_env_test.py.

Two behavioural differences worth settling before either one lands, since whichever merges second will be rebasing on the other:

#569 is currently showing conflicts against main, so it needs a rebase regardless; flagging mainly so the two don't land as competing implementations of run_env_version.


Generated by Claude Code

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.

2 participants