Skip to content

fix(acp): honor agent thinkingDefault for ACP bindings instead of forcing adaptive - #129260

Closed
ayeshafayyaz-pixel wants to merge 1 commit into
openclaw:mainfrom
ayeshafayyaz-pixel:fix/acp-binding-thinking-default
Closed

ayeshafayyaz-pixel wants to merge 1 commit into
openclaw:mainfrom
ayeshafayyaz-pixel:fix/acp-binding-thinking-default

Conversation

@ayeshafayyaz-pixel

Copy link
Copy Markdown
Contributor

What Problem This Solves

Closes #128145.

ACP bindings resolve the owner agent's model but never resolve the owner agent's thinking policy, so runtimeOptions.thinking is never populated. The agent then falls back to the runtime's adaptive thinking level, which breaks ACP runs on models that don't support adaptive thinking:

AcpRuntimeError: Could not apply ACP runtime mode 'auto':
thinkingLevel 'adaptive' is not supported for ollama-cloud/glm-5.2:cloud (use off)

An agent configured with thinkingDefault: 'off' is ignored on the ACP path even though the gateway session path already honors it.

Why This Change Was Made

The fix resolves the owner agent's thinking policy alongside its model at bind time and threads it through the existing binding spec → record → runtimeOptions.thinking, reusing OpenClaw's existing config-option delivery channel. It mirrors the gateway's own resolution (resolveGatewaySessionThinkingDefault): an explicit per-agent thinkingDefault wins, otherwise the model-family default (resolveThinkingDefault) applies — which still yields adaptive for models that support it, preserving current behavior.

No new plugin/ACPX setting is added, and the acpx adapter is untouched: [email protected]'s SessionAgentOptions has no thinking field, so thinking correctly flows via the already-wired session/set_config_option path (buildRuntimeConfigOptionPairs → applyManagerRuntimeControls), not via session options.

User Impact

ACP agents now honor their configured thinkingDefault (e.g. off), so ACP runs on models without adaptive-thinking support (Ollama Cloud, etc.) no longer error out. Models that support adaptive are unaffected.

Files changed

  • src/channels/plugins/acp-configured-binding-consumer.ts — resolve owner thinking policy at bind time and pass it into the spec.
  • src/acp/persistent-bindings.types.ts — carry thinking on the binding spec and round-trip it through the persisted record.
  • src/acp/persistent-bindings.lifecycle.ts — include thinking in the ACP session runtimeOptions.
  • src/channels/plugins/acp-bindings.test.ts — regression coverage.

Evidence

  • New regression tests in acp-bindings.test.ts:
    • owner thinkingDefault: 'off' reaches the ACP binding record (metadata.thinking === 'off');
    • no thinking policy + no explicit model preserves prior behavior (no forced level).
  • vitest run src/channels/plugins/acp-bindings.test.ts → 9/9 pass.
  • Related suites green: src/acp/persistent-bindings.test.ts + src/channels/** → 1068/1068 pass.
  • oxfmt clean; git diff --check clean.

This change was prepared with AI assistance (Claude Code).

…cing adaptive

ACP bindings resolved the owner agent's model but not its thinking policy, so
runtimeOptions.thinking was never set and the agent fell back to the runtime's
adaptive level. That broke ACP runs on models without adaptive support (e.g.
ollama-cloud). Resolve the owner agent's thinking policy at bind time and thread
it through the binding spec/record into runtimeOptions.thinking, mirroring the
gateway's resolution (explicit thinkingDefault wins, else the model-family
default, which still yields adaptive for models that support it). Thinking flows
via the existing config-option channel; no acpx adapter change and no new setting.
@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 25, 2026, 7:57 AM ET / 11:57 UTC.

ClawSweeper review

What this changes

The PR carries an agent’s resolved thinking policy through configured ACP binding records into ACP session runtime options.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 8 items remain

Keep open: ready ACP bindings return after reconciling only model, so they retain the old adaptive thinking setting. The earlier P1 finding remains unresolved, and the PR has mock-only proof.

Priority: P1
Reviewed head: 4dcfe2c8d63d03eacd8f83b4f0bc89257180f629

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has a focused repair direction, but a P1 ready-session gap and missing real runtime proof keep it below merge readiness.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: Only mocked tests are claimed; add a redacted after-fix ACP runtime trace for a pre-existing binding, without credentials, private endpoints, or personal data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Only mocked tests are claimed; add a redacted after-fix ACP runtime trace for a pre-existing binding, without credentials, private endpoints, or personal data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current-main lifecycle behavior: Current main returns from the ready-session branch after optionally updating only model; no thinking option is reconciled there.
PR-head gap: The branch adds thinking only to session initialization, while the earlier ready-session return path remains model-only.
Runtime configuration contract: The ACP manager serializes a persisted thinking option into session configuration controls before turns.
Findings 1 actionable finding [P1] Update thinking for already-ready ACP bindings
Security None None.

Live Verification

Command: pnpm openclaw acp --help

Result: PASS (completed)

pnpm openclaw acp --helprunner@runnervm76f27:/tmp/clawsweeper-live-proof-129260-6P05lN/target$ pnpm openclaw acp --help
$ node scripts/run-node.mjs acp --help
pnpm openclaw acp --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 98.75 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 13.1s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4114ms (slowest: built plugin control-plane loads 3403ms)
│
◇

OpenClaw 2026.8.1 (4dcfe2c) — All your chats, one OpenClaw.

Usage: openclaw acp [options] [command]

Run an ACP bridge backed by the Gateway

Options:
  -h, --help               Display help for command
  --no-prefix-cwd          Do not prefix prompts with the working directory
  --password ‹password›    Gateway password (if required)
  --password-file ‹path›   Read gateway password from file
  --provenance ‹mode›      ACP provenance mode: off, meta, or meta+recei
… output truncated …

Assertions:

  • PASS expect_output: Usage: openclaw acp [options] [command]

How this fits together

Configured channel bindings map a conversation to an agent-owned ACP session. The persistent binding record supplies runtime options, which OpenClaw sends to the ACP runtime before a turn.

flowchart LR
A[Channel conversation] --> B[Configured ACP binding]
B --> C[Agent policy resolution]
C --> D[Persistent binding record]
D --> E[ACP session lifecycle]
E --> F[Runtime configuration]
F --> G[ACP runtime]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Only mocked tests are claimed; add a redacted after-fix ACP runtime trace for a pre-existing binding, without credentials, private endpoints, or personal data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Update thinking for already-ready ACP bindings (P1) - The new thinking option is passed only when initializing a session. A configured binding that is already ready takes the earlier return path, which updates only model, so an existing session remains on its old adaptive setting and the reported failure persists. Extend that in-place update and add the corresponding lifecycle regression.
  • Resolve merge risk (P1) - Existing ready bindings will continue using their prior adaptive setting until the lifecycle update includes thinking.
  • Resolve merge risk (P1) - The PR supplies only mocked tests; no redacted ACP runtime trace demonstrates that an affected configured binding receives thinking=off.
  • Resolve merge risk (P1) - Production changes are +32/-1 (net +31); the necessary ready-session reconcile should be absorbed into the existing model-drift update path rather than added as another lifecycle flow.
  • Complete next step (P2) - A narrow lifecycle repair and regression test can address the P1 finding; real contributor-side ACP proof remains required before merge.
  • Improve patch quality - Update the ready-session runtime-options path and add a regression that fails before the repair.
  • Improve patch quality - Add a redacted after-fix ACP trace showing an existing configured binding receives thinking=off; update the PR body afterward.

Findings

  • [P1] Update thinking for already-ready ACP bindings — src/acp/persistent-bindings.lifecycle.ts:109-115
Agent review details

Security

None.

PR surface

Source +31, Tests +33. Total +64 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 32 1 +31
Tests 1 33 0 +33
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 65 1 +64

Review metrics

Metric Value Why it matters
Production versus test delta production +32/-1 (net +31); tests +33/-0 The added persisted runtime-option plumbing is purposeful, but the current lifecycle coverage misses the ready-session behavior it must preserve.

Stored data model

Persistent data-model change detected: vector/embedding metadata: src/acp/persistent-bindings.types.ts, vector/embedding metadata: src/channels/plugins/acp-bindings.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #128145
Summary: This PR explicitly attempts to repair the linked ACP thinking-default failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete ready-session reconciliation (recommended)
    Update the existing live runtime-option path to apply the resolved thinking policy and prove both fresh and already-ready bindings before merge.

Technical review

Best possible solution:

Extend the existing ready-session runtime-option update to reconcile thinking, add a lifecycle regression for a pre-existing session, and then show a redacted ACP trace for the affected configuration path.

Do we have a high-confidence way to reproduce the issue?

Yes—source-reproducible: a structurally matching ready session updates only model and returns, so the newly initialized-only thinking value never reaches an existing binding.

Is this the best way to solve the issue?

No. The existing runtime configuration channel is the right boundary, but the patch must reconcile thinking through the ready-session path as it already does for model.

Full review comments:

  • [P1] Update thinking for already-ready ACP bindings — src/acp/persistent-bindings.lifecycle.ts:109-115
    The new thinking option is passed only when initializing a session. A configured binding that is already ready takes the earlier return path, which updates only model, so an existing session remains on its old adaptive setting and the reported failure persists. Extend that in-place update and add the corresponding lifecycle regression.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2e54fe711630.

Labels

Label justifications:

  • P1: Affected configured ACP agents can still fail on their next turn because an existing session retains adaptive thinking.
  • merge-risk: 🚨 auth-provider: The PR changes how persisted agent model-thinking policy is forwarded to ACP runtime sessions.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only mocked tests are claimed; add a redacted after-fix ACP runtime trace for a pre-existing binding, without credentials, private endpoints, or personal data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/acp/persistent-bindings.lifecycle.test.ts.
  • [P1] node scripts/run-vitest.mjs src/channels/plugins/acp-bindings.test.ts.

What I checked:

Likely related people:

  • steipete: History attributes the ready-session reconciliation branch to Peter Steinberger, who also authored the related configured-agent model propagation fix. (role: recent ACP lifecycle and configured-model contributor; confidence: high; commits: 2907a16a639b, d0fe7bcb3caf; files: src/acp/persistent-bindings.lifecycle.ts, src/channels/plugins/acp-configured-binding-consumer.ts)
  • osolmaz: ACP history includes the ACPX runtime integration work, and the adapter owns forwarding the runtime configuration control. (role: adjacent ACPX runtime contributor; confidence: medium; commits: 154a7edb7cad; files: extensions/acpx/src/runtime.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-25T11:14:08.087Z sha 4dcfe2c :: needs real behavior proof before merge. :: [P1] Reconcile thinking for already-ready ACP bindings

@steipete

Copy link
Copy Markdown
Contributor

Consolidated and landed in #128169, commit 8d8736d. Thank you @ayeshafayyaz-pixel; your contribution is preserved in the co-author trailers and PR acknowledgments alongside @chelsealong.

The canonical repair carries configured thinking through the binding record and also handles already-ready sessions, explicit agent/per-model/global precedence, omission retention, and ACP spawn defaults. Supported live controls are applied before persistence; Codex's unsupported live off returns a visible error without losing conversation state.

Paired native Codex proof and the final Ollama three-turn off → high → omitted trace verified actual settings, stable identities, and recalled history. All 255 ACPX tests and exact-head CI passed. Closing this PR as superseded by the verified landed consolidation; the source branch is left intact.

@steipete steipete closed this Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

acpx: thinkingLevel 'adaptive' default breaks ACP runs with ollama-cloud models

2 participants