Skip to content

Gateway delivery layer treats claude-cli CLI runtime id as agent harness, fails closed on Slack [[reply_to:]] path #85582

Closed

Description

@potterdigital

Affected versions

  • 2026.5.19
  • 2026.5.20 (latest installed; unconfirmed whether any newer build fixes this)

Symptom

Every assistant reply delivered into a Slack thread is replaced by the fail-closed warning text:

[[reply_to:<ts>]]
:warning: Requested agent harness "claude-cli" is not registered.

The model itself completes its turn fine. Only the delivery-injected entries (provider: openclaw, model: gateway-injected / delivery-mirror) hit the failed lookup and are substituted with the warning before the Slack post.

Diagnosis

The delivery layer is looking up claude-cli as an agent harness plugin. But in openclaw.json, claude-cli is registered as a CLI runtime backend under cliBackends, and referenced from model definitions as agentRuntime.id: \"claude-cli\". The two concepts share the id claude-cli but live in different registries.

A recent fail-closed change (the same family as #82847, which fixed the followup-queue-drain path) appears to have been added to the delivery / [[reply_to:]] mirror path as well. That makes the misdirected lookup surface as a delivered warning instead of falling through silently or correctly resolving to the runtime backend.

This is distinct from #49747 (channel routing / Slack-session normalization to webchat). That issue concerns where messages go; this one concerns what gets sent — the delivered payload itself is replaced with the warning regardless of channel routing.

It is in the same family as the closed #82847 (followup queue drain on claude-cli/codex-cli/gemini-cli) and the open #84857 (compaction preflight MissingAgentHarnessError(\"claude-cli\")), but on the delivery-mirror / [[reply_to:]] path, which #82847's fix did not cover.

Evidence

Transcript: /root/.openclaw/agents/main/sessions/8a0be87a-1d77-48f2-aea1-1fd3341855ad-topic-1779477099.534479.jsonl

Delivered entry (parentId 1a981939-de81-4542-9656-1e48f405c685):

{
  \"id\": \"f98dc7ec-dfe8-4ee1-b77c-905229cad5d1\",
  \"parentId\": \"1a981939-de81-4542-9656-1e48f405c685\",
  \"timestamp\": \"2026-05-23T01:45:32.999Z\",
  \"message\": {
    \"role\": \"assistant\",
    \"content\": [{
      \"type\": \"text\",
      \"text\": \"[[reply_to:1ca083e6-aa46-47eb-9a8b-6cdbc3bf5609]]\\n:warning: Requested agent harness \\\"claude-cli\\\" is not registered.\"
    }],
    \"api\": \"openai-responses\",
    \"provider\": \"openclaw\",
    \"model\": \"gateway-injected\"
  }
}

Note provider: openclaw and model: gateway-injected — this entry is synthesized by the gateway delivery layer, not the model. Other entries in the same session with provider: claude-cli, model: claude-opus-4-7[1m] (the actual model turns) deliver fine.

Registry side, from ~/.openclaw/openclaw.json:

{
  \"models\": [
    { \"agentRuntime\": { \"id\": \"claude-cli\" } },
    // ...
  ],
  \"cliBackends\": {
    \"claude-cli\": {
      \"reliability\": { \"watchdog\": { /* ... */ } }
    }
  }
}

So claude-cli is a cliBackends entry referenced via agentRuntime.id. Nothing in this config registers claude-cli as a harness plugin — yet the delivery layer attempts that lookup.

Reproduction guess

  1. Slack thread session whose default model has agentRuntime.id: \"claude-cli\" (i.e. routes via local Claude CLI / OAuth instead of Anthropic API).
  2. Any assistant turn that emits [[reply_to:<ts>]] (or any delivery-mirror entry the gateway needs to synthesize).
  3. Expected: payload delivered to Slack.
  4. Actual: payload replaced with :warning: Requested agent harness \"claude-cli\" is not registered. and that warning is what posts to Slack, poisoning the thread.

Workaround

Switch the session's default model to one whose agentRuntime.id is not claude-cli (e.g. a model that routes via the Anthropic API billing path rather than the local CLI OAuth). The delivery-mirror path then resolves the runtime correctly and delivers the actual assistant text.

Distinction from related issues

A consolidated fix should probably normalize the harness-vs-runtime lookup across all gateway paths rather than patching each call site.

Activity

  1. clawsweeper commented on May 23, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Close: current main already routes configured CLI runtime ids away from harness validation on this path; the fix is on main with regression coverage but is not included in v2026.5.20.

    I found the merged PR that appears to have closed this: #85500: Recover stuck Codex compaction.

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Keep the shared CLI-runtime dispatch guard on main, and leave the separate compaction preflight MissingAgentHarnessError path tracked by #84857.

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

    No: I did not reproduce a failing current-main path; current main now skips harness validation for CLI runtime ids and has focused regression coverage for that dispatch boundary.

    Is this the best way to solve the issue?

    Yes: solving this at the shared model-fallback and CLI dispatch boundary is narrower and safer than adding a Slack-specific workaround; the remaining sibling compaction path is already tracked separately.

    Security review:

    Security review: This is an issue cleanup review with no patch security surface to assess.

    What I checked:

    Likely related people:

    • steipete: git blame and current-main history identify this person as author of the commit that added the CLI-runtime guard and related regression coverage in the central model fallback path. (role: recent area contributor; confidence: medium; commits: 44d5330993ce; files: src/agents/model-fallback.ts, src/agents/model-fallback.test.ts, src/auto-reply/reply/followup-runner.ts)

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 304ff68c7975; fix evidence: merged PR #85500, commit 44d5330993ce, main fix timestamp 2026-05-22T22:30:06+01:00.

  2. added
    P1
    impact:message-loss
    impact:auth-provider
    on May 23, 2026
  3. potterdigital commented on May 23, 2026

    @potterdigital
    ContributorAuthor

    @clawsweeper Re-opening request — the close attribution doesn't hold up under file-level check.

    Issue with the cited fix. PR #85500 ("Recover stuck Codex compaction") is the cited merged fix, but its files list on the GitHub API only touches extensions/codex/src/app-server/compact.ts, compact.test.ts, and CHANGELOG.md (3 files, +178/-27). It does not modify src/agents/harness/selection.ts, src/auto-reply/reply/agent-runner-execution.ts, src/auto-reply/reply/followup-runner.ts, src/config/sessions/transcript.ts, or src/agents/model-fallback.ts — the files the review pointed to as fix locations.

    Selection guard isn't present on main either. I diffed src/agents/harness/selection.ts between tag v2026.5.20 and main at 304ff68c7975 — the files are byte-identical. The throw new MissingAgentHarnessError(runtime) on the explicit-non-`auto` branch is still live on `main`, with no preceding guard for CLI runtime aliases. The existing `isCliAgentRuntime`-based short-circuit lives in `src/agents/model-fallback.ts` (`assertModelFallbackCandidateHarnessAvailable`), but that's the model-fallback pre-flight, not the harness selector that `agent-runner-execution.ts` and the auto-reply paths call.

    Production frequency. On a v2026.5.20 install with one agent's default model set to `agentRuntime.id: "claude-cli"`, the error fires every 1–5 minutes against both `lane=session:agent::slack:...` and `lane=session:agent::dashboard:...` lanes (logged at `subsystem-BIvbRvCg.js:179`). The Slack `[[reply_to:]]` poisoning is one downstream effect; the dashboard lane swallows it without visible substitution. Pre-existing context in the original issue body still applies (the delivered payload has `provider: openclaw, model: gateway-injected`, so it's gateway-synthesized, not model-emitted).

    Proposed fix. Mirror the existing `runtime === "codex" && policy.runtimeSource === "implicit" → return piHarness` escape hatch in `selectAgentHarnessDecision()`, but using the canonical CLI helpers (`isCliRuntimeAlias` from `src/agents/model-runtime-aliases.ts` plus `isCliProvider` from `src/agents/model-selection-cli.ts`) so the canonical alias set (`claude-cli`, `google-gemini-cli`) and configured `cliBackends` ids are both covered. A new `selectedReason: "cli_runtime_passthrough_pi"` distinguishes the case from the implicit-codex fallback. Verified locally by patching the bundled `dist/selection-BmjEdnnA.js` on a v2026.5.20 install — the lane-task error has not re-fired in the 30+ minutes since restart. (Caveat: I've only confirmed the throw stops; I have not separately confirmed the Slack `[[reply_to:]]` delivery path now posts the actual model reply text rather than the warning. Will follow up if the next Slack interaction confirms.)

    PR incoming.

  4. locked as resolved and limited conversation to collaborators on May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1impact:auth-providerimpact:message-loss

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions