Skip to content

fix(gateway): cancel pending model reloads during shutdown - #158047

Merged
steipete merged 7 commits into
mainfrom
codex/config-hook-catalog-join-20260925
Sep 25, 2026
Merged

steipete merged 7 commits into
mainfrom
codex/config-hook-catalog-join-20260925

Conversation

@steipete

@steipete steipete commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Related: #147584, #151608

What Problem This Solves

The last Gateway could wait for a model-publication timeout during shutdown because it joined a config reload before signalling cancellation to that reload's provider acquisition.

User Impact

Final Gateway shutdown now cancels pending model refresh acquisition before joining it. A surviving Gateway keeps its shared model publication when a sibling closes, and owned writes and resource cleanup still settle. No configuration or migration is required.

Why This Change Was Made

The existing metadata lifetime owner starts one shared producer stop after every admitted Gateway, including bootstraps, has fenced admission. The model owner then seals refresh admission and cancels pending acquisition using its existing controller and publication epoch. The kernel retains the cancellation callable before bootstrap acquires resources, so shutdown does not import a chunk that an in-place update may have replaced. Final teardown retains the original joins for raw acquisition and disposal; the publication observer timeout is unchanged.

Evidence

The config RPC fixture now reports its current setup and teardown phases when a test fails. This bounded failure context is retained to make future hook failures actionable. Assertions, order, deadlines, production imports, and cleanup calls are unchanged; it is not a claimed timeout fix.

The real Gateway regression fails without the kernel hookup: acquisition remains live when the reloader stop begins. The repaired path cancels acquisition and keeps close pending until its cleanup finishes. A two-Gateway regression also reproduced a survivor losing its model catalog; the corrected shared lifetime preserves that catalog and handles concurrent sibling shutdown.

The owner and flow suite passed 201 tests across 11 files, including the original 81-case config file in order, model lifecycle/write-settlement/dispatch cases, and metadata retirement. After retaining the cancellation callable during startup, all 10 selected real Gateway acquisition, startup, and web-fetch tests pass. The final-Gateway case independently makes fresh model-runtime imports fail, then proves retained cancellation and cleanup still succeed; it failed at the late shutdown import before the correction. Full build and maintained changed-file checks passed, including core and test type graphs, lint, formatting, and structural guards. Fresh independent review found no actionable findings.

The existing real-process SIGTERM tests also pass: cooperative acquisition cancels and joins its fixture worker before exit (6.1s), while noncooperative acquisition retains the existing bounded shutdown behavior (20.2s). The process-test shard took 67.1s including cold compilation; the 10-case Gateway shard took 100.3s.

Package Acceptance passed for commit 541451990b73: package integrity, npm 12 installation, published 2026.9.5 updater installation/migration, and the installed candidate's authenticated update/restart into a synthetic future package. The update lane passed once in 1,339 seconds and its workflow cleanup joined. This lane does not deliberately hold model acquisition during the updater transaction; cancellation and producer settlement are proved separately by the real Gateway and SIGTERM regressions above.

The final composition retains the canonical starter policy and scoped-alias handling from main, with the real HTTP fixtures corrected in #158115. All nine selected tests across four files passed, including the unchanged native-worker freshness assertion. The Gateway shutdown files remain byte-identical to 541451990b73; the separate legacy-retention proposal is not included. Fresh review of this final candidate found no actionable P0–P2 findings. The Package Acceptance run above remains bound to 541451990b73, not a rebuilt final-head package.

The full original 81-case config file passed in order on the current candidate (9fddc3aff0ec), using the same CI group, Node 24.19, and two workers as the preceding failure. This is a non-reproduction, not causal proof.

Exact-head CI passed for 9fddc3aff0ec: 139 successful jobs and 20 skips.

The recurring 180-second config hook timeout also occurred in CI with the shared-lifetime repair present. That failure remains unlocalized and is not claimed fixed by this PR.

Carry the managed reloader lifetime into model acquisition so shutdown
signals cancellation before joining active reload transactions. Preserve
publication observer timeouts and final raw acquisition/disposal joins.
A stopped caller can leave successor observation without cancelling that
successor, and cancelled queued refreshes reject instead of reporting success.

Prove the real Gateway watcher/close boundary and preserve model owner,
write-settlement, dispatch, metadata, and original-order config behavior.
The historical include-only hook timeout remains causally unproven.
@clawsweeper

clawsweeper Bot commented Sep 25, 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 gateway Gateway runtime agents Agent runtime and tooling size: M labels Sep 25, 2026
@steipete
steipete marked this pull request as ready for review September 25, 2026 09:47
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 25, 2026, 12:45 PM ET / 16:45 UTC (Revision 9).

ClawSweeper review

What this changes

The branch cancels pending model acquisition during Gateway shutdown, preserves model catalogs used by a surviving Gateway, and updates lifecycle tests and provider-catalog documentation.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open. Current main lacks the shutdown cancellation, and no merged PR covers this distinct fix. The reviewed head has direct Gateway proof and no confirmed code finding.

Priority: P1
Reviewed head: 9fddc3aff0eceec9565991881ccf4bc810e2190c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The repair has strong Gateway boundary coverage and no confirmed patch defect, while final-candidate update proof and test-cost accounting remain open.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The changed model-runtime and metadata owners are exercised through a real Gateway config watcher with held synthetic provider acquisition and sibling shutdown; the PR reports after-fix abort, settled cleanup, and a retained sibling catalog, with separate real-process SIGTERM observations. The earlier-candidate published-updater pass did not hold acquisition, leaving that upgrade gate open. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed model-runtime and metadata owners are exercised through a real Gateway config watcher with held synthetic provider acquisition and sibling shutdown; the PR reports after-fix abort, settled cleanup, and a retained sibling catalog, with separate real-process SIGTERM observations. The earlier-candidate published-updater pass did not hold acquisition, leaving that upgrade gate open. No stored-data contract changes.
Evidence reviewed 8 items Introduced shutdown fence: The pinned PR diff adds a model-runtime cancellation function and invokes it when all admitted Gateway metadata owners begin closing.
Current main still needs the fix: Current main begins the close prelude and joins the config reloader without the new shared model-acquisition cancellation.
Gateway boundary coverage: The added test starts real Gateway instances and a watched configuration change, holds provider acquisition, and checks cancellation, cleanup, and a surviving sibling's catalog. The PR body reports a failing pre-fix control and passing repaired cases; this read-only review did not execute them.
Findings None None.
Security None None.

How this fits together

The Gateway watches configuration and publishes provider model catalogs for agent use. During shutdown it must stop new model work, settle active acquisition, and then release plugin and model resources.

flowchart LR
  A[Config change] --> B[Gateway reloader]
  B --> C[Provider model acquisition]
  D[Gateway shutdown] --> E[Shared lifetime fence]
  E --> C
  C --> F[Model catalog publication]
  E --> G[Resource cleanup]
Loading

Before merge

  • Resolve merge risk (P1) - The successful published-updater run used an earlier candidate and did not hold model acquisition. An installed update of this final candidate with acquisition pending has no observed shutdown and recovery result.
  • Resolve merge risk (P1) - Per-file wall time and available CI seconds remain unreported for the materially changed tests, so their cost against the repository test budget is not established.
  • Complete next step (P2) - Record a published-updater run into the final candidate with acquisition pending and observable shutdown recovery, and report per-file wall time and available CI seconds for the changed tests.
Agent review details

Security

None.

PR surface

Source +36, Tests +393, Docs +3. Total +432 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 8 69 33 +36
Tests 8 423 30 +393
Docs 1 5 2 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 497 65 +432

Review metrics

Metric Value Why it matters
Production versus test delta production +69/-33 lines; tests and test support +423/-30 lines Most growth is lifecycle coverage; the production addition is the shared stop hook and model refresh fence.

Merge-risk options

Maintainer options:

  1. Prove the installed shutdown path (recommended)
    Run a published updater into the final candidate while provider acquisition is pending, and record cancellation, cleanup settlement, and Gateway recovery.

Technical review

Best possible solution:

Use the shared Gateway lifetime to cancel acquisition before joining reload work, retain the surviving Gateway's catalog, and qualify the final candidate through the installed-update and test-cost gates.

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

Yes. Current main joins the config reloader without the new cancellation, and the PR supplies a real-Gateway held-acquisition regression with a reported pre-fix failure. This read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Cancellation belongs at the shared lifetime fence so one closing Gateway cannot cancel a serving sibling's model publication; the installed-update proof remains to be completed.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦐 gold shrimp.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: A Gateway can wait through a model-publication timeout during shutdown, affecting a live update or restart workflow.
  • merge-risk: 🚨 availability: The new shared close prelude changes shutdown ordering, and final-candidate installed-update recovery under held acquisition remains unobserved.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed model-runtime and metadata owners are exercised through a real Gateway config watcher with held synthetic provider acquisition and sibling shutdown; the PR reports after-fix abort, settled cleanup, and a retained sibling catalog, with separate real-process SIGTERM observations. The earlier-candidate published-updater pass did not hold acquisition, leaving that upgrade gate open. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed model-runtime and metadata owners are exercised through a real Gateway config watcher with held synthetic provider acquisition and sibling shutdown; the PR reports after-fix abort, settled cleanup, and a retained sibling catalog, with separate real-process SIGTERM observations. The earlier-candidate published-updater pass did not hold acquisition, leaving that upgrade gate open. No stored-data contract changes.

Evidence

What I checked:

  • Introduced shutdown fence: The pinned PR diff adds a model-runtime cancellation function and invokes it when all admitted Gateway metadata owners begin closing. (src/agents/prepared-model-runtime.ts:135, 9fddc3aff0ec)
  • Current main still needs the fix: Current main begins the close prelude and joins the config reloader without the new shared model-acquisition cancellation. (src/gateway/server-lifecycle.ts:431, cd2f12e36952)
  • Gateway boundary coverage: The added test starts real Gateway instances and a watched configuration change, holds provider acquisition, and checks cancellation, cleanup, and a surviving sibling's catalog. The PR body reports a failing pre-fix control and passing repaired cases; this read-only review did not execute them. (src/gateway/server-close.model-acquisition.test.ts:124, 9fddc3aff0ec)
  • Shutdown code unchanged since package candidate: The shutdown implementation and its Gateway acquisition test are byte-identical between the earlier package candidate and this head. Later branch work does not replace those hunks. (src/gateway/server-kernel.ts:152, 9fddc3aff0ec)
  • Exact-head CI: The completed CI run reports success for the exact reviewed head. CI supports validation but does not exercise the missing held-acquisition update scenario. (9fddc3aff0ec)
  • Published-updater proof boundary: The PR body binds its successful Package Acceptance candidate to 5414519 and says that run did not hold model acquisition. The Actions run's head SHA identifies the workflow revision, not the packaged candidate.

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record a final-candidate published-update run with model acquisition pending and observable Gateway recovery.
  • Add single-file wall time and available CI seconds for each new or materially changed test file.

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 (8 earlier review cycles)
  • reviewed 2026-09-25T09:55:17.565Z sha ea96938 :: blocked before merge. :: [P1] Preserve model owners for a surviving Gateway on reload abort
  • reviewed 2026-09-25T10:56:03.352Z sha d452c2a :: blocked before merge. :: [P2] Retain cancellation before final-close teardown
  • reviewed 2026-09-25T11:16:47.176Z sha b87ad2c :: blocked before merge. :: [P1] Retain cancellation before final-close teardown
  • reviewed 2026-09-25T12:14:40.347Z sha 5414519 :: blocked before merge. :: none
  • reviewed 2026-09-25T13:19:31.522Z sha 5414519 :: blocked before merge. :: none
  • reviewed 2026-09-25T14:35:42.338Z sha 13a1a7d :: blocked before merge. :: none
  • reviewed 2026-09-25T15:38:23.847Z sha 399d8db :: blocked before merge. :: none
  • reviewed 2026-09-25T16:16:52.321Z sha 9fddc3a :: blocked before merge. :: none

Move acquisition cancellation to the existing metadata lifetime's shared
producer stop after every admitted Gateway fences admission. A closing
sibling must not cancel a publication still needed by a live Gateway.

Seal late refresh admission using the existing model controller and epoch,
reset it only for a new registered model lifetime, and preserve published
leases and final raw-work joins. Remove the superseded caller abort options
and publication-observer changes.

Prove final, surviving, and concurrently closing Gateway behavior, booting
owners, duplicate close, and raw cleanup; 201 selected cases pass. The
historical include-only hook timeout remains causally unproven.
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 25, 2026
Carry the canonical starter-retention prerequisite and #158113 through
4f1acb7 so legacy discovery success has provenance while advisory,
authored, and skipped catalogs remain explicit non-observations.

Preserve the Gateway lifetime repair and its raw acquisition cleanup joins.
The historical config hook timeout remains unlocalized.

Validation: 98 composed catalog/auth/Gateway tests, 24 scoped-refresh cases,
18 provider-entry cases, full changed checks plus final targeted type/lint
checks, zero Madge cycles, and fresh independent P2 review all pass.
Package Acceptance remains source-bound to 5414519.
Temporarily record the current setup and teardown steps of the existing
config RPC fixture and emit them only when its test fails. Preserve the
original assertions, hook order, deadlines, imports and cleanup joins.
This observes the recurring CI hook timeout; it does not claim a repair
and will be removed from the landing candidate after localization.

Validation: root test typecheck, targeted lint/format, line-cap and diff
checks pass. Independent P2 review confirms the observer contract against
the installed Vitest runner. No runtime retry or timeout relaxation.
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 25, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The final candidate keeps the qualified shutdown patch from 541451990b73. Its published-updater acceptance run proves installation/migration and authenticated restart/serving; the real Gateway and SIGTERM regressions separately prove cancellation of pending acquisition and settlement of cooperative cleanup. I am accepting that split proof for the unchanged shutdown implementation, with no stored-data or updater-protocol change. It does not claim one installed updater transaction with acquisition deliberately held.

The failure-only config fixture phase reporting will remain as bounded diagnostic context, updating the earlier temporary plan. It preserves assertions, hook order, deadlines, production imports, and cleanup calls. The historical hook timeout remains unlocalized; the 81-case passing run is not a timeout-fix claim.

Exact-head CI for 9fddc3aff0ec passed: 139 successful jobs and 20 skips. The original config file passed all 81 cases in order in 165.66 seconds on Node 24.19 with two workers. The current ClawSweeper review found no correctness or security defect, and independent P2 reviews cover the final composition and fixture observation.

@steipete
steipete merged commit f2a2b9c into main Sep 25, 2026
236 of 237 checks passed
@steipete
steipete deleted the codex/config-hook-catalog-join-20260925 branch September 25, 2026 16:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 25, 2026
* refactor(sessions): reconcile hydration with current worker context

* fix(sessions): remove unused hydration worker type export

Keep the hydration input private to its shared worker union owner while retaining the externally consumed SQLite target input export. This clears the unused-export finding without changing emitted runtime code.

* fix(sessions): publish transcript projections through canonical workers

Move deferred projection writes and readiness reads onto the existing worker
owners while preserving compressed transcript bytes, navigation, and FTS
identity maintenance.

Join the exact in-progress database close before readiness re-admission.
Preserve finalized receipts when retirement prevents a new orphan sweep;
the next preflight still repairs derived orphan rows.

Validation: 73 focused cases, 16 current-main composition cases, causal
SQL control, complete supported lint stripes and selected guards, current
union types, and independent P0-P2 feature and lint-delta reviews.

* fix(sessions): stream full hydration within worker memory limits

Transfer canonical transcript chunks through the existing history worker while retaining one read-only snapshot and complete caller-side results. Preserve SQLite text encodings, BOM errors, cancellation, current-owner checks, and native cleanup without raising the worker heap limit.

* fix(sessions): preserve deferred projection ownership

Carry the admitted database environment through post-commit publication.
Register the projection worker protocol and route its test consumers through
the host broker. Synchronize cancellation and planner fixtures with the real
projection task and completed reconciliation owner.

* test(sessions): align hydration error controls with streaming

Model interactive admission and the canonical streaming result in the
existing quarantine error fixture, preserving its cleanup and retirement
assertions. Remove a redundant unknown-alias assertion from the reader;
emitted production JavaScript is unchanged.

The complete 21-case worker error file, assertion ratchet, owning types,
scoped lint, and fresh P0-P2 review pass.

* fix(sessions): preserve maintenance publication and CI ownership

* test(sessions): preserve projection worker ownership

* test(sessions): drain rewrite fixtures before removing inputs

* test(gateway): keep history worker tests with their canonical owner

* fix(sessions): preserve projection wait cancellation errors

* test(gateway): drain transcript reader fixtures before cleanup

* test(gateway): match the landed placement policy fixture

* fix(gateway): preserve transcript event source ordering

* fix(sessions): refresh stale discovery within captured authority

Refresh pure physical-target discovery once when registry facts change, keeping source retirement and worker failures terminal. Align Gateway fixtures with shared-state and projection lifetimes while preserving their assertions.

* fix(sessions): resume scoped reads after healthy verification

Start a new topology read with current admission for the original physical database and captured owner scopes. Keep startup reads sticky and reject old replies, replaced files, and expired maintenance or schema scopes.

Allow bounded accepted exact-row facts to materialize while their page remains pinned. Preserve foreground priority for new worker reads and the existing archive and source guards.

Update request-authority fixtures to hold the real worker snapshot, and carry the canonical updater VM fixture repair from 691d2e5.

* test(gateway): capture the published chat fixture store

* test(gateway): exclude test support from production callsites

* test(ci): compose canonical fixture repairs

Retain the actual coalescing assertion alongside the canonical capped-chunk comparison. Keep native routing entries sorted without changing membership, preserve the older-schema fixture index lifecycle, and include the existing plugin disposal module in wrapper closure.

Canonical fixes: cb3e6df.

Co-authored-by: joshavant <[email protected]>

* test(ci): preserve shard coverage across planner formatting

Retain canonical gatewayPatterns factoring from 449fc2e and move the
unchanged coalescing assertion earlier in the same case. This resolves the
actual one-file main conflict without importing unrelated source or changing
coverage, ordering inputs, capacity checks or dependencies.

Validation: exact assertion byte parity and clean three-way file union;
owning case, root-test types, scoped lint/format and P2 review pass.

* test(sessions): qualify publication through physical replacement

Hold the real committed finalizer reply before host delivery. Prove that
canonical close waits for the original notification, then replace the closed
physical file and verify the successor contains only its own transcript.
Reuse the existing publication fixture and transparent worker-operation
interception; preserve all native admission and cleanup parameters.

The new case closes the final-effect proof gap without changing production,
adding a Gateway boot, or using a timer or test-only production hook.
Validation: six publication cases pass; new case 1.766s, wrapper 85.48s including
compilation. Owning types/lint/format, ratchets and independent P2 review pass.

* test(ci): compare precise plans with their canonical templates

The UI fallback fixture compared precise parent-job metadata with a measured
complete plan that intentionally repacks different siblings. Compare each
branch with its actual canonical producer and retain all coverage, uniqueness,
worker, runner, concurrency, fallback and memory assertions.

The original two-worker-vs-undefined parent environment mismatch reproduced.
Adding changed-path context alone still failed; matching the precise template
owner passes in 59.79s wrapper wall. Root-test types, lint/format, both ratchets
and independent P2 review pass. No production limits or policy changed.

* perf(cli): reuse pinned config for proxy validation

Carry the exact canonical correction from 488ce1e (#158071), preserving its guarded fallback to the same synchronous config getter. All 73 owning CLI tests, core and config-CLI types, scoped lint/formatting and managed P2 review pass on this composition. The historical 30-second CI timeouts remain unattributed; this is a measured cold-import improvement, not proof of their cause.

* test(ci): align precise assertions with canonical runtime inventory

Adopt the canonical 88e2ebe template reference and explicit deferred-runtime exclusion, retaining changed-path context for the dedicated UI comparison. Preserve all capacity and coverage assertions. The exact three-way file union is clean; the owning case, root-test types, lint/formatting and managed P2 review pass. No production or dependency changes.

* fix(models): preserve explicit catalog discovery provenance

Compose the reviewed #158113 successor 5d9c2d7 and canonical 36def8b consumer. Record successful legacy results while keeping bundled static and advisory results explicitly non-discovery. Preserve the strict retention rule and original worker/source authority. All 40 postimages match the supplier; focused composition tests, types, lint, formatting, ratchet and managed P2 review pass. Matching canonical producer/freshness proof is reused with its original source binding.

* fix(plugin-sdk): compose explicit static catalog outcomes

Compose the qualified six-file successor from #158113 at 4f1acb7. Preserve strict discovery and mark generated static catalogs as non-discovery; move the loader type to its canonical leaf without changing its public export. All six postimages match the supplier. The 18-case owner file, core and SDK types, lint, formatting, both cycle guards, and managed P2 review pass.

* refactor(state): separate independent read byte accounting

Relocate the unchanged deletion snapshot and journal clauses after the repository selector clause so canonical cron byte accounting can merge without an insertion collision. Exact formulas, command discriminants, source authority and input capture are unchanged. The 35-case worker owner suite, core types, lint and formatting pass; managed P2 review is clean and the exact fixed-main file union preserves all clauses.

* fix(models): compose captured discovery alias scope

Compose canonical #158139 (52fc3da) with the qualified #158113 catalog correction. Preserve captured alias normalization only for outcome filtering, original hook scope, explicit outcome authority, and single evaluation of accepted legacy projections. Clarify the legacy omitted-outcome compatibility exception in the combined documentation. All 16 alias/legacy controls, core and owning types, lint/formatting, both cycle guards and managed P2 review pass.

* fix(models): remove unlanded catalog inference detour

Restore all 43 differing detour paths to canonical main52fc3daa84f71b15a052f7bd60caa7096ed5b31a, as verified against the canonical reversal manifest. Preserve the Projection implementation, strict36def retention consumer, canonical alias scope, and #158115 validated HTTP-success fixture correction. The separate legacy-retention repair is not imported.

Validation: 45 native-worker/catalog-builder cases pass; the original discovery lifecycle and credential-free full-refresh cases pass. Core and three owning type projects, scoped lint/formatting, both cycle guards and managed P2 review pass. The longer native Gateway tour reached its final proof marker then hit its unchanged120-second deadline during cleanup, followed by one shutdown cascade; that gap is retained without a retry or deadline change. Current-head CI and installed-upgrade proof remain required.

* fix(gateway): compose early model shutdown cancellation

Compose the exact qualified nine-file shutdown correction from #158047 at541451990b7395eb25c449f0f3a4d4106004e601. Retain cancellation before bootstrap and join the shared prelude only after admitted Gateway owners fence new work. Preserve main's heartbeat-before-cron ordering and all original Projection publication/authority semantics.

Validation: all19 held-acquisition and metadata lifecycle cases pass in this composition; core plus four owning test type projects, scoped lint/formatting, both cycle guards and fresh managed P2 review pass. Supplier real SIGTERM and import-fault proof retains its original source binding. The earlier native-tour cleanup timeout remains unattributed and was not rerun or relabeled; installed-upgrade proof and final exact-head CI remain pending.

* refactor(state): align sandbox read reply construction

Resolve the actual duplicate-extraction conflict by adopting canonical main's registry dispatcher postimage. The existing admitted constant supplies the same primitive ok/sourceAdmitted fields to each fresh reply; commands, kernel calls, arguments and admission behavior are unchanged. All11 owning native sandbox read cases, core types, lint/formatting and fresh managed P2 review pass. Prior724 hosted CI and installed-upgrade proof retain their applicable source and contract bindings; no broad main carry or dependency change.

* test(gateway): retain first sign-in timeout phases

---------

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: joshavant <[email protected]>
steipete added a commit that referenced this pull request Sep 25, 2026
* feat(update): accept owner-bound repair turns

* fix(update): harden delegated repair authority

* fix(update): keep repair worker schema private

* test(update): retain released worker protocol coverage

* fix(update): terminate failed repair result delivery

* fix(update): exit idle repair worker on disconnect

* test(update): retain repair worker timeout diagnostics

* test(update): surface diagnostics in silent E2E runs

* test(update): capture repair worker startup logs

* fix(update): share fresh authority snapshots per repair check

Keep requester policy and update-run checks on one fresh synchronous snapshot of the original installation. Do not inherit discovery snapshots or reuse authority across callbacks. Preserve every executor, requester, IPC and run-phase check and keep source SQLite artifacts untouched.

The real Windows repair turn previously exhausted its budget while repeatedly spawning snapshot readers. Real-WAL regressions cover fresh commits, inherited-scope restoration and closed-scope refusal; preserve the existing worker deadlines and behavior.

* chore(update): trace repair authority timing

Measure cumulative executor, requester-policy, update-row and total assertion elapsed time under the existing trace log level. Record synchronous snapshot subprocess elapsed time to distinguish guard work from launch and copy costs. Preserve checks, error propagation and deadlines.

* test(gateway): complete lifecycle logger fixture

* fix(skills): filter selection before probing binaries

* fix(update): bind delegated repair to its recorded requester

Compare the IPC requester with the original update row before preparing
inference and at every fresh authority assertion. Reuse the existing managed
requester resolver and profile continuation owner so internal/operator update
routes keep their admitted authority while chat identity cannot be omitted or
substituted.

Cover the worker boundary with inert inference and real isolated ledger/config
state, including post-await origin/policy changes. Record the admitted requester
in the existing positive delegated E2E fixture.

* fix(update): integrate catalog and Gateway lifecycle repairs

Compose the reviewed metadata retirement, shared model acquisition shutdown,
and catalog provenance repairs with the repair-turn worker candidate.
Preserve first-discovery starter models and explicit no-discovery outcomes.

Sources: #157979, #158047, #158113, and 36def8b.
The historical include-only CI hook timeout remains unattributed.

Co-authored-by: Dallin Romney <[email protected]>

* fix(update): retain only required canonical integrations

Remove the imported catalog inference and marker adaptations so omitted
outcomes retain their existing contract. Keep the worker and reviewed Gateway
shutdown changes, captured provider-alias normalization, first-discovery
starter handling, and explicit HTTP-success lifecycle fixtures.

Preserve the native augmentation assertions and existing deadlines. The new
legacy-retention work in #158113 is independent of this repair-turn worker.

Co-authored-by: Dallin Romney <[email protected]>

* test(update): initialize survivor registry fixture baseline

Reuse canonical 4fa09e9 so the extracted registry-order orchestration
receives the baseline version that the real runner has already resolved.
Keep production code, ordering assertions, and timeouts unchanged.

The ten-case file, root-test types, lint, and fresh P2 review pass.

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Dallin Romney <[email protected]>
roboclaw-bot added a commit that referenced this pull request Sep 25, 2026
Backport #157979: 3932ca0
Backport heartbeat/cron ordering: 24babfe
Backport #158047: f2a2b9c
Backport #158194: 905d371

Separate admission fencing from final retirement, retain cleanup outcomes,
stop heartbeat wakes before joining cron, cancel acquisition only once all
Gateways fence admission, and avoid awaiting catalog replacement on rollback.
Keep the frozen lifetime owner, schema and configured limits unchanged.

Co-authored-by: IWhatsskill <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: jalehman <[email protected]>
roboclaw-bot added a commit that referenced this pull request Sep 26, 2026
Reuse the canonical failure-only observer from f2a2b9c (#158047) to localize the recurring hosted config hook timeout. Preserve runtime code, hook order, assertions, deadlines, and cleanup joins. This diagnostic does not claim to fix the historical stall.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…158047)

* fix(gateway): cancel pending model reloads during shutdown

Carry the managed reloader lifetime into model acquisition so shutdown
signals cancellation before joining active reload transactions. Preserve
publication observer timeouts and final raw acquisition/disposal joins.
A stopped caller can leave successor observation without cancelling that
successor, and cancelled queued refreshes reject instead of reporting success.

Prove the real Gateway watcher/close boundary and preserve model owner,
write-settlement, dispatch, metadata, and original-order config behavior.
The historical include-only hook timeout remains causally unproven.

* fix(gateway): preserve shared model refreshes until final shutdown

Move acquisition cancellation to the existing metadata lifetime's shared
producer stop after every admitted Gateway fences admission. A closing
sibling must not cancel a publication still needed by a live Gateway.

Seal late refresh admission using the existing model controller and epoch,
reset it only for a new registered model lifetime, and preserve published
leases and final raw-work joins. Remove the superseded caller abort options
and publication-observer changes.

Prove final, surviving, and concurrently closing Gateway behavior, booting
owners, duplicate close, and raw cleanup; 201 selected cases pass. The
historical include-only hook timeout remains causally unproven.

* test(gateway): complete web-fetch startup model teardown mock

* fix(gateway): retain model cancellation before bootstrap

* fix(models): compose canonical catalog provenance repairs

Carry the canonical starter-retention prerequisite and openclaw#158113 through
4f1acb7 so legacy discovery success has provenance while advisory,
authored, and skipped catalogs remain explicit non-observations.

Preserve the Gateway lifetime repair and its raw acquisition cleanup joins.
The historical config hook timeout remains unlocalized.

Validation: 98 composed catalog/auth/Gateway tests, 24 scoped-refresh cases,
18 provider-entry cases, full changed checks plus final targeted type/lint
checks, zero Madge cycles, and fresh independent P2 review all pass.
Package Acceptance remains source-bound to 5414519.

* fix(gateway): keep shutdown repair on canonical catalog contracts

Remove the unlanded catalog inference and producer-marker changes while
preserving the qualified shared Gateway cancellation and cleanup owner.
Retain canonical starter handling, captured provider scope normalization,
and explicit successful discovery in the real HTTP lifecycle fixtures.
The separate legacy-retention proposal is not part of this change.

Validation: the unchanged native-worker regression and scoped/HTTP catalog
flows pass all nine tests. The shutdown files retain the qualified 541
behavior and source-bound Package Acceptance evidence. Maintained changed
checks and independent P2 review pass; canonical dependency postimages
match main at fefab92 without a broad source or manifest refresh.

* test(gateway): report config fixture phase on failure

Temporarily record the current setup and teardown steps of the existing
config RPC fixture and emit them only when its test fails. Preserve the
original assertions, hook order, deadlines, imports and cleanup joins.
This observes the recurring CI hook timeout; it does not claim a repair
and will be removed from the landing candidate after localization.

Validation: root test typecheck, targeted lint/format, line-cap and diff
checks pass. Independent P2 review confirms the observer contract against
the installed Vitest runner. No runtime retry or timeout relaxation.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…54069)

* refactor(sessions): reconcile hydration with current worker context

* fix(sessions): remove unused hydration worker type export

Keep the hydration input private to its shared worker union owner while retaining the externally consumed SQLite target input export. This clears the unused-export finding without changing emitted runtime code.

* fix(sessions): publish transcript projections through canonical workers

Move deferred projection writes and readiness reads onto the existing worker
owners while preserving compressed transcript bytes, navigation, and FTS
identity maintenance.

Join the exact in-progress database close before readiness re-admission.
Preserve finalized receipts when retirement prevents a new orphan sweep;
the next preflight still repairs derived orphan rows.

Validation: 73 focused cases, 16 current-main composition cases, causal
SQL control, complete supported lint stripes and selected guards, current
union types, and independent P0-P2 feature and lint-delta reviews.

* fix(sessions): stream full hydration within worker memory limits

Transfer canonical transcript chunks through the existing history worker while retaining one read-only snapshot and complete caller-side results. Preserve SQLite text encodings, BOM errors, cancellation, current-owner checks, and native cleanup without raising the worker heap limit.

* fix(sessions): preserve deferred projection ownership

Carry the admitted database environment through post-commit publication.
Register the projection worker protocol and route its test consumers through
the host broker. Synchronize cancellation and planner fixtures with the real
projection task and completed reconciliation owner.

* test(sessions): align hydration error controls with streaming

Model interactive admission and the canonical streaming result in the
existing quarantine error fixture, preserving its cleanup and retirement
assertions. Remove a redundant unknown-alias assertion from the reader;
emitted production JavaScript is unchanged.

The complete 21-case worker error file, assertion ratchet, owning types,
scoped lint, and fresh P0-P2 review pass.

* fix(sessions): preserve maintenance publication and CI ownership

* test(sessions): preserve projection worker ownership

* test(sessions): drain rewrite fixtures before removing inputs

* test(gateway): keep history worker tests with their canonical owner

* fix(sessions): preserve projection wait cancellation errors

* test(gateway): drain transcript reader fixtures before cleanup

* test(gateway): match the landed placement policy fixture

* fix(gateway): preserve transcript event source ordering

* fix(sessions): refresh stale discovery within captured authority

Refresh pure physical-target discovery once when registry facts change, keeping source retirement and worker failures terminal. Align Gateway fixtures with shared-state and projection lifetimes while preserving their assertions.

* fix(sessions): resume scoped reads after healthy verification

Start a new topology read with current admission for the original physical database and captured owner scopes. Keep startup reads sticky and reject old replies, replaced files, and expired maintenance or schema scopes.

Allow bounded accepted exact-row facts to materialize while their page remains pinned. Preserve foreground priority for new worker reads and the existing archive and source guards.

Update request-authority fixtures to hold the real worker snapshot, and carry the canonical updater VM fixture repair from 56071a1.

* test(gateway): capture the published chat fixture store

* test(gateway): exclude test support from production callsites

* test(ci): compose canonical fixture repairs

Retain the actual coalescing assertion alongside the canonical capped-chunk comparison. Keep native routing entries sorted without changing membership, preserve the older-schema fixture index lifecycle, and include the existing plugin disposal module in wrapper closure.

Canonical fixes: 59046b8.

Co-authored-by: joshavant <[email protected]>

* test(ci): preserve shard coverage across planner formatting

Retain canonical gatewayPatterns factoring from 3237466 and move the
unchanged coalescing assertion earlier in the same case. This resolves the
actual one-file main conflict without importing unrelated source or changing
coverage, ordering inputs, capacity checks or dependencies.

Validation: exact assertion byte parity and clean three-way file union;
owning case, root-test types, scoped lint/format and P2 review pass.

* test(sessions): qualify publication through physical replacement

Hold the real committed finalizer reply before host delivery. Prove that
canonical close waits for the original notification, then replace the closed
physical file and verify the successor contains only its own transcript.
Reuse the existing publication fixture and transparent worker-operation
interception; preserve all native admission and cleanup parameters.

The new case closes the final-effect proof gap without changing production,
adding a Gateway boot, or using a timer or test-only production hook.
Validation: six publication cases pass; new case 1.766s, wrapper 85.48s including
compilation. Owning types/lint/format, ratchets and independent P2 review pass.

* test(ci): compare precise plans with their canonical templates

The UI fallback fixture compared precise parent-job metadata with a measured
complete plan that intentionally repacks different siblings. Compare each
branch with its actual canonical producer and retain all coverage, uniqueness,
worker, runner, concurrency, fallback and memory assertions.

The original two-worker-vs-undefined parent environment mismatch reproduced.
Adding changed-path context alone still failed; matching the precise template
owner passes in 59.79s wrapper wall. Root-test types, lint/format, both ratchets
and independent P2 review pass. No production limits or policy changed.

* perf(cli): reuse pinned config for proxy validation

Carry the exact canonical correction from ec36a22 (openclaw#158071), preserving its guarded fallback to the same synchronous config getter. All 73 owning CLI tests, core and config-CLI types, scoped lint/formatting and managed P2 review pass on this composition. The historical 30-second CI timeouts remain unattributed; this is a measured cold-import improvement, not proof of their cause.

* test(ci): align precise assertions with canonical runtime inventory

Adopt the canonical d1ce5c3 template reference and explicit deferred-runtime exclusion, retaining changed-path context for the dedicated UI comparison. Preserve all capacity and coverage assertions. The exact three-way file union is clean; the owning case, root-test types, lint/formatting and managed P2 review pass. No production or dependency changes.

* fix(models): preserve explicit catalog discovery provenance

Compose the reviewed openclaw#158113 successor 5d9c2d7 and canonical 3cb4c86 consumer. Record successful legacy results while keeping bundled static and advisory results explicitly non-discovery. Preserve the strict retention rule and original worker/source authority. All 40 postimages match the supplier; focused composition tests, types, lint, formatting, ratchet and managed P2 review pass. Matching canonical producer/freshness proof is reused with its original source binding.

* fix(plugin-sdk): compose explicit static catalog outcomes

Compose the qualified six-file successor from openclaw#158113 at 4f1acb7. Preserve strict discovery and mark generated static catalogs as non-discovery; move the loader type to its canonical leaf without changing its public export. All six postimages match the supplier. The 18-case owner file, core and SDK types, lint, formatting, both cycle guards, and managed P2 review pass.

* refactor(state): separate independent read byte accounting

Relocate the unchanged deletion snapshot and journal clauses after the repository selector clause so canonical cron byte accounting can merge without an insertion collision. Exact formulas, command discriminants, source authority and input capture are unchanged. The 35-case worker owner suite, core types, lint and formatting pass; managed P2 review is clean and the exact fixed-main file union preserves all clauses.

* fix(models): compose captured discovery alias scope

Compose canonical openclaw#158139 (aadb23f) with the qualified openclaw#158113 catalog correction. Preserve captured alias normalization only for outcome filtering, original hook scope, explicit outcome authority, and single evaluation of accepted legacy projections. Clarify the legacy omitted-outcome compatibility exception in the combined documentation. All 16 alias/legacy controls, core and owning types, lint/formatting, both cycle guards and managed P2 review pass.

* fix(models): remove unlanded catalog inference detour

Restore all 43 differing detour paths to canonical main52fc3daa84f71b15a052f7bd60caa7096ed5b31a, as verified against the canonical reversal manifest. Preserve the Projection implementation, strict36def retention consumer, canonical alias scope, and openclaw#158115 validated HTTP-success fixture correction. The separate legacy-retention repair is not imported.

Validation: 45 native-worker/catalog-builder cases pass; the original discovery lifecycle and credential-free full-refresh cases pass. Core and three owning type projects, scoped lint/formatting, both cycle guards and managed P2 review pass. The longer native Gateway tour reached its final proof marker then hit its unchanged120-second deadline during cleanup, followed by one shutdown cascade; that gap is retained without a retry or deadline change. Current-head CI and installed-upgrade proof remain required.

* fix(gateway): compose early model shutdown cancellation

Compose the exact qualified nine-file shutdown correction from openclaw#158047 at541451990b7395eb25c449f0f3a4d4106004e601. Retain cancellation before bootstrap and join the shared prelude only after admitted Gateway owners fence new work. Preserve main's heartbeat-before-cron ordering and all original Projection publication/authority semantics.

Validation: all19 held-acquisition and metadata lifecycle cases pass in this composition; core plus four owning test type projects, scoped lint/formatting, both cycle guards and fresh managed P2 review pass. Supplier real SIGTERM and import-fault proof retains its original source binding. The earlier native-tour cleanup timeout remains unattributed and was not rerun or relabeled; installed-upgrade proof and final exact-head CI remain pending.

* refactor(state): align sandbox read reply construction

Resolve the actual duplicate-extraction conflict by adopting canonical main's registry dispatcher postimage. The existing admitted constant supplies the same primitive ok/sourceAdmitted fields to each fresh reply; commands, kernel calls, arguments and admission behavior are unchanged. All11 owning native sandbox read cases, core types, lint/formatting and fresh managed P2 review pass. Prior724 hosted CI and installed-upgrade proof retain their applicable source and contract bindings; no broad main carry or dependency change.

* test(gateway): retain first sign-in timeout phases

---------

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: joshavant <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
* feat(update): accept owner-bound repair turns

* fix(update): harden delegated repair authority

* fix(update): keep repair worker schema private

* test(update): retain released worker protocol coverage

* fix(update): terminate failed repair result delivery

* fix(update): exit idle repair worker on disconnect

* test(update): retain repair worker timeout diagnostics

* test(update): surface diagnostics in silent E2E runs

* test(update): capture repair worker startup logs

* fix(update): share fresh authority snapshots per repair check

Keep requester policy and update-run checks on one fresh synchronous snapshot of the original installation. Do not inherit discovery snapshots or reuse authority across callbacks. Preserve every executor, requester, IPC and run-phase check and keep source SQLite artifacts untouched.

The real Windows repair turn previously exhausted its budget while repeatedly spawning snapshot readers. Real-WAL regressions cover fresh commits, inherited-scope restoration and closed-scope refusal; preserve the existing worker deadlines and behavior.

* chore(update): trace repair authority timing

Measure cumulative executor, requester-policy, update-row and total assertion elapsed time under the existing trace log level. Record synchronous snapshot subprocess elapsed time to distinguish guard work from launch and copy costs. Preserve checks, error propagation and deadlines.

* test(gateway): complete lifecycle logger fixture

* fix(skills): filter selection before probing binaries

* fix(update): bind delegated repair to its recorded requester

Compare the IPC requester with the original update row before preparing
inference and at every fresh authority assertion. Reuse the existing managed
requester resolver and profile continuation owner so internal/operator update
routes keep their admitted authority while chat identity cannot be omitted or
substituted.

Cover the worker boundary with inert inference and real isolated ledger/config
state, including post-await origin/policy changes. Record the admitted requester
in the existing positive delegated E2E fixture.

* fix(update): integrate catalog and Gateway lifecycle repairs

Compose the reviewed metadata retirement, shared model acquisition shutdown,
and catalog provenance repairs with the repair-turn worker candidate.
Preserve first-discovery starter models and explicit no-discovery outcomes.

Sources: openclaw#157979, openclaw#158047, openclaw#158113, and 3cb4c86.
The historical include-only CI hook timeout remains unattributed.

Co-authored-by: Dallin Romney <[email protected]>

* fix(update): retain only required canonical integrations

Remove the imported catalog inference and marker adaptations so omitted
outcomes retain their existing contract. Keep the worker and reviewed Gateway
shutdown changes, captured provider-alias normalization, first-discovery
starter handling, and explicit HTTP-success lifecycle fixtures.

Preserve the native augmentation assertions and existing deadlines. The new
legacy-retention work in openclaw#158113 is independent of this repair-turn worker.

Co-authored-by: Dallin Romney <[email protected]>

* test(update): initialize survivor registry fixture baseline

Reuse canonical d2295c6 so the extracted registry-order orchestration
receives the baseline version that the real runner has already resolved.
Keep production code, ordering assertions, and timeouts unchanged.

The ten-case file, root-test types, lint, and fresh P2 review pass.

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Dallin Romney <[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 docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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.

1 participant