Skip to content

fix(agent): run.sh should not inject a hardcoded ANTHROPIC_MODEL fallback #743

Description

@scottschreckengaust

Child 2 of 6 — parent #740. No deploy. Local dev-loop only.

Self-contained and independently mergeable. Prerequisite for child 4 (default flip) to actually take effect locally.

Problem

agent/run.sh:208 always passes the variable into the container with its own fallback:

-e "ANTHROPIC_MODEL=${ANTHROPIC_MODEL:-us.anthropic.claude-sonnet-4-6}"

Because the variable is always set in the container env, os.environ.get("ANTHROPIC_MODEL", ...) at agent/src/config.py:563 never reaches its fallback. So run.sh silently overrides the platform default rather than deferring to it: local Docker runs are on Sonnet 4.6 while deployed runs are on Opus 4.8. Any future default bump would leave local runs behind.

The ${VAR:-default} idiom is right for genuinely optional shell inputs, but wrong here — config.py already owns the default, and this shadows it.

Fix

Pass the variable through only when the caller actually set it, matching how the surrounding optional vars are already handled at agent/run.sh:215-216:

[[ -n "${ANTHROPIC_MODEL}" ]] && DOCKER_ARGS+=(-e "ANTHROPIC_MODEL=${ANTHROPIC_MODEL}")

Also update the usage text at agent/run.sh:33, which advertises the same stale Sonnet-4.6 default. Prefer describing it as "defaults to the agent runtime default" over restating a literal — restating is what let it drift.

Verification

# unset -> agent's own default (currently us.anthropic.claude-opus-4-8)
./agent/run.sh --dry-run "owner/repo" 1
# set -> caller's value wins
ANTHROPIC_MODEL=us.anthropic.claude-opus-5 ./agent/run.sh --dry-run "owner/repo" 1

DRY_RUN=1 prints the resolved config without invoking the agent, so this is verifiable without Bedrock spend.

Acceptance criteria

  • run.sh passes ANTHROPIC_MODEL only when non-empty; no hardcoded model literal remains in the script
  • Usage text at line 33 no longer states a stale literal
  • Dry-run confirms: unset → config.py default; set → caller's value
  • grep -n 'claude-sonnet-4-6' agent/run.sh returns nothing
  • mise run build green

Notes

Local-only script change; no CDK, no deployed surface, no IAM. Sibling of #742.

Metadata

Metadata

Labels

P2lowest priorityagent-runtimePython agent container: pipeline, runner, hooks, prompts, tools, DockerfileapprovedWhen an issue has been approved and readybugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions