Skip to content

fix(agents): keep healthy models working when a harness plugin fails to load - #137777

Merged
steipete merged 2 commits into
mainfrom
fix/plugin-generation-load-recovery
Sep 4, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/plugin-generation-load-recovery

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #137748

What Problem This Solves

Fixes an issue where model turns fail with "prepared model runtime plugin generation was superseded" when another configured harness plugin cannot load. Conan (conan6764) reported this after upgrading to 2026.9.1: an incompatible installed Codex payload failed on a missing SDK export, and both OpenAI and MiniMax turns then failed, including the OpenClaw harness. Original report.

Why This Change Was Made

Nested admission confused executable plugin availability with ownership of the still-open parent generation. It also rebuilt the requirement set from every configured harness, so a failed unrelated plugin rejected healthy selections. The owner check now examines the requested selection and recognizes a recorded failed load as an owned, unavailable outcome. The existing runtime availability check still reports the plugin's repair diagnostic; missing, disabled, deferred, copied, and released owners remain fenced.

This removes redundant configured-harness expansion and loaded-base validation. It does not reset a generation, retry a turn, restore the retired SDK export, or introduce persistent state. The check was introduced in #132804 (bee48f7f56808eff2f7aaa035509b8a39b3988e2) and is present in the 2026.9.1 tag. The reporter's precise incompatible installed plugin version remains unknown.

User Impact

Healthy providers can complete turns while another plugin is unavailable. Selecting the failed harness produces its actionable inspect/repair/restart error. Supported installation repairs still belong to doctor, and repaired plugin payloads become visible after a Gateway restart. The plugin architecture guide now explains this behavior.

Evidence

  • CI 33841360276, attempt 2 is complete and green on exact head f8d63102676e578681b0f3b93e4c0d44c0f5041b after rerunning the inherited scanner timing failure. The audit job explicitly reported incomplete coverage after three npm timeouts; no hosted advisory clearance was obtained. Main's shared outage policy fix(ci): warn when npm advisory service is unavailable #137881 permits that warning in ordinary CI; this PR changes no audit policy. The unchanged full local audit completed at 04:45 UTC; subsequent npm requests timed out. The runtime repair and Crabbox-tested owner source hash are unchanged.

  • CI rerun context: job 100924347615 failed the inherited scanner OOM diagnostic assertion: RSS measurement failed before signal classification. The scanner and test match the previous passing PR head and green main run 33841381813. The failed-job rerun passed without code changes. This is a named follow-up for scanner RSS/child-exit timing if it recurs; this PR preserves the fail-closed scanner behavior and assertion.

  • Bounded CI cleanup: job 100920714520 exposed a flaky inherited empty-formatter fixture from fix(git-hooks): keep unstaged bytes out of pre-commit formatting #137723. Its stub exited without reading stdin, allowing git cat-file to receive SIGPIPE (exit 141) before the expected empty-output check. The fixture now drains stdin before returning empty output. Its diagnostic, staged-content, and no-commit assertions are unchanged; production hook behavior is unchanged. All 49 formatter-hook tests pass with node scripts/run-vitest.mjs test/git-hooks-pre-commit.test.ts; node scripts/check-changed.mjs -- test/git-hooks-pre-commit.test.ts also passes.

  • Failing-before regression: node scripts/run-vitest.mjs src/agents/prepared-model-runtime.reply-fallback.test.ts — two new cases fail on unchanged production code with the reported superseded error (six existing cases pass).

  • Focused owner and sibling proof for the unchanged runtime repair: node scripts/run-vitest.mjs src/agents/prepared-model-runtime.reply-fallback.test.ts src/agents/prepared-model-runtime.inbound-registry.test.ts src/agents/prepared-model-runtime.owner-selection.test.ts src/plugins/active-runtime-registry.test.ts src/plugins/registry.provider-like.test.ts src/plugins/registry.diagnostics.test.ts — 153 tests pass, including still-open parent borrowing, released/copied/missing owners, disabled/deferred availability, fallback restrictions, healthy unrelated selection, selected failed-harness diagnostics, and registration rollback.

  • node scripts/check-changed.mjs: passed all selected formatting, typecheck, lint, dependency, schema, and runtime-cycle gates.

  • pnpm build: passed, including native plugin control-plane loads, public SDK exports, and the Control UI build.

  • Crabbox live comparison passed on Blacksmith Testbox run 33826909245, lease tbx_01m1n1dn6j7ra2360fhk4hk500. Separate fresh source checkouts built baseline 3c0eb9fd822f8101dc3117ce40dbd2b0f5e01930 and exact candidate 01c466fe24051757dd0117621aee6a569f35b9da; the candidate owner source SHA256 matched the local source. Each ran a real Gateway with isolated temporary state/workspace, a free loopback port, a synthetic harness throwing a missing-export error, and a local HTTP Responses provider. The real CLI flow used sessions.create, sessions.patch, chat.send, agent.wait, and chat.history. This exercises Gateway/provider HTTP integration; it does not authenticate to an external model service.

    scenario                         baseline           candidate
    healthy-first                    error: superseded  ok: visible healthy reply
    broken-selected                  owner degraded     owner degraded; no provider call
    healthy-after-broken             error: superseded  ok: visible healthy reply
    doctor --fix; restart             exit=0             exit=0
    healthy-after-doctor              error: superseded  ok: visible healthy reply
    repair synthetic plugin payload; doctor --fix; restart
    repaired harness registered      true               true
    healthy-after-payload-repair      ok                 ok: visible healthy reply
    

    Healthy replies were verified from agent.wait terminal status and terminalReply.text=UNRELATED_PROVIDER_HEALTHY, not session titles. The unavailable harness keeps reason=owner-plugin-degraded and the existing inspect/repair/restart diagnostic. Local real Gateway iteration produced the same candidate result. The initial remote setup attempt lacked the shallow baseline object; the completed comparison fetched both exact commits into separate checkouts.

    Before (real baseline Control UI):

    Healthy model fails with the superseded generation error while another harness cannot load

    After (real candidate Control UI, failed harness still present):

    Healthy model returns its visible reply while another harness cannot load

    Both full screenshots were inspected and contain only synthetic task data. The Testbox lease was stopped and independently verified completed after collecting the evidence.

  • Independent local and committed-branch reviews found no actionable P0–P2 findings. ClawSweeper’s latest review (05:02 UTC) reports no correctness/security findings. Its before-merge requests require the complete exact-head CI rollup to be green; that gate is now satisfied by the green final-head run.

git diff --numstat for the final four-file change:

2  0   docs/plugins/architecture.md
13 14  src/agents/prepared-model-runtime.plugin-generation.ts
55 7   src/agents/prepared-model-runtime.reply-fallback.test.ts
6  1   test/git-hooks-pre-commit.test.ts

Production: +13/-14, net -1. Tests: +61/-8, net +53. Docs: +2/-0.

Direct dependency inspection: Codex codex-rs/app-server/src/request_processors/initialize_processor.rs:44-156 keeps initialization connection-scoped; this failure occurs in OpenClaw before app-server/provider dispatch. The shared plugin loader already records failed phase/error outcomes in src/plugins/loader-records.ts; the fix consumes that existing fact.

Related scope: #133692 is a separate cron publication race; #126108 is a catalog-worker reconstruction mismatch. Neither is closed by this repair.

NO-FOLLOW-UP: this repair already removes the duplicate availability policy from generation borrowing; another abstraction would add indirection without simplifying ownership.

@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@steipete
steipete marked this pull request as ready for review September 4, 2026 01:45
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 1:02 AM ET / 05:02 UTC.

ClawSweeper review

What this changes

The PR lets healthy model turns borrow an open prepared runtime generation when a different configured harness plugin has recorded a load failure, while retaining the failed harness’s repair diagnostic.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this maintainer-labeled PR open: the introduced selection-specific admission check addresses the reported regression without a definite correctness or security defect, but its exact-head CI gate is not yet green.

Priority: P1
Reviewed head: 974ff03be827d8b2d93aab8bb1ced916817e8532

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong real behavior evidence and focused owner-boundary coverage support the repair; exact-head CI remains the landing gate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed owner is prepared-generation admission, exercised by the supplied before/after real Gateway Testbox trace through session creation, chat send, agent completion, and visible terminal reply; the candidate recovers healthy turns while retaining the selected failed-harness diagnostic.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed owner is prepared-generation admission, exercised by the supplied before/after real Gateway Testbox trace through session creation, chat send, agent completion, and visible terminal reply; the candidate recovers healthy turns while retaining the selected failed-harness diagnostic.
Evidence reviewed 7 items Current main still has the trigger: Current main expands a nested selection with all configured harnesses and requires every resulting runtime plugin to be present; a failed unrelated record therefore prevents borrowing and reaches the superseded error path.
Introduced owner-boundary repair: The PR removes configured-harness expansion from the borrowed-generation predicate and accepts only an exact recorded error for a selection-owned plugin; unrelated failed harnesses no longer participate.
Caller and failed-owner behavior: Lease admission invokes the predicate only after scope, input identity, and open borrowed snapshot checks; selected harness execution separately turns an errored owner record into the existing inspect/repair/restart diagnostic.
Findings None None.
Security None None.

How this fits together

Prepared model runtime generations load the provider and harness plugins required for an agent turn. Nested reply execution borrows the parent generation only when it owns the requested selection, then dispatches the chosen provider or emits a harness diagnostic.

flowchart LR
  A[Model turn request] --> B[Prepared runtime generation]
  B --> C[Requested provider and harness]
  C --> D{Recorded plugin state}
  D -->|Healthy owner| E[Borrow parent generation]
  D -->|Selected failed harness| F[Show repair diagnostic]
  E --> G[Provider dispatch]
  F --> H[No harness dispatch]
Loading

Before merge

  • Resolve merge risk (P1) - The exact current-head required CI rollup is not green: openclaw/ci-gate failed after security-fast failed, so this should not land until a complete green exact-head rollup is available.
  • Complete next step (P2) - Obtain a complete green CI rollup for the exact current head before merge.
Agent review details

Security

None.

PR surface

Source -1, Tests +48, Docs +2. Total +49 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 14 -1
Tests 1 55 7 +48
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 70 21 +49

Review metrics

Metric Value Why it matters
Production versus test delta production −1 net; tests +48 net; docs +2 The fix reduces production code while adding boundary regressions; it adds no config, persistent-state, protocol, or migration surface.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the selection-specific containment repair and land it after the exact current head has a complete green CI rollup.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the selection-specific containment repair and land it after the exact current head has a complete green CI rollup.

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

Yes, source-reproducible: current main retains the all-configured-harness containment check, and the supplied before/after Gateway trace exercises the resulting superseded-generation failure.

Is this the best way to solve the issue?

Yes: checking only the requested selection at borrowed-generation admission preserves the lifecycle owner boundary, while the existing harness availability owner continues to report the selected failed plugin.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: The regression can reject otherwise healthy model turns before provider dispatch when a separately configured harness fails to load.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed owner is prepared-generation admission, exercised by the supplied before/after real Gateway Testbox trace through session creation, chat send, agent completion, and visible terminal reply; the candidate recovers healthy turns while retaining the selected failed-harness diagnostic.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed owner is prepared-generation admission, exercised by the supplied before/after real Gateway Testbox trace through session creation, chat send, agent completion, and visible terminal reply; the candidate recovers healthy turns while retaining the selected failed-harness diagnostic.

Evidence

What I checked:

  • Current main still has the trigger: Current main expands a nested selection with all configured harnesses and requires every resulting runtime plugin to be present; a failed unrelated record therefore prevents borrowing and reaches the superseded error path. (src/agents/prepared-model-runtime.plugin-generation.ts:26, 3b710e4b75c9)
  • Introduced owner-boundary repair: The PR removes configured-harness expansion from the borrowed-generation predicate and accepts only an exact recorded error for a selection-owned plugin; unrelated failed harnesses no longer participate. (src/agents/prepared-model-runtime.plugin-generation.ts:20, 974ff03be827)
  • Caller and failed-owner behavior: Lease admission invokes the predicate only after scope, input identity, and open borrowed snapshot checks; selected harness execution separately turns an errored owner record into the existing inspect/repair/restart diagnostic. (src/agents/prepared-model-runtime-lease.ts:99, 974ff03be827)
  • Regression coverage: The extended reply-boundary table covers both an unrelated failed harness that admits a healthy selection and a selected failed harness that retains the degraded-owner diagnostic; existing scope coverage still rejects mismatched and released generations. (src/agents/prepared-model-runtime.reply-fallback.test.ts:74, 974ff03be827)
  • Real behavior proof supplied: The PR body provides a before/after Testbox Gateway trace using a failed synthetic harness and local HTTP Responses provider: healthy turns change from the superseded error to a visible reply, while a selected failed harness remains degraded without a provider call. (src/agents/prepared-model-runtime.plugin-generation.ts:35, 974ff03be827)
  • Current-main and release provenance: The PR head is not an ancestor of current main, while its base is; the head is also absent from v2026.8.2. The prior generation-owner refactor is contained in v2026.8.2, so this repair is neither already merged nor released. (src/agents/prepared-model-runtime.plugin-generation.ts:20, 974ff03be827)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (5 earlier review cycles)
  • reviewed 2026-09-04T01:52:30.305Z sha 01c466f :: needs maintainer review before merge. :: none
  • reviewed 2026-09-04T02:05:35.099Z sha 01c466f :: blocked before merge. :: none
  • reviewed 2026-09-04T02:36:19.217Z sha 01c466f :: blocked before merge. :: none
  • reviewed 2026-09-04T03:42:12.029Z sha 01c466f :: blocked before merge. :: none
  • reviewed 2026-09-04T04:05:26.144Z sha 974ff03 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 4, 2026
@steipete
steipete force-pushed the fix/plugin-generation-load-recovery branch from 01c466f to 974ff03 Compare September 4, 2026 03:52
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 4, 2026
Preserve recorded failed-plugin outcomes within the exact open parent generation. Validate only the requested selection so an unrelated configured harness cannot poison healthy provider turns. Keep executable availability and stale-lease rejection unchanged.

Fixes #137748. Reported by Conan (conan6764) on Discord.
@steipete
steipete force-pushed the fix/plugin-generation-load-recovery branch from 974ff03 to f483edd Compare September 4, 2026 05:20
Consume the staged blob before returning empty output so git cat-file cannot receive SIGPIPE before the hook checks the formatter result. Preserve the existing diagnostic and index assertions.

Observed in CI run 33840115492, job 100920714520. All 49 formatter-hook tests pass after the fixture repair.
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

The generation-admission repair is ready to land. The owner now checks the requested selection against the exact parent registry's recorded outcomes; a failed load no longer makes healthy models appear superseded. Selected failed harnesses retain their actionable diagnostic, and the existing lease, identity, release, and executable-availability fences remain unchanged.

Validation: two new regressions fail before the fix with the reported error; 153 focused owner/registry tests pass on the unchanged runtime repair; all 49 formatter-hook tests pass after the bounded stdin-drain fixture repair. Commands: node scripts/run-vitest.mjs src/agents/prepared-model-runtime.reply-fallback.test.ts src/agents/prepared-model-runtime.inbound-registry.test.ts src/agents/prepared-model-runtime.owner-selection.test.ts src/plugins/active-runtime-registry.test.ts src/plugins/registry.provider-like.test.ts src/plugins/registry.diagnostics.test.ts, node scripts/run-vitest.mjs test/git-hooks-pre-commit.test.ts, node scripts/check-changed.mjs, node scripts/check-changed.mjs -- test/git-hooks-pre-commit.test.ts, and pnpm build. The final committed-branch review is clean.

Crabbox run 33826909245 exercised real isolated Gateways built from separate baseline/candidate checkouts. Healthy turns changed from the superseded error to visible replies, including after selecting the broken harness and after doctor/restart. Repairing the payload and restarting restored its registration. The runtime owner source is unchanged on the final head. The PR body contains the transcript and inspected synthetic before/after screenshots; the lease is stopped. This proof uses a local HTTP Responses fixture, not an authenticated external model account, and the reporter's exact incompatible installed payload version remains unknown.

CI 33841360276, attempt 2 is complete and green on exact head f8d63102676e578681b0f3b93e4c0d44c0f5041b after rerunning the inherited scanner timing failure. The audit job explicitly reported incomplete coverage after three npm timeouts; no hosted advisory clearance was obtained. Main's shared outage policy #137881 permits that warning in ordinary CI; this PR changes no audit policy.

ClawSweeper's latest review has no code or security findings; its before-merge requests require the complete green exact-head CI result above. Production +13/-14 (net -1), tests +61/-8 (net +53), docs +2. No configuration, schema, protocol, or dependency changes. NO-FOLLOW-UP: the owner refactor already removes the duplicate policy; another abstraction would add no value.

@steipete
steipete merged commit 788655a into main Sep 4, 2026
327 of 329 checks passed
@steipete
steipete deleted the fix/plugin-generation-load-recovery branch September 4, 2026 06:05
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
…to load (openclaw#137777)

* fix(agents): isolate failed plugins during generation admission

Preserve recorded failed-plugin outcomes within the exact open parent generation. Validate only the requested selection so an unrelated configured harness cannot poison healthy provider turns. Keep executable availability and stale-lease rejection unchanged.

Fixes openclaw#137748. Reported by Conan (conan6764) on Discord.

* test: drain stdin in empty formatter fixture

Consume the staged blob before returning empty output so git cat-file cannot receive SIGPIPE before the hook checks the formatter result. Preserve the existing diagnostic and index assertions.

Observed in CI run 33840115492, job 100920714520. All 49 formatter-hook tests pass after the fixture repair.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed Codex plugin load rejects unrelated model turns as superseded

1 participant