openclaw - 💡(How to fix) Fix ACP: OpenCode adapter rejects session/set_config_option timeout, causing ACP child sessions to fail immediately

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Agent rejected session/set_config_option for "timeout"="15": Invalid params (ACP -32602).
The adapter may not implement session/set_config_option, or the requested value is not supported.

Root Cause

In src/acp/control-plane/manager.runtime-controls.ts, buildRuntimeConfigOptionPairs() unconditionally converts timeoutSeconds into a set_config_option pair:

if (typeof normalized.timeoutSeconds === "number") pairs.set("timeout", String(normalized.timeoutSeconds));

The OpenCode adapter reports session/set_config_option as a supported control but does not accept "timeout" as a valid config key. The existing guard:

if (advertisedKeys.size > 0 && !advertisedKeys.has(key)) throw new AcpRuntimeError(...)

only skips the check when advertisedKeys is empty. If the adapter reports some config keys but not "timeout", the guard may still let it through (or the adapter reports an empty configOptionKeys list, bypassing the guard entirely), and the setConfigOption call fails at the adapter level with -32602.

Fix Action

Workaround

I patched manager.runtime-controls.ts locally with two defensive measures:

  1. Pre-check: If advertisedKeys is non-empty and does not contain "timeout", skip sending it (instead of throwing).
  2. Catch fallback: Wrap setConfigOption in try/catch; if the call fails for key==="timeout", swallow the error and continue.
// Before:
if (advertisedKeys.size > 0 && !advertisedKeys.has(key))
  throw new AcpRuntimeError("ACP_BACKEND_UNSUPPORTED_CONTROL", ...);
await params.runtime.setConfigOption({ handle, key, value });

// After:
if (advertisedKeys.size > 0 && !advertisedKeys.has(key)) {
  if (key === "timeout") continue;
  throw new AcpRuntimeError("ACP_BACKEND_UNSUPPORTED_CONTROL", ...);
}
try {
  await params.runtime.setConfigOption({ handle, key, value });
} catch (e) {
  if (key === "timeout") continue;
  throw e;
}

After this patch, OpenCode ACP child sessions work correctly.

Code Example

Agent rejected session/set_config_option for "timeout"="15": Invalid params (ACP -32602).
The adapter may not implement session/set_config_option, or the requested value is not supported.

---

if (typeof normalized.timeoutSeconds === "number") pairs.set("timeout", String(normalized.timeoutSeconds));

---

if (advertisedKeys.size > 0 && !advertisedKeys.has(key)) throw new AcpRuntimeError(...)

---

// Before:
if (advertisedKeys.size > 0 && !advertisedKeys.has(key))
  throw new AcpRuntimeError("ACP_BACKEND_UNSUPPORTED_CONTROL", ...);
await params.runtime.setConfigOption({ handle, key, value });

// After:
if (advertisedKeys.size > 0 && !advertisedKeys.has(key)) {
  if (key === "timeout") continue;
  throw new AcpRuntimeError("ACP_BACKEND_UNSUPPORTED_CONTROL", ...);
}
try {
  await params.runtime.setConfigOption({ handle, key, value });
} catch (e) {
  if (key === "timeout") continue;
  throw e;
}
RAW_BUFFERClick to expand / collapse

Bug Description

When spawning an ACP child session with agentId="opencode", the session fails immediately before any conversation can happen. The root cause is that OpenClaw sends session/set_config_option with key="timeout" to the OpenCode adapter, which rejects it with ACP -32602 Invalid params.

Error

Agent rejected session/set_config_option for "timeout"="15": Invalid params (ACP -32602).
The adapter may not implement session/set_config_option, or the requested value is not supported.

Root Cause

In src/acp/control-plane/manager.runtime-controls.ts, buildRuntimeConfigOptionPairs() unconditionally converts timeoutSeconds into a set_config_option pair:

if (typeof normalized.timeoutSeconds === "number") pairs.set("timeout", String(normalized.timeoutSeconds));

The OpenCode adapter reports session/set_config_option as a supported control but does not accept "timeout" as a valid config key. The existing guard:

if (advertisedKeys.size > 0 && !advertisedKeys.has(key)) throw new AcpRuntimeError(...)

only skips the check when advertisedKeys is empty. If the adapter reports some config keys but not "timeout", the guard may still let it through (or the adapter reports an empty configOptionKeys list, bypassing the guard entirely), and the setConfigOption call fails at the adapter level with -32602.

Workaround

I patched manager.runtime-controls.ts locally with two defensive measures:

  1. Pre-check: If advertisedKeys is non-empty and does not contain "timeout", skip sending it (instead of throwing).
  2. Catch fallback: Wrap setConfigOption in try/catch; if the call fails for key==="timeout", swallow the error and continue.
// Before:
if (advertisedKeys.size > 0 && !advertisedKeys.has(key))
  throw new AcpRuntimeError("ACP_BACKEND_UNSUPPORTED_CONTROL", ...);
await params.runtime.setConfigOption({ handle, key, value });

// After:
if (advertisedKeys.size > 0 && !advertisedKeys.has(key)) {
  if (key === "timeout") continue;
  throw new AcpRuntimeError("ACP_BACKEND_UNSUPPORTED_CONTROL", ...);
}
try {
  await params.runtime.setConfigOption({ handle, key, value });
} catch (e) {
  if (key === "timeout") continue;
  throw e;
}

After this patch, OpenCode ACP child sessions work correctly.

Suggested Fix

Either:

  1. OpenClaw side: When an adapter rejects a set_config_option call for a non-essential key like "timeout", catch the error and continue instead of failing the entire session. The timeout can still be enforced by OpenClaw's own turn-level timeout mechanism (ACP_TURN_TIMEOUT_REASON).

  2. OpenCode adapter side: Accept/ignore unknown config keys instead of returning -32602.

Option 1 is preferable since it makes OpenClaw more resilient to adapter differences.

Environment

  • OpenClaw: 2026.5.7
  • OpenCode: @opencode-ai/plugin 1.14.18
  • ACP backend: acpx
  • Node: v22.22.0
  • OS: Linux 6.1.0-21-arm64 (arm64)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix ACP: OpenCode adapter rejects session/set_config_option timeout, causing ACP child sessions to fail immediately