Skip to content

[Bug]: Terminal provider model_not_available in subagent announce path can trigger chat.history storm and gateway event-loop starvation #91839

Closed as not planned

Description

@aspalagin

Summary

A single bad model config entry can take down the whole gateway control plane instead of failing as an isolated terminal model error.

In our case, adding a new model alias/reference for v3d/fable was accepted by config hot reload. The provider later rejected the model with a terminal 4xx-style error (Model not available: fable). After that, the subagent completion/announce path started retrying and self-polling chat.history, driving the Node gateway event loop into starvation. Systemd still considered the gateway process running, but OpenClaw became unresponsive/degraded.

Environment

  • OpenClaw package version: 2026.6.5
  • Install shape: global npm package under systemd
  • Service: openclaw-gateway.service
  • Gateway process: Node.js, single service process
  • Platform: Linux/systemd

Reproduction Shape

  1. Add a model entry to a provider config for a model name that the upstream provider/API key does not actually allow, e.g. v3d/fable.
  2. Expose that same model through agent/default model configuration.
  3. Let gateway hot-reload the config.
  4. Trigger a subagent/model smoke request using that model.

Expected Behavior

One of these should happen:

  • The config/model update is rejected before it becomes active because the model cannot be resolved or smoke-tested.
  • The subagent run fails once with a terminal provider/model error.
  • The parent session receives a bounded failure result.
  • The gateway remains responsive and openclaw health continues to work.

Actual Behavior

The provider returned a terminal model error:

LLM request failed: provider rejected the request schema or tool payload
rawError={"error":{"type":"invalid_request_error","message":"Model not available: fable"}}

After that, logs showed the subagent completion announce path failing/retrying, for example:

Subagent completion direct announce failed ... completion agent did not produce a visible reply
Subagent announce give up (retry-limit) ... retries=3

During the retry window the gateway repeatedly issued chat.history control-plane calls and the event loop degraded badly:

  • gateway Node main thread around 100% CPU
  • event loop utilization effectively saturated
  • openclaw health / gateway RPCs hung or reported degraded
  • systemd still showed openclaw-gateway.service as active/running

Removing the bad v3d/fable references from config and restarting openclaw-gateway.service cleared the issue. After restart, openclaw health returned normal event-loop metrics again.

Why This Seems Like a Runtime Bug

The initial bad edit was a user/config error, but the blast radius looks too large. A terminal model_not_available / invalid_request_error from a provider should not enter an announce/retry path that can saturate the gateway event loop or make unrelated gateway RPCs unresponsive.

A likely fix would be some combination of:

  • classify provider model_not_available / terminal 4xx errors as non-retryable for subagent completion announce;
  • cap or circuit-break chat.history self-poll/retry behavior;
  • guarantee the parent session is woken with a bounded failure when subagent announce delivery fails;
  • validate/smoke-test newly-added model refs before hot-reload makes them selectable by agents;
  • make watchdog/health recovery aware of event-loop starvation, not just process liveness.

Related Issues

This looks related but not identical to existing issues:

Activity

  1. clawsweeper commented on Jun 10, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 11:07 PM ET / 03:07 UTC.

    Summary
    Keep open. Current main still does not clearly handle the reported provider wording as a terminal model-not-found path, and the subagent announce cleanup path still contains requester chat.history probing plus retry/give-up behavior; related reports cover adjacent pieces but no merged fix owns this full failure shape.

    Reproducibility: no. high-confidence live reproduction was run in this read-only review. Source inspection does show that the exact reported provider wording is not handled by the current model-not-found patterns and that announce cleanup can still call chat.history during the retry/give-up path.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    Next step
    Manual review is the right lane because the item is already marked for no new fix PR plus product/live-repro review, and the safe fix crosses provider semantics, subagent delivery, config validation, and gateway availability behavior.

    Review details

    Best possible solution:

    Land a maintainer-approved bounded failure path that classifies terminal model-unavailable provider errors correctly, prevents announce cleanup from amplifying control-plane polling, wakes or blocks the parent completion deterministically, and tracks config hot-reload validation separately if needed.

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

    No high-confidence live reproduction was run in this read-only review. Source inspection does show that the exact reported provider wording is not handled by the current model-not-found patterns and that announce cleanup can still call chat.history during the retry/give-up path.

    Is this the best way to solve the issue?

    Unclear as a single automatic fix. The narrowest maintainable direction likely combines provider error classification with bounded announce delivery semantics, while config hot-reload rejection and watchdog recovery need maintainer product choices.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The exact event-loop starvation blast radius was not live-reproduced in this read-only review, so maintainer/live proof is still needed before choosing the final recovery design.
    • A partial fix in only provider classification, announce retry, config validation, or watchdog recovery could leave another part of the reported failure path unsafe.

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

    Label changes

    Label changes:

    • remove clawsweeper:fix-shape-clear: Current issue advisory state no longer selects this label.

    Label justifications:

    • P1: The report describes a real gateway/session workflow becoming unresponsive after a provider model error, which is an urgent runtime stability issue.
    • impact:session-state: The failure is centered on subagent completion announce state and parent-session wakeup behavior.
    • impact:auth-provider: The trigger is provider/model routing accepting a model reference later rejected by the upstream provider.
    • impact:crash-loop: The observed impact is gateway event-loop starvation and health/RPC unresponsiveness even while the process remains running.
    Evidence reviewed

    What I checked:

    • Current source: model availability classifier: The live model-not-found classifier matches unknown/not-found/invalid model wording, but it does not match the reported Model not available: fable wording on current main. (src/agents/live-model-errors.ts:8, a1828110704f)
    • Current source: HTTP 400 classification fallback: For HTTP 400/422 provider responses, unclassified payloads fall back to format, so the reported invalid_request_error payload still needs explicit model-availability handling or provider classification. (src/agents/embedded-agent-helpers/errors.ts:873, a1828110704f)
    • Current source: announce delivery error classes: Permanent announce delivery patterns cover channel/user/outbound failures, while model_not_available or Model not available is not listed as a permanent announce-delivery error. (src/agents/subagent-announce-delivery.ts:371, a1828110704f)
    • Current source: requester history probe: Subagent cleanup still checks the requester transcript through chat.history when looking for a prior completion mirror; the path is bounded but remains part of the announce cleanup/retry surface reported here. (src/agents/subagent-registry-lifecycle.ts:250, a1828110704f)
    • Current source: announce retry/give-up decision: Deferred cleanup still retries until the configured announce retry budget or expiry, then marks delivery failed/blocked; this is not the same as rejecting the terminal provider error before announce retry begins. (src/agents/subagent-registry-lifecycle.ts:880, a1828110704f)
    • Current tests search: Search found announce loop-guard and chat.history mirror coverage, but no current regression coverage for this issue number or the exact Model not available subagent announce path. (a1828110704f)

    Likely related people:

    • steipete: Recent GitHub history shows multiple central subagent lifecycle commits around delivery state, timeout math, and runtime internalization. (role: recent area contributor; confidence: medium; commits: 589b1f6aec69, 465a5456fe0f, 5e139e32dc5f; files: src/agents/subagent-registry-lifecycle.ts)
    • sallyom: Authored the recent pending subagent completion announce preservation change touching the announce delivery file. (role: recent area contributor; confidence: medium; commits: 95c87e31e295; files: src/agents/subagent-announce-delivery.ts)
    • vincentkoc: Recent commits touched live model error classification and subagent delivery state, both central to this report's provider-error path. (role: provider classifier contributor; confidence: medium; commits: 2405d029d437, 43400f8d5b50, 7e0d275f7add; files: src/agents/live-model-errors.ts, src/agents/subagent-registry-lifecycle.ts)
    • joshavant: Authored a recent structured unsupported-model classification fix in the provider failover helpers adjacent to the reported error classification gap. (role: adjacent provider-classification contributor; confidence: medium; commits: f80f47219091; files: src/agents/live-model-errors.ts, src/agents/embedded-agent-helpers/errors.ts)
    How this review workflow works
    • 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.
  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:crash-loopCrash, hang, restart loop, or process-level availability failure.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    on Jun 15, 2026
  3. houleixx commented on Jun 21, 2026

    @houleixx
    For a retry/storm bug like this, request-level visibility is useful because the important question is where the loop starts.
    
    ccglass can show model requests, response/error bodies, latency, token/cache/cost, and turn-to-turn diffs for Anthropic/OpenAI-compatible agent traffic. It may help identify whether the rejected model response is being converted into repeated subagent announce requests, repeated history polling, or another retry path.
    
    Project: https://github.com/jianshuo/ccglass
    
  4. openclaw-barnacle commented on Jul 6, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  5. openclaw-barnacle commented on Jul 14, 2026

    @openclaw-barnacle

    Closing due to inactivity.
    If this is still an issue, please retry on the latest OpenClaw release and share updated details.
    If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.

  6. locked as resolved and limited conversation to collaborators on Aug 30, 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

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions