fix(agent-runtime): stop DockerDeployer env from overriding governance settings #4409
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.74) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.74 · 638 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.386
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.074
Real PR Conversation Timeline
1 comments
"Review active on #4409"
general
weight: 0.35
prayagupa
Related Issue
None. This is a bug I found in
agent_runtime.deploy.DockerDeployer; the sections below are filled in as the template asks.Problem & Solution
Problem.
DockerDeployer.deployturnsGovernanceConfigintoAGT_*variables and then appends the caller'senventries after them:docker runkeeps the last-efor a name, so anenventry with a governance name replaces the configured value:The same applies to
AGT_POLICY_PATH,AGT_TRUST_LEVEL,AGT_AUDIT_ENABLED,AGT_MAX_TOOL_CALLS,AGT_RATE_LIMIT_RPMandAGT_RETENTION_DAYS. TheDeploymentResultsays nothing about it, so the container quietly runs with different governance settings from theGovernanceConfigit was deployed with. A name containing=does the same thing: Docker splits-e AGT_KILL_SWITCH=false=at the first=.Solution.
deploybuilds the governance variables as a dict and, before running Docker, raisesValueErrorifenvnames one of them or has an=in a name. The message points atGovernanceConfigas the place to set the value. Other variables, including otherAGT_names such asAGT_LOG_LEVEL, are passed exactly as before, and thedocker runarguments for a valid call are unchanged.Impact on Your Work
GovernanceConfigis what callers rely on to set the kill switch, audit flag, policy and limits of a deployed agent. With the bug, anenvmapping assembled elsewhere (app settings, a copied.env) can turn those off with no sign in the result.Timeline
None.
Alternatives Considered
envfirst so the governance values win. That keeps the configured values but silently drops what the caller asked for; raising tells them to set it onGovernanceConfiginstead.AGT_name. Too broad: only the seven variablesdeploysets fromGovernanceConfigcan collide, and otherAGT_variables may be legitimate agent settings.FAILEDDeploymentResult. Invalid arguments already raiseValueError(_validate_agent_id) before Docker runs, so this follows the same pattern.KubernetesDeployer.deploytakes noenvargument, so it is not affected.Type of Change
Package(s) Affected
Testing
Unit Testing
In
agent-runtime/tests/test_deploy.py:test_deploy_rejects_env_overriding_governance_config(parametrized over the seven governance variables):deployraisesValueErrornaming the variable and never calls Docker.test_deploy_rejects_env_name_with_equals:env={"AGT_KILL_SWITCH=false": ""}raisesValueError.test_deploy_keeps_other_agt_env:AGT_LOG_LEVELis still passed andAGT_KILL_SWITCH=truecomes from the config.The first eight cases fail on main.
Manual Testing
agent-runtime/tests: 127 passed.ruff check --select E,F,W --ignore E501(as in CI): clean on the changed files.cspellwith.cspell.jsonon the changed files; no issues on added lines.Checklist
Attribution & Prior Art
None.
AI Assistance
I used Claude Code (Claude Opus) to help find the bug and draft the fix and tests. I reviewed the full diff and will handle review comments myself.
IP, Patents, and Licensing
🤖 Generated with Claude Code