Skip to content

fix(cron): preserve prepared runtime and error ownership - #140941

Merged
obviyus merged 5 commits into
openclaw:mainfrom
Marvinthebored:fix/prepared-generation-borrow-disabled-plugin
Sep 8, 2026
Merged

obviyus merged 5 commits into
openclaw:mainfrom
Marvinthebored:fix/prepared-generation-borrow-disabled-plugin

Conversation

@Marvinthebored

@Marvinthebored Marvinthebored commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Isolated cron runs can reject a usable non-primary model before dispatch when another plugin in the fallback plan is disabled. The prepared-generation borrow check treated that recorded outcome as a missing owner. Accept disabled outcomes alongside recorded load errors, while preserving the live parent lease, identity checks, and downstream model availability.

The provider-error control also exposed a missing handoff in cron's shared execution path: each failed candidate settled a separate error recorder against the same terminal transcript key. Pass the existing logical-run error recorder into the embedded runner so exhausted fallbacks report the provider failures once.

Validation:

  • Current main 252158295ee487c4145404367fa15e3db588989b: the real Gateway cron run path fails with generation supersession in 168 ms before any model POST.
  • Candidate: the same configuration and original job return the normal provider-B result with exactly one B model POST and no C model POST.
  • Disabled plugin-only model selection still returns model_not_found without model I/O. Explicitly configured generic provider transports retain their existing availability; disabling plugin code does not remove that separate configuration.
  • Injected B and C provider failures now report both original errors instead of a transcript idempotency conflict. Restoring B succeeds in the same Gateway process, without a restart or an intervening primary run.
  • Primary cron, interactive turns, first usable fallback, and disabled-plugin state pass. Earlier independent source-blind CLI acceptance remains recorded separately from owner-level checks.
  • The new borrowed-lease cases cover loaded, disabled, error, absent, and not-imported outcomes. Reverting only the predicate makes the disabled case fail; the repaired owner/lifecycle set passes 99 tests. Cron fallback and shared-entry siblings pass 40 tests.
  • Fresh independent P0–P2 review is clean. Hosted CI checks the published head.

The current native proof used candidate tree 6a051fda57b16deecc389828b52ba9605cb68e38, now committed as 55a440123a0850b48f14213e38129cb74e27c34e. Its pre-commit build stamp retains the original checkout base; no artifact was restamped. Earlier baseline/candidate proof and failed CI attempts are preserved with their original identities.

Fixes #140940.

When a prepared-runtime lease must borrow the published generation (the
configured owner and the published dispatch runtime hold different
generation objects, which is the normal shape of cron's nested admission),
the borrow check requires every plugin in the runtime plugin load plan to
be present in the borrowed registry, tolerating only plugins recorded with
status "error". A plugin recorded as "disabled" was treated as missing, so
the lease threw "prepared model runtime plugin generation was superseded".

Primary admission already records disabled plan plugins as a generation
outcome without requiring successful model resolution; whether the model
can actually be served is decided downstream on both paths. Treat
"disabled" like "error" in the borrow check so the borrow path cannot
reject a generation that admission accepted.

Observed with agents.defaults.model.fallbacks containing a
bailian-token-plan model whose owner plugin (qwen) is disabled: every
isolated cron run selecting a non-primary provider failed in ~150 ms.
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 8, 2026, 12:16 AM ET / 04:16 UTC.

ClawSweeper review

What this changes

The PR lets cron reuse prepared plugin state containing disabled plugins and shares one error recorder across fallback attempts so provider failures retain their original diagnostics.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: both defects persist on fetched main, the supplied runtime observations cover the changed behavior, and no blocking patch defect was found. The related runtime-refresh PR addresses a different failure mechanism.

Priority: P1
Reviewed head: 55a440123a0850b48f14213e38129cb74e27c34e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with relevant real-runtime observations and meaningful regression coverage; no blocking finding remains.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied body records real Gateway cron execution through the changed lease and recorder owners: successful candidate dispatch, disabled plugin-only rejection before I/O, original exhausted-provider diagnostics, and same-process recovery. The reported candidate tree matches the reviewed head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied body records real Gateway cron execution through the changed lease and recorder owners: successful candidate dispatch, disabled plugin-only rejection before I/O, original exhausted-provider diagnostics, and same-process recovery. The reported candidate tree matches the reviewed head.
Evidence reviewed 8 items Both fixes remain absent from fetched main: Fetched main still accepts recorded error outcomes but rejects disabled outcomes in the borrowing predicate, and its cron embedded-run call omits assistantErrorTranscript. No merged fixing PR is established by the supplied related-item context.
Borrowing retains existing admission fences: The caller still requires the live borrowed snapshot, matching metadata, config, agent, directories, and supported flags, followed by assertAdmission. The changed predicate recognizes a recorded disabled outcome without loading or enabling that plugin.
Disabled outcomes remain unavailable for runtime use: Runtime registry membership still excludes disabled records and prevents direct registrations from reviving disabled, failed, or deferred owners. The added tests exercise nested lease acquisition for loaded, disabled, error, absent, and not-imported outcomes.
Findings None None.
Security None None.

How this fits together

Isolated cron jobs prepare model and plugin state before dispatching an agent turn through the configured fallback chain. Prepared-runtime leases retain that state, while a logical-run error recorder controls terminal transcript writes.

flowchart TD
  A[Scheduled cron job] --> B[Model and fallback selection]
  B --> C[Prepared runtime lease]
  C --> D{Recorded plugin outcome}
  D --> E[Model availability and dispatch]
  E --> F[Fallback attempts]
  F --> G[Shared terminal error recorder]
  G --> H[Run result and transcript]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +3, Tests +102. Total +105 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 7 4 +3
Tests 1 103 1 +102
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 110 5 +105

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #140940
Summary: This PR is the candidate fix for the disabled-plugin borrowing failure; runtime publication timing is adjacent, distinct work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep plugin availability decisions downstream of lease reuse and settle fallback errors through the existing logical-run owner.

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

Yes: fetched-main source establishes the disabled-outcome rejection and missing recorder handoff, supported by the supplied before/after Gateway observations. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Yes: both changes repair existing ownership boundaries, preserve admission and model-availability checks, and reuse established behavior without adding configuration or parallel APIs.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2eb8a5f84c74.

Labels

Label justifications:

  • P1: The linked report documents existing isolated cron workflows failing before any model request when their fallback plan contains a disabled plugin.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied body records real Gateway cron execution through the changed lease and recorder owners: successful candidate dispatch, disabled plugin-only rejection before I/O, original exhausted-provider diagnostics, and same-process recovery. The reported candidate tree matches the reviewed head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied body records real Gateway cron execution through the changed lease and recorder owners: successful candidate dispatch, disabled plugin-only rejection before I/O, original exhausted-provider diagnostics, and same-process recovery. The reported candidate tree matches the reviewed head.

Evidence

What I checked:

  • Both fixes remain absent from fetched main: Fetched main still accepts recorded error outcomes but rejects disabled outcomes in the borrowing predicate, and its cron embedded-run call omits assistantErrorTranscript. No merged fixing PR is established by the supplied related-item context. (src/agents/prepared-model-runtime.plugin-generation.ts:35, 2eb8a5f84c74)
  • Borrowing retains existing admission fences: The caller still requires the live borrowed snapshot, matching metadata, config, agent, directories, and supported flags, followed by assertAdmission. The changed predicate recognizes a recorded disabled outcome without loading or enabling that plugin. (src/agents/prepared-model-runtime-lease.ts:198, 55a440123a08)
  • Disabled outcomes remain unavailable for runtime use: Runtime registry membership still excludes disabled records and prevents direct registrations from reviving disabled, failed, or deferred owners. The added tests exercise nested lease acquisition for loaded, disabled, error, absent, and not-imported outcomes. (src/plugins/active-runtime-registry.ts:78, 55a440123a08)
  • Canonical error-recorder ownership: The shared entry creates and settles one recorder for the logical run; the embedded orchestrator settles its own recorder only when none was supplied. Cron now forwards the existing recorder, matching the command path. The recorder retains transcript write assertions and the existing terminal-error idempotency key. (src/cron/isolated-agent/run-executor.ts:841, 55a440123a08)
  • Source-bound real Gateway observations: The supplied PR body records baseline rejection before model I/O, candidate success with exactly one provider-B POST and no provider-C POST, disabled plugin-only selection rejected without I/O, exhausted-provider errors without an idempotency conflict, and recovery in the same Gateway process. Its reported candidate tree 6a051fda57b16deecc389828b52ba9605cb68e38 matches the inspected head tree. These are contributor-reported runtime observations, not reviewer-executed tests. (55a440123a08)
  • Related work has a distinct repair boundary: [Bug]: isolated cron runs fail with "plugin generation was superseded" when a fallback provider's plugin is disabled (2026.9.x regression) #140940 identifies this borrowing-predicate failure and reports that the runtime-refresh candidate did not resolve it. fix(cron): prevent isolated runs from failing during runtime refresh #133693 instead retains an admitted generation across publication during asynchronous preparation; it does not supersede the disabled-outcome or error-recorder fixes.

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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-07T06:58:18.914Z sha eb4bf85 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-07T08:32:42.864Z sha 72c18b1 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-07T10:07:55.653Z sha 0015cf3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-07T10:36:40.223Z sha 22a8707 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-07T11:22:05.689Z sha 22a8707 :: needs maintainer review before merge. :: none

@obviyus obviyus changed the title fix(agents): isolated cron runs fail with "plugin generation was superseded" when a fallback provider's plugin is disabled fix(cron): preserve prepared runtime and error ownership Sep 8, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 8, 2026
@obviyus
obviyus merged commit 855c9de into openclaw:main Sep 8, 2026
214 checks passed
@obviyus

obviyus commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Thanks @Marvinthebored! Merged as 855c9de4a2a7c8015d4fa78b28d00f330c0649ba.

Proof: The real Gateway cron path now reaches the usable non-primary provider while the fallback plugin remains disabled. Exhausted fallbacks report the original provider errors, and restoring the provider succeeds without restarting the Gateway.

  • Before: Generation supersession blocked dispatch; multiple provider failures could instead produce a transcript idempotency conflict.
  • After: Borrowing preserves recorded disabled outcomes, and fallback attempts share the logical run's error recorder. Plugin-only unavailable models still reject normally.
  • Validation: 139 focused owner/sibling tests passed; the disabled regression fails with the original predicate. Independent review and the final ClawSweeper gate passed. Full CI passed on the published head.

vincentkoc added a commit to LiuwqGit/openclaw that referenced this pull request Sep 8, 2026
…1-prep

* commit 'da37d47920d102044a4cb33f8cd688b4abc3c2a6': (460 commits)
  refactor(memory): simplify built-in runtime delegation (openclaw#141847)
  refactor(comfy): remove unused cloud fixture input (openclaw#141844)
  fix(agents): keep canonical target casing for session-bound replies (openclaw#140418)
  fix(ci): hydrate release source ancestry through branch (openclaw#141840)
  fix(telemetry): include mixed-case configured providers (openclaw#141134)
  fix(qa): retain Slack presentation history (openclaw#127300)
  test(cli): compact argv case matrices (openclaw#141832)
  test(agents): compact code mode case matrices (openclaw#141831)
  test(gateway): compact control ui routing cases (openclaw#141834)
  test(reasoning): compact reasoning tag cases (openclaw#141833)
  fix(cli): keep progress spinners within terminal width (openclaw#141401)
  fix(release): provision native live harness dependencies (openclaw#141829)
  fix(cron): preserve prepared runtime and error ownership (openclaw#140941)
  fix(npm): recognize companion-owned runtime imports (openclaw#141647)
  fix(browser): reject unsupported buttons in click commands (openclaw#140976)
  refactor(gateway): keep cached turn replay with dedupe (openclaw#141824)
  fix(release): preserve frozen gateway package resolution (openclaw#141827)
  refactor: keep live image probe matching private (openclaw#141823)
  fix(browser): recover stale panel after stream disconnects (openclaw#141576)
  feat(cron): explain slow automation list requests (openclaw#141805)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 9, 2026
…0941)

Isolated cron runs can reject a usable non-primary model before dispatch when another plugin in the fallback plan is disabled. The prepared-generation borrow check treated that recorded outcome as a missing owner. Accept disabled outcomes alongside recorded load errors, while preserving the live parent lease, identity checks, and downstream model availability.

The provider-error control also exposed a missing handoff in cron's shared execution path: each failed candidate settled a separate error recorder against the same terminal transcript key. Pass the existing logical-run error recorder into the embedded runner so exhausted fallbacks report the provider failures once.

Validation:

- Current main `0a2e206fbcc21393da6db341748c8975b6669436`: the real Gateway `cron run` path fails with generation supersession in 168 ms before any model POST.
- Candidate: the same configuration and original job return the normal provider-B result with exactly one B model POST and no C model POST.
- Disabled plugin-only model selection still returns `model_not_found` without model I/O. Explicitly configured generic provider transports retain their existing availability; disabling plugin code does not remove that separate configuration.
- Injected B and C provider failures now report both original errors instead of a transcript idempotency conflict. Restoring B succeeds in the same Gateway process, without a restart or an intervening primary run.
- Primary cron, interactive turns, first usable fallback, and disabled-plugin state pass. Earlier independent source-blind CLI acceptance remains recorded separately from owner-level checks.
- The new borrowed-lease cases cover loaded, disabled, error, absent, and not-imported outcomes. Reverting only the predicate makes the disabled case fail; the repaired owner/lifecycle set passes 99 tests. Cron fallback and shared-entry siblings pass 40 tests.
- Fresh independent P0–P2 review is clean. Hosted CI checks the published head.

The current native proof used candidate tree `6a051fda57b16deecc389828b52ba9605cb68e38`, now committed as `55a440123a0850b48f14213e38129cb74e27c34e`. Its pre-commit build stamp retains the original checkout base; no artifact was restamped. Earlier baseline/candidate proof and failed CI attempts are preserved with their original identities.

Fixes openclaw#140940.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: isolated cron runs fail with "plugin generation was superseded" when a fallback provider's plugin is disabled (2026.9.x regression)

2 participants