Skip to content

[Bug]: subagents.agentRuntime not inherited from agents.defaults — subagents bypass claude-cli runtime, hit Extra Usage bucket instead of Claude Max/Pro subscription, triggers 24h auth lockout #81395

@Redoudou

Description

@Redoudou

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When agentRuntime: claude-cli is set at agents.defaults, subagents silently ignore it, fall back to direct HTTP, and drain your Extra Usage quota instead of your Claude Max/Pro subscription — one failed call locks out the entire Anthropic provider for 24 hours.

Steps to reproduce

  1. Set agents.defaults.agentRuntime.id = "claude-cli" in openclaw.json
  2. Leave agents.defaults.subagents.agentRuntime unset
  3. Trigger any session that spawns a subagent (cron job with kind: agentTurn, or any task calling sessions_spawn)
  4. Observe the subagent fires via subsystem: agent/embedded instead of /usr/bin/claude
  5. If Extra Usage is disabled or exhausted, the embedded call returns 400 and OpenClaw writes disabledUntil ~24h forward to auth-state.json
  6. All subsequent requests — including normal interactive chat — return "Provider anthropic has billing issue (skipping all models)"

Expected behavior

Subagents inherit agentRuntime: claude-cli from agents.defaults and route through the /usr/bin/claude binary, which carries the correct Claude Code headers that bill against the Max/Pro subscription.

Actual behavior

Subagents use the embedded HTTP runner regardless of agents.defaults.agentRuntime. The embedded runner calls the Anthropic API directly without CLI headers, routing to the Extra Usage bucket. One billing error sets disabledUntil in auth-state.json, which survives gateway restarts. All provider models are then skipped with "Provider anthropic has billing issue (skipping all models)" until the cooldown expires or the file is manually cleared.

OpenClaw version

2026.2.21-2

Operating system

Ubuntu 24.04 LTS (Linux 6.8.0-100-generic x86_64)

Install method

npm install -g openclaw

Model

anthropic/claude-sonnet-4-6

Provider / routing chain

  • Intended: anthropic:claude-cli OAuth → /usr/bin/claude binary - Actual (subagents): embedded HTTP runner → api.anthropic.com directly (no CLI headers)

Additional provider/model setup details

Single auth profile anthropic:claude-cli (OAuth). No anthropic:manual profile.
agents.defaults.agentRuntime.id = "claude-cli" is set.
agents.defaults.subagents.agentRuntime is absent.

The diagnostic tool flags this post-hoc under automated diagnosis but emits no warning at gateway startup. The lockout state is stored under usageStats["anthropic:claude-cli"] in:

Logs, screenshots, and evidence

and persists across restarts.

## Logs and Evidence

Diagnostic report (tokens redacted by diagnostic script). Key evidence:

- **Section 2**`disabledUntil` set, `disabledReason: billing`
- **Section 6** — first error at `00:07:04 UTC` from `subsystem: agent/embedded`:

Impact and severity

Impact and Severity

Affected users Any Claude Max/Pro user running claude-cli OAuth with subagents — standard self-hosted setup
Severity Blocks entire agent workflow — not just subagents, all interactive chat stops
Frequency Reproducible every time a subagent is spawned with Extra Usage disabled or exhausted; also triggered on gateway restart when a missed cron fires catch-up
Consequence Up to 24h outage requiring manual intervention; no warning before or during failure; subscription usage console shows nothing wrong because the subscription is never actually reached

Workaround

Manually clear usageStats fields in auth-state.json and restart:

python3 -c "
import json
path = '/home/<user>/.openclaw/agents/main/agent/auth-state.json'
with open(path) as f: d = json.load(f)
for p in d.get('usageStats', {}):
    for k in ['disabledUntil','failureCounts','errorCount','disabledReason','lastFailureAt']:
        d['usageStats'][p].pop(k, None)
with open(path, 'w') as f: json.dump(d, f, indent=2)
print('Cleared.')
"
openclaw gateway restart

Permanent fix: explicitly set agents.defaults.subagents.agentRuntime.id = "claude-cli" in openclaw.json.

Additional Information

The diagnostic tool detects the misconfiguration but only when run manually. A gateway startup warning — analogous to the existing allowInsecureAuth=true warning — would catch this before it causes an outage.

Additional information

Suggested Fix

Two changes, one behavioral and one UX:

1. Default inheritance (the real fix)

When agents.defaults.agentRuntime.id is set, subagents.agentRuntime should
automatically inherit it unless explicitly overridden. Same logic as any sane
config cascade — child inherits parent unless told otherwise.

2. Startup warning (the safety net)

When agentRuntime.id = "claude-cli" is detected at agents.defaults but
subagents.agentRuntime is unset, emit a startup warning — same pattern already
used for allowInsecureAuth=true. Catches misconfiguration before it causes a
24h outage.

Note: We are not asking to remove the embedded HTTP runner — it is a
legitimate option for isolation use cases. The problem is the silent fallback,
not the existence of the path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions