Skip to content

fix(acp): pass configured agent model to ACP binding sessions - #120046

Merged
steipete merged 1 commit into
mainfrom
codex/fix-119551-acp-model
Aug 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-119551-acp-model

Conversation

@steipete

@steipete steipete commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

An ACP agent with an explicit model configured in openclaw.json (model.primary) never receives that model: the configured-binding producer omitted it, so ensureConfiguredAcpBindingSession() initialized the ACP session without runtimeOptions.model. The child process then inherits the gateway's ANTHROPIC_MODEL env var, which the ACP adapter reads with highest priority — silently overriding the agent's own configuration.

Fixes #119551 (reported by @Enominera).

Why This Change Was Made

The fix follows the existing correct precedent in src/agents/acp-spawn-runtime.ts and the repo's prepare-facts-once doctrine: the owner's explicit model is resolved once at the binding producer (resolveAgentExplicitModelPrimary in acp-configured-binding-consumer.ts), persisted through the binding record, and passed as runtimeOptions.model at initializeSession(). Existing bound sessions with drifted models are patched in place via updateSessionRuntimeOptions — conversation state is preserved, and manual ACP model choices remain untouched when no explicit owner model is configured. No environment-passthrough, ACPX, protocol, or config-surface changes.

User Impact

Configured ACP agent models are now authoritative. Operators no longer get a different model than the one they configured just because the gateway's environment carries ANTHROPIC_MODEL.

Evidence

  • Root cause verified on origin/main source (not just the reporter's dist trace); restart, resume, failover, oneshot, and backend-neutral paths checked — they already replay persisted runtime options correctly.
  • node scripts/run-vitest.mjs src/acp/persistent-bindings.lifecycle.test.ts src/acp/persistent-bindings.test.ts src/acp/control-plane/manager.initialize-session.test.ts src/acp/control-plane/manager.runtime-config-validation.test.ts — all pass.
  • Codex autoreview (gpt-5.6-sol, high): clean, "patch is correct (0.99)".
  • Production +23/−2 across three files; tests +53/−9.

@steipete
steipete marked this pull request as ready for review August 6, 2026 20:27
@steipete steipete closed this Aug 6, 2026
@steipete steipete reopened this Aug 6, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Aug 6, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 6, 2026
@openclaw-barnacle openclaw-barnacle Bot closed this Aug 6, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Aug 6, 2026
@steipete
steipete merged commit d0fe7bc into main Aug 6, 2026
4 checks passed
@steipete
steipete deleted the codex/fix-119551-acp-model branch August 6, 2026 22:57
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 6, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP agent configured model not passed to runtime — falls back to ANTHROPIC_MODEL env var

1 participant