Skip to content

fix(models): apply downloaded catalogs without a Gateway restart - #158000

Merged
obviyus merged 15 commits into
mainfrom
fix/remote-catalog-generation-publication
Oct 1, 2026
Merged

obviyus merged 15 commits into
mainfrom
fix/remote-catalog-generation-publication

Conversation

@obviyus

@obviyus obviyus commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #140086, #141885, #156535, #157838

What Problem This Solves

A running Gateway doesn't see a newly downloaded hosted model catalog until it restarts. This PR publishes each accepted catalog through the existing prepared-runtime owner, without a restart. Model rows and their prices switch together as one generation, which keeps the invariant from #140086.

User Impact

  • Compatible downloads are adopted at the Gateway's background catalog check, or after an explicit models.list refresh. That refresh returns the currently accepted rows right away and runs adoption afterward.
  • A turn admitted on catalog N keeps N's rows and prices until it finishes. New turns use N+1. Rows and prices are never mixed.
  • A concurrent auth or config publication no longer postpones adoption to the next scheduled check (up to 6 h). Adoption waits for that publication to settle, then retries, up to 3 attempts.
  • An owner whose build failed or timed out ends the adoption instead of waiting on unbounded work. Gateway shutdown cancels an adoption that is still preparing.
  • Malformed, schema-invalid, too-new (minVersion) and older catalogs are rejected, and the previously accepted catalog stays in use.
  • Changing models.catalogRefresh.url no longer needs a restart: the previous source's catalog stops applying, and the mirror's catalog is adopted at the next catalog check.

Bad-catalog exposure: with live apply, a valid but wrong published catalog reaches running Gateways at their next catalog check (at most every 6 h) or on the next explicit models.list refresh. It no longer waits for a restart. Recovery uses existing mechanisms only:

  • Republish a corrected catalog with a newer generatedAt; Gateways adopt it the same way.
  • Operators can set models.catalogRefresh.enabled: false, which withdraws remote rows and prices without a restart (covered by the Gateway integration test).

This PR adds no new kill switch, config option or env knob.

Compatibility

No config keys, defaults, types, validation, stored rows, protocol or SDK contracts change. The only config-surface change is the models.catalogRefresh.url help text, which drops the stale "Changes apply after a Gateway restart" sentence, and its regenerated config-doc baseline hash. Existing configs validate unchanged and need no Doctor migration (maintainer confirmation: #158000 (comment)). Startup behavior is unchanged. Upgrade impact for existing installs: an accepted download activates at the next catalog check instead of the next restart.

Why This Change Was Made

  • prepared-model-runtime.configured-refresh.ts builds a complete candidate generation of the configured owners under the new catalog. One serialized commit then publishes rows, the accepted bundle, the pricing context and the reply-dispatch projection together.
  • Adoption re-reads the stored catalog until the config it read under is still current, so a stale caller can't cancel a current adoption.
  • Each preparation attempt has its own abort signal. A config advance restarts only the attempt; a newer catalog or shutdown ends the whole adoption, including pricing preparation.
  • Between attempts, adoption waits only on publication gates: a pending replacement or an owner's pending publication.
  • Adopted owners install the same plugin-retirement recovery as configured publication (fix(plugins): Gateway freezes on model changes with large plugins #161267). After commit, a lost Gateway plugin loan republishes them through the normal recovery. Before commit, it restarts the adoption attempt, and the commit refuses any candidate whose plugin generation retired.

Why downloads were restart-only, and what this keeps

Restart-only activation was a mechanism, not the goal. #140086 chose it to stop rows and prices from different catalog versions mixing, and #157838 was merged as "the prerequisite for applying new remote catalogs without a Gateway restart (rows and prices must switch together)". This PR is that follow-up. Every requirement those PRs set still holds:

Original requirement Source How it holds here
Rows and prices from one catalog version; never mixed across reloads or new requests #140086 One serialized commit publishes owners, bundle, pricing context and dispatch; pricing contexts are keyed by the exact accepted catalog. Integration test: new rows appear only with new prices
Admitted work keeps its pair #140086, #157838 Runs carry their plugin generation's catalog; usage operations capture one pricing context. Integration test and live proof: the in-flight turn keeps the old price
Startup absence is a real state (no downloaded rows without prices) #140086 Absence → catalog goes through the same atomic commit; overlay absence tests unchanged
Worker replacement inherits the host's accepted pair, not a later download #140086 The commit updates the inherited pair; later workers and a worker-exit recovery keep it (overlay and integration tests)
Current enablement and source URL still gate eligibility #140086, #156535 Checked on every read and before adoption, including the default-install v1 fallback; disablement withdraws rows and prices together (integration test)
Bad or superseded downloads never replace the active pair #140086, #141885 Compatibility, minVersion, revision and generatedAt checks; stale reads can't cancel a current adoption (regression test)
Failed catalog checks retry at the remaining fresh interval, not a full TTL #141885 Unchanged scheduler behavior; the deleted notice test's retry case is restored for failed adoption (fails if the retry falls back to the full TTL)
Operators learn when a downloaded catalog is not yet active #141885 No longer needed: downloads activate at the next check. The restart notice and its tests are removed; models refresh says when a running Gateway applies the update
Billing-route prices switch with their rows #156535 upstreamPricing and providerPricing are part of the accepted catalog pair

Evidence

Regressions. Each fails with its fix reverted and passes with it:

  • Retries a scheduled adoption when its pending auth owner settles. Runs through the real Gateway update scheduler. Reverted, it logs remote model catalog check superseded; deferred to the next check.
  • Does not let a read under a superseded config cancel the current adoption. Reverted, both calls end superseded.
  • Ends adoption instead of joining a timed-out owner build. Reverted, adoption never settles.
  • Does not hold Gateway shutdown on an adoption's pricing preparation. Reverted, shutdown waits on the held preparation until the test times out.
  • Recovers adopted owners when their borrowed Gateway plugin retires after commit / before commit. Without the recovery, both fail: Prepared model runtime plugin generation retired and prepared reply dispatch runtime owner was not published.
  • Uses the remaining stored TTL after a fresh startup check when adoption fails. With the retry reverted to the full TTL, the second check doesn't run.

Suites:

Suite Result
prepared-model-runtime.remote-publication.test.ts 10/10
Gateway integration (models-list.remote-catalog) v1 and v2 pass. Config and auth churn during preparation end published on the settled owners. Also covers retained admitted runs, rejected and stale bundles, worker replacement and disablement
prepared-model-runtime*, server-plugin-reload*, update-startup, and all PR-touched test files pass
tsgo:core, all tsgo:test:src shards pass
oxlint and oxfmt on changed files; config:docs:check, config:schema:check; max-lines, assertion-safety and test-timeout-race ratchets pass

Tests wait on owned completion signals (withinTest), not wall-clock deadlines.

Live proof on an isolated Gateway built from cb8c9197fdc (no provider mocks). Later commits add plugin-retirement recovery for adopted owners, covered by the regression tests above, and rebases onto main. It used a real OpenAI key through openai/gpt-4.1-mini, and the build stamp was set before the real catalog's publication date. A client polled models.list back to back over one WebSocket for the whole run (1023 polls, no errors). One Gateway process (PID unchanged) and no restart:

  1. The stored catalog was seeded with an older revision of the real catalog.openclaw.ai v2 catalog: generated 2 days earlier, gpt-4.1-mini priced ×10, plus one extra kimi row. models.list listed the extra row, and a turn priced $4.00 / $16.00 per M input/output.
  2. openclaw models refresh downloaded the real catalog (updated, 1039 models). The listed rows didn't change for the next 7.1 s, and a turn in that window still priced $4.00 / $16.00 per M: a download stays inactive until the Gateway adopts it.
  3. A long turn was admitted on the older catalog, then models.list {refresh:true} returned the older rows (extra kimi row still listed) and started adoption. The new catalog was visible 0.9 s later, while the long turn was still running: the extra kimi row was gone.
  4. The in-flight turn finished at $4.00 / $16.00 per M (older rows and prices). The next turn priced $0.40 / $1.60 per M (real catalog).
  5. models.catalogRefresh.url was moved to a local mirror of the real catalog through config.patch, and the mirror's catalog was adopted without a restart. The mirror then served malformed JSON: models refresh failed with SyntaxError, the model list was unchanged, and the next turn still priced $0.40 / $1.60 per M.

Model picker during republication (also on main). Right after the new generation commits, models.list shows the new generation's configured and static rows until its full catalog loads, then the full list. In the live run this lasted 109 ms. The same poller against a main build shows the same window after a models.* config reload (20 → 6 → 16 rows for about 350 ms), so this PR adds a new trigger for an existing behavior. It doesn't change it. The short list comes from the new generation, so rows and prices stay paired.

Published-driver upgrade cells. Candidate tarball built from a fresh clone at 6f682c7944e with the canonical Docker packaging script and no build-time overrides. sha256 46d881a0…ef0ad; embedded commit 6f682c7944e2, version 2026.9.7. 6f682c7944e already includes the shutdown-cancellation and pricing-deadline commits. The current head the current head differs from it only by rebases onto main: main had moved the scheduled catalog check into update-startup-catalog.ts, and this PR's adoption call moved there unchanged (git range-diff shows no other production change; a remoteCatalog: null test-fixture field moved to main's relocated cli-compaction.test-support.ts).

Driver → candidate Scenario Result
[email protected] base passed (930 s); updater outcome success, no recovery
[email protected] plugin-deps-cleanup passed (923 s); updater outcome success, no recovery
[email protected] (latest) base passed (813 s); updater outcome success, no recovery

In every cell:

  • Migration, post-Doctor config validation, survival, plugin-dependency cleanup and runtime-deps repair checks passed.
  • The candidate Gateway logged ready, then its catalog check fetched and saved the hosted catalog about 0.2 s after starting. The hosted catalog is older than the candidate's build stamp, so adoption ends unchanged, which isn't logged. After a 300 s settlement window, /readyz (ready:true, nothing failing) and a Gateway status RPC passed, and the Gateway shut down cleanly.
  • To show a logged terminal outcome, each cell was repeated with a loopback mirror serving a newer copy of the same catalog. Each check logged remote model catalog applied about 0.26 s after it started, followed by /readyz and status passing.

Not run: [email protected] plugin-deps-cleanup. At the previous head it failed inside the 2026.9.7 driver's retained-runtime verification (Retained runtime entry does not reference its inventoried file: dist/a2ui-…mjs), identically for a merge-base control package with none of this PR's commits.

Harness note for the 2026.9.7 cell: unchanged, the upgrade harness can't run against 2026.9.7. It seeds the retired tools.toolSearch {mode:"code"} setting, which 2026.9.7 rejects. The 2026.9.7 cell used the harness's existing Tool Search "absent" mode, a one-line local change that skips only that seed and its check. The 2026.9.6 cells used the unchanged harness.

CI: fully green on the final head (run 36818367970). Earlier heads hit failures that reproduce on main in code this PR doesn't touch: update-cli.target-schema (main reproduction: #158000 (comment)), the type-suppression inventory, the Windows partition owner test and the Windows backup-rename test. Main has since fixed the last three. Config compatibility confirmation: #158000 (comment).

@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.

@obviyus
obviyus marked this pull request as ready for review September 25, 2026 07:29
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations agents Agent runtime and tooling extensions: deepinfra size: XL labels Sep 25, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 October 1, 2026, 1:16 AM ET / 05:16 UTC (Revision 27).

ClawSweeper review

What this changes

The PR lets running Gateways adopt downloaded model catalogs without restarting, publishing model rows and prices together while preserving the catalog used by admitted work.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR remains useful: current main and the latest release still require a restart. No actionable introduced defect remains identified, and the recorded rollout and compatibility approvals resolve the previous blocker.

Priority: P2
Reviewed head: 88ccc1b440a2d07132d9d68e770a84396ad2c4f3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, well-supported implementation with resolved prior defects and accepted rollout behavior.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured body records a real isolated Gateway exercising refresh-triggered adoption and inference, with unchanged PID, old pricing retained by an in-flight turn, new pricing on subsequent turns, and malformed-download rejection. Prior-head upgrade cells provide supplemental startup evidence; later retirement repairs have focused boundary regressions. 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 (live_output): The captured body records a real isolated Gateway exercising refresh-triggered adoption and inference, with unchanged PID, old pricing retained by an in-flight turn, new pricing on subsequent turns, and malformed-download rejection. Prior-head upgrade cells provide supplemental startup evidence; later retirement repairs have focused boundary regressions. No stored-data contract changes.
Evidence reviewed 8 items Current main still requires restart: The fetched main scheduler calls the restart-required inspection and reports restart guidance; it does not perform live adoption.
Latest-release boundary: The v2026.9.7 source retains the first startup snapshot and exposes checkRemoteModelCatalogUpdate as inspection returning restart-required, rather than publication.
Atomic publication and retirement recovery: Candidates prepare privately, revalidate captured owners before committing, publish through the existing queue, and retain normal recovery after a Gateway plugin lender retires. Retirement before commit aborts preparation.
Findings None None.
Security None None.

How this fits together

The model-catalog subsystem combines hosted metadata with installed provider information. Its prepared runtime supplies model choices to Gateway clients and pricing to agent turns and usage estimates.

flowchart TD
  A[Downloaded catalog] --> B[Compatibility and source checks]
  B --> C[Prepare replacement generation]
  D[Current configuration and owners] --> C
  C --> E[Serialized publication]
  E --> F[New model choices and prices]
  G[Admitted turns] --> H[Retained catalog and prices]
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
Agent review details

Security

None.

PR surface

Source +564, Tests +970, Docs +14, Generated 0, Other +9. Total +1557 across 59 files.

View PR surface stats
Area Files Added Removed Net
Source 25 774 210 +564
Tests 26 1204 234 +970
Docs 6 39 25 +14
Config 0 0 0 0
Generated 1 2 2 0
Other 1 9 0 +9
Total 59 2028 471 +1557

Review metrics

Metric Value Why it matters
Runtime versus regression growth src production +583 net lines; tests and support +949 net lines Production growth implements staged atomic publication, cancellation, and recovery; regression coverage exercises the corresponding lifecycle boundaries.

Technical review

Best possible solution:

Use the existing prepared-runtime owner to publish one catalog-and-pricing generation atomically, retaining admitted work and existing recovery controls.

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

Not applicable as a broken-contract reproduction: main and v2026.9.7 intentionally retain the startup catalog, and this PR adds approved live activation.

Is this the best way to solve the issue?

Yes. Extending the existing publication owner preserves rows-and-prices pairing without creating a competing owner or new operator setting.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Live catalog freshness is a bounded operational improvement with no demonstrated urgent outage.
  • merge-risk: 🚨 compatibility: Existing installs activate accepted downloads earlier; the catalog owner explicitly accepted that timing change and existing recovery controls.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 captured body records a real isolated Gateway exercising refresh-triggered adoption and inference, with unchanged PID, old pricing retained by an in-flight turn, new pricing on subsequent turns, and malformed-download rejection. Prior-head upgrade cells provide supplemental startup evidence; later retirement repairs have focused boundary regressions. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured body records a real isolated Gateway exercising refresh-triggered adoption and inference, with unchanged PID, old pricing retained by an in-flight turn, new pricing on subsequent turns, and malformed-download rejection. Prior-head upgrade cells provide supplemental startup evidence; later retirement repairs have focused boundary regressions. No stored-data contract changes.

Evidence

What I checked:

  • Current main still requires restart: The fetched main scheduler calls the restart-required inspection and reports restart guidance; it does not perform live adoption. (src/infra/update-startup-catalog.ts:41, dd721057b454)
  • Latest-release boundary: The v2026.9.7 source retains the first startup snapshot and exposes checkRemoteModelCatalogUpdate as inspection returning restart-required, rather than publication. (src/model-catalog/remote-overlay.ts, c074824a27c9)
  • Atomic publication and retirement recovery: Candidates prepare privately, revalidate captured owners before committing, publish through the existing queue, and retain normal recovery after a Gateway plugin lender retires. Retirement before commit aborts preparation. (src/agents/prepared-model-runtime.configured-refresh.ts:441, 88ccc1b440a2)
  • Accepted rollout and compatibility tradeoff: The catalog owner explicitly accepted earlier activation of valid but incorrect catalogs, with recovery by newer republication or existing refresh disablement: fix(models): apply downloaded catalogs without a Gateway restart #158000 (comment). Compatibility acceptance is recorded at fix(models): apply downloaded catalogs without a Gateway restart #158000 (comment). Live permission inspection verifies role_name maintain and maintain:true for obviyus. The current diff adds no configuration keys, defaults, validation, SDK surface, or stored-data format. (src/config/schema.help.models.ts:13, 88ccc1b440a2)
  • Captured real behavior and upgrade evidence: The complete fetched body matches captured SHA-256 66304e13a8a22e613dcfe72d2ac3234d11f97b5a59e50884494870c29a0e64ad. Its isolated Gateway run on cb8c919 reports 1,023 successful WebSocket polls, unchanged PID, live catalog adoption, an in-flight turn retaining old prices, subsequent turns receiving new prices, mirror changes, and rejection of malformed downloads. Published-driver cells on 6f682c7944e cover 2026.9.6 base and plugin cleanup plus 2026.9.7 base, including observed catalog settlement and readiness. These are recorded prior-head observations, not reviewer executions of the current head.
  • Prior findings addressed: Current source fences late dynamic builds against accepted-catalog changes, starts optional adoption after the refresh response, and restores plugin-retirement recovery. The new regressions cover those paths, shutdown cancellation, stale configuration, owner churn, v1/v2 publication, retained runs, worker replacement, and disablement. The earlier help-text finding is corrected. (src/agents/prepared-model-runtime.remote-publication.test.ts:432, 88ccc1b440a2)

Likely related people:

  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: 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 (26 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-30T14:04:35.613Z sha cb8c919 :: blocked before merge. :: none
  • reviewed 2026-09-30T14:34:22.043Z sha cb8c919 :: blocked before merge. :: none
  • reviewed 2026-09-30T14:59:55.013Z sha cb8c919 :: blocked before merge. :: none
  • reviewed 2026-09-30T15:10:08.518Z sha ad14283 :: needs changes before merge. :: [P3] Correct catalog URL help for live adoption
  • reviewed 2026-10-01T01:27:27.581Z sha f206ce70d341534ddda69425e65d6747d1b46209 :: blocked before merge. :: none
  • reviewed 2026-10-01T02:34:51.971Z sha f32576f :: blocked before merge. :: [P1] [P1] Restore plugin-retirement recovery on replacement owners
  • reviewed 2026-10-01T04:15:02.031Z sha 926140d :: blocked before merge. :: none
  • reviewed 2026-10-01T05:02:04.259Z sha c08419b :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added 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. and removed 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
@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

Config compatibility review completed for 778817a: the existing models.catalogRefresh.enabled and models.catalogRefresh.url keys, types and defaults are unchanged. The config-file diff changes help text and its generated documentation hash only; there is no Zod schema, stored-row, external protocol, SDK or permission change. Live activation timing is the maintainer-requested catalog-freshness change, preserving the rows/prices invariant from #140086; the sponsorship context is recorded on #157838. Both published 2026.9.6 updater cells (base and plugin-deps-cleanup) passed on bbe3ae7, with no recovery and state/health/readiness/status checks passing. The installed-candidate byte/commit gate also passed despite the unchanged package version. The initial post-core IPC snapshot was unavailable, as already disclosed. The current head additionally passed its complete Gateway matrix, rebuilt package integrity check and live row/price proof; its two upgrade cells are being refreshed. The final commit changes only the reported lint issues and documentation drift, not config defaults or catalog publication policy. @clawsweeper re-review

@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. 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. and removed 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 25, 2026
@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

Fixed the prepared-run and Gateway mock lease contracts, including overridden generations. Registered the catalog integration with the existing built-runtime prerequisite owner; its live-catalog SDK fixture had run without runtime preparation in CI. The complete catalog matrix and affected fixture consumers now pass (56 tests), without changing production publication checks. The PR body also documents configuration compatibility and both passed published-driver upgrade cells.

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 25, 2026
@clawsweeper clawsweeper Bot removed 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
obviyus added a commit that referenced this pull request Oct 8, 2026
…odels (#167178)

## What Problem This Solves

Fixes: the model picker and `models.list` drop every discovered model (for example all OpenRouter rows) while a running Gateway adopts a newly downloaded hosted catalog. If that provider's discovery then fails, the provider stays reduced to its built-in rows until someone runs an explicit refresh.

A production Gateway showed this during a fleet catalog refresh: the list fell from 599 to 54 models for about 2.5 to 4 minutes.

## User Impact

While a Gateway adopts a new catalog, pickers and `models.list` keep showing the current models and prices. The new catalog's models and prices appear together, once its discovery has finished. Adoption itself now takes as long as that discovery (seconds in practice). The previous catalog keeps serving during that time.

## Why This Change Was Made

Adoption (#158000) built each replacement owner with static rows only and published it. It then started that owner's discovery fire-and-forget. Readers therefore saw only configured and catalog rows until discovery finished. A failed discovery left them that way, because failed providers carry no renewal deadline.

Adoption now waits for each candidate's own discovery, inside the candidate's catalog scope, before the single commit. The wait can be cancelled through the adoption's existing abort signal. The post-commit fire-and-forget is removed. `loadFullModelCatalog` gets a `wait` option, so adoption awaits the acquisition instead of the 5 s foreground race that ordinary readers use. Rows and prices still switch in one commit, and admitted runs keep their captured pair (#140086).

Maintainer decision (Ayaan, delegated): adoption waits for candidate discovery. The previous catalog's rows and prices keep serving coherently in the meantime, which is strictly safer than publishing a partial list.

Maintainer decision (Ayaan, delegated): if a provider's discovery fails during adoption, that provider publishes with the new catalog's built-in rows. Rows are never carried across catalog versions (#140086). On `main` this is also the end state, but only after a window in which every discovered row was gone.

No overlap with Pash/Sarah changes.

## Evidence

Regression test `keeps discovered rows published until the adopted catalog's discovery completes` holds the candidate's discovery and drives the real `models.list` handler. While discovery is held, readers still see the old catalog's discovered row and the old pricing generation. After release, they see only the new catalog's row and generation. It fails on `main` (`expected [ 'remote-200' ] to include 'discovered-200'`) and passes with this change. The existing "bounds refresh with two agents…" test now asserts that adoption publishes only after the held discovery completes. All 10 tests in `prepared-model-runtime.remote-publication.test.ts` pass, and `pnpm check:changed` is green.

Live, on an isolated Gateway (loopback, separate state):
- A local catalog mirror serves a fresh bundle per step. Each version renames `kimi/k3` to `Kimi K3 vN` and sets the input price of `openai/gpt-5.4-mini` to N $/M.
- OpenRouter's DNS resolution is delayed through a Node preload.
- `models.list` is polled every 50 ms.
- Adoption is triggered with `openclaw models refresh` followed by a `models.list` refresh.

| Adoption | `main` (adoption code unchanged on current `main`) | This PR |
| --- | --- | --- |
| Warm (no delay) | 514 → **1** row (configured only) for 0.74–0.79 s, then 514 with the new marker | 514 rows throughout; marker switches 3.3 s after the trigger |
| Candidate discovery delayed 3–4 s (its own DNS lookup) | 514 → **1** row for 5.36 s | 514 rows throughout; marker switches 4.98 s and 5.42 s after the trigger, right after the candidate's lookup completes |
| Candidate discovery fails (60 s DNS, 5 s fetch timeout) | 514 → **1** row for 5.38 s, then 51 (OpenRouter 466 → 3 built-in rows) | 514 rows with the old marker for 7.2 s, then 51 with the new marker (decision above) |

On the final diff (rebuilt), the result was the same: a warm adoption with 994 rows throughout switched 2.1 s after the trigger. A 3 s delayed candidate discovery kept 994 rows throughout and switched 5.4 s after the trigger.

Prices follow the same commit. Usage for real `openai/gpt-5.4-mini` turns was computed at the bundled $0.75/M input before the marked catalogs. After adopting v28, v29 and v32, it was computed at exactly $28/$56, $29/$58 and $32/$64 per M (input/output). Real cheap turns (`openclaw agent … --model openai/gpt-5.4-mini`) completed with reply `ok` after each adoption. One turn on the final build hit a retryable agent-database admission error from the session-state layer, about 30 s after adoption. It is unrelated to the catalog, and the immediate retry succeeded.

Local review: `codex review --base origin/main` (model gpt-6-astra), round 1: "No actionable defects were found."

Merge danger: a two-way door. No stored state, schema, config or protocol changes, so a revert fully restores the previous behavior. Blast radius: every Gateway that adopts a downloaded hosted catalog. If this is wrong, adoption could stall behind a hung provider discovery. That wait is still bounded by each provider's own discovery timeouts and is cancelled by supersession, config reload or shutdown. Meanwhile the previous catalog keeps serving.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
…odels (openclaw#167178)

## What Problem This Solves

Fixes: the model picker and `models.list` drop every discovered model (for example all OpenRouter rows) while a running Gateway adopts a newly downloaded hosted catalog. If that provider's discovery then fails, the provider stays reduced to its built-in rows until someone runs an explicit refresh.

A production Gateway showed this during a fleet catalog refresh: the list fell from 599 to 54 models for about 2.5 to 4 minutes.

## User Impact

While a Gateway adopts a new catalog, pickers and `models.list` keep showing the current models and prices. The new catalog's models and prices appear together, once its discovery has finished. Adoption itself now takes as long as that discovery (seconds in practice). The previous catalog keeps serving during that time.

## Why This Change Was Made

Adoption (openclaw#158000) built each replacement owner with static rows only and published it. It then started that owner's discovery fire-and-forget. Readers therefore saw only configured and catalog rows until discovery finished. A failed discovery left them that way, because failed providers carry no renewal deadline.

Adoption now waits for each candidate's own discovery, inside the candidate's catalog scope, before the single commit. The wait can be cancelled through the adoption's existing abort signal. The post-commit fire-and-forget is removed. `loadFullModelCatalog` gets a `wait` option, so adoption awaits the acquisition instead of the 5 s foreground race that ordinary readers use. Rows and prices still switch in one commit, and admitted runs keep their captured pair (openclaw#140086).

Maintainer decision (Ayaan, delegated): adoption waits for candidate discovery. The previous catalog's rows and prices keep serving coherently in the meantime, which is strictly safer than publishing a partial list.

Maintainer decision (Ayaan, delegated): if a provider's discovery fails during adoption, that provider publishes with the new catalog's built-in rows. Rows are never carried across catalog versions (openclaw#140086). On `main` this is also the end state, but only after a window in which every discovered row was gone.

No overlap with Pash/Sarah changes.

## Evidence

Regression test `keeps discovered rows published until the adopted catalog's discovery completes` holds the candidate's discovery and drives the real `models.list` handler. While discovery is held, readers still see the old catalog's discovered row and the old pricing generation. After release, they see only the new catalog's row and generation. It fails on `main` (`expected [ 'remote-200' ] to include 'discovered-200'`) and passes with this change. The existing "bounds refresh with two agents…" test now asserts that adoption publishes only after the held discovery completes. All 10 tests in `prepared-model-runtime.remote-publication.test.ts` pass, and `pnpm check:changed` is green.

Live, on an isolated Gateway (loopback, separate state):
- A local catalog mirror serves a fresh bundle per step. Each version renames `kimi/k3` to `Kimi K3 vN` and sets the input price of `openai/gpt-5.4-mini` to N $/M.
- OpenRouter's DNS resolution is delayed through a Node preload.
- `models.list` is polled every 50 ms.
- Adoption is triggered with `openclaw models refresh` followed by a `models.list` refresh.

| Adoption | `main` (adoption code unchanged on current `main`) | This PR |
| --- | --- | --- |
| Warm (no delay) | 514 → **1** row (configured only) for 0.74–0.79 s, then 514 with the new marker | 514 rows throughout; marker switches 3.3 s after the trigger |
| Candidate discovery delayed 3–4 s (its own DNS lookup) | 514 → **1** row for 5.36 s | 514 rows throughout; marker switches 4.98 s and 5.42 s after the trigger, right after the candidate's lookup completes |
| Candidate discovery fails (60 s DNS, 5 s fetch timeout) | 514 → **1** row for 5.38 s, then 51 (OpenRouter 466 → 3 built-in rows) | 514 rows with the old marker for 7.2 s, then 51 with the new marker (decision above) |

On the final diff (rebuilt), the result was the same: a warm adoption with 994 rows throughout switched 2.1 s after the trigger. A 3 s delayed candidate discovery kept 994 rows throughout and switched 5.4 s after the trigger.

Prices follow the same commit. Usage for real `openai/gpt-5.4-mini` turns was computed at the bundled $0.75/M input before the marked catalogs. After adopting v28, v29 and v32, it was computed at exactly $28/$56, $29/$58 and $32/$64 per M (input/output). Real cheap turns (`openclaw agent … --model openai/gpt-5.4-mini`) completed with reply `ok` after each adoption. One turn on the final build hit a retryable agent-database admission error from the session-state layer, about 30 s after adoption. It is unrelated to the catalog, and the immediate retry succeeded.

Local review: `codex review --base origin/main` (model gpt-6-astra), round 1: "No actionable defects were found."

Merge danger: a two-way door. No stored state, schema, config or protocol changes, so a revert fully restores the previous behavior. Blast radius: every Gateway that adopts a downloaded hosted catalog. If this is wrong, adoption could stall behind a hung provider discovery. That wait is still bounded by each provider's own discovery timeouts and is cancelled by supersession, config reload or shutdown. Meanwhile the previous catalog keeps serving.

Co-authored-by: Ayaan Zaidi <[email protected]>
steipete added a commit that referenced this pull request Oct 11, 2026
## What Problem This Solves

Agent runtime bookkeeping repeatedly restarted otherwise valid work when configuration, plugin, or catalog metadata changed during an asynchronous operation. This maintainer-requested simplification removes that speculative retry machinery.

## User Impact

Normal model selection, tool execution, credential checks, FIFO scheduling, and shutdown settlement remain. A request racing a reload may fail visibly and be retried by the caller; passive metadata may remain at its captured version until the next refresh. No configuration, protocol, SDK, schema, durability, retention, or permission contract changes.

## Why This Change Was Made

Prepared runtime acquisition and remote catalog adoption now take one preparation path rather than repeatedly rebinding and rebuilding. Admission still handles the concrete drain, retirement, and failed-activation recovery stages. Cache publication keeps its final currentness check; tool and credential effects keep their authority checks. Steering and Tool Search retain their actual owner, FIFO, and settlement contracts without comparing unrelated metadata.

Production: **519 net lines removed**. Tests that exclusively required the removed synthetic interleavings were removed with them. Open-parent borrowing, pending-auth cancellation, explicit MCP acquisition config, and queued-tool implementation checks remain. No new lint suppressions, timeouts, retries, or skips were added.

Scope proof also caught two nearby correctness issues: an earlier MCP reload could overwrite a new caller's explicit configuration, and snapshot reconciliation could prepend a separator to a later text block. Both are fixed with their existing boundary tests. Bootstrap fixtures now test the no-clobber fallback already shipped by the pinned fs-safe version; no dependency or storage policy changed.

## Best-effort tradeoffs accepted

| Removed guard | Provenance and accepted result |
| --- | --- |
| Per-batch context projection cancellation | #119607 measured the value of cooperative yielding; its mid-batch cancellation callbacks were synthetic coverage. Yielding and the final publication check stay; obsolete pure computation may finish unused. |
| Mixed-version module/cache repair | #119607 seeded an old global singleton inside a synthetic process. Normal upgrades restart the process; unsupported mixed-version module replacement no longer repairs that marker. |
| Runtime acquisition retry/rebind loop | #128138/#127217 exercised forced reload timing. A racing request now returns a visible supersession error; the next request uses the current owner. The actual no-spin incident in #153313 remains addressed. |
| Configured-generation re-admission | 171df4e / #168410 adds re-admission for a gated Docker reproduction with a catalog publication 0.3s after admission, not a human-user incident. A superseded request now fails visibly. Parent confinement remains fail-closed, with its security test retained. The retry-only WeakSet and two retry-specific tests are removed. |
| Repeated passive owner selection | a718c1c / #162484 added recursion alongside the real self-drain fix; that incident did not require recursive reselection. The self-drain refusal stays. Reads use one captured owner or fail visibly, rather than recursively trying later publications. |
| Remote catalog config reread/per-attempt cancellation | #158000 used synthetic config/auth churn. Adoption reads once and prepares once; an overlapping change can defer adoption until the next normal catalog check. |
| Parent-generation cancellation subscriptions during adoption | 504d290 / #158000 used the same synthetic churn. Parent replacement may leave bounded preparation running until its final owner/config check rejects it. Shutdown cancellation, candidate-retirement aborts, cleanup, and the final serialized effect check remain. |
| Three-attempt catalog adoption settlement recovery | The same synthetic churn caused a second retry protocol around owner publication. One attempt remains, with one final checked atomic rows/pricing commit. |
| Duplicate early publication checks/error relabeling | Same-tick checks and concurrent-change relabeling did not guard an effect. The final effect check stays; failures retain their actual reason. |
| Auth-batch sibling retry after supersession | f3c52bd / #152467 used synthetic tests that superseded one owner during a sibling build. The operation now settles with its original error instead of selectively rebuilding siblings. Credential authority checks remain. |
| Post-await cache-stale generation check | No human incident supports fencing this metadata flag. A config/auth change during discovery can let the older load clear a reused owner's stale marker; discovery may remain stale until another explicit refresh/reload. This does not grant credentials or execution authority. |
| Passive harness catalog cancellation | #134524 fixed the actual availability report #134460; replacement/closure guards were additional synthetic hardening. Completed discovery rows are retained, and later discovery observes replacement. |
| Native binding clock-only rechecks after worker waits | #158396 used clock-jump fixtures. An expired but unreplaced exact row can finish its prepared bookkeeping mutation; CAS takeover detection and current mutation authority still gate commit. One exact, unexpired lease check gates protected callback entry, and live effect assertions remain. |
| Tool Search ancestor reentrancy tracking | #140767 covered synthetic nested control calls, not a reachable production control target. FIFO/exclusion and real implementation settlement remain. |
| Complete steering metadata fingerprint | #163195 recorded a real production ordering/ownership incident. Its owner, pending-row, result-authority, and lease checks stay; metadata-only edits no longer invalidate already-captured prompt bytes. |
| Repeated MCP acquisition/reload replay | #138694 used synthetic crossed-publication choreography. A new runtime catches up once; later reloads target the published owner. A racing creation can fail and reconnect on the next acquisition. |
| MCP tools/list invalidation generations and replay | #125541/#125564 describe isolated protocol stress fixtures. A notification inside tools/list no longer triggers immediate replay; the next notification or explicit refresh replaces the inventory. Normal exit/reconnect, bounds, validation, and cleanup remain. |
| Failed-start replay crossed by config publication | #158088's test forces a config publication into an in-flight failed initialization. That request may now report its first failure; ordinary backoff and explicit-refresh retry remain. |

## Evidence

Candidate head: `d72afea0c17a45c677977e23937049d7c7fc43ec` (tree `51daca08d7288e906188bc25ec3d1896bf841349`).

Final exact-head CI: [run 38132644989](https://github.com/openclaw/openclaw/actions/runs/38132644989) completed successfully; all 82 jobs terminal with no failed or cancelled jobs. Full head-bound check census also confirms the CI gate and applicable security checks passed. Earlier failed/cancelled attempts are described below, not represented as passing proof.

- Independent P2 reviews completed. The catalog-staleness, duplicate steering metadata fingerprint, and auth-sibling retry findings are explicitly accepted tradeoffs listed above; steering result facts and destination eligibility remain checked at their owners. The latest native-lease callback-entry finding was accepted and fixed with one live lease check instead of restoring per-write expiry callbacks. Its new fake-clock regression failed before the fix by entering the protected callback after expiry.
- Conflict-only integration kept main's three repaired test fixtures byte-for-byte. All **22 conflict tests** passed (cursor, sandbox, bootstrap publication, lint suppressions); affected root/tools test graphs, core types, typed lint and both cycle checks passed. Runtime and Madge cycles remain **0**.
- The native callback-entry fix passed fresh P2 review and **24 focused tests** (21 native binding tests plus 3 lint-suppression tests), wrapper 212.01s; native test project 164.77s including 113.11s compiled-worker preparation. The added fake-clock case performs no real wait; the existing native suite exercises authority and worker settlement. Final affected types and typed lint are checked before push.
- CI run `38125430266` found one owned stale expectation: the remote-catalog integration still forced config/auth replacement while pricing was paused and demanded the removed immediate retry. Only that scenario was removed; both schema variants retain normal publication, pinned pricing, input validation, worker recovery and disable coverage and pass locally (141.35s project), with gateway test types, typed lint, lint suppressions (3/3), and fresh P2 review passing.
- The other root failure, `checks-node-changed-compact-small-11`, independently reproduced on clean main `fd1fd2ce0ef8cb7e9c4074c8f855eff8992a54c2`: `embedded-agent-runner.prompt-cache.test.ts` responses and in-history both raised `SqliteTranscriptMutationConflictError` in the session actor append path (2 failed / 2 passed). Investigation found a cold actor snapshot prevented the existing implicit-watermark retry. Fixed directly on main as `e65bd3be4134f1453bb4ab26e68704c678086b58` and integrated here: all 4 prompt-cache cases and 35 session-manager siblings plus lint-suppressions pass, including explicit stale rewrite refusal. The repair passed types, typed lint and fresh P2 review.
- Follow-up CI `38127338915` reached one more synthetic-only case: compaction's `mutate=input` row changes an internal selection object after starting acquisition. Removed only that row/branch under the campaign rule; five remaining compaction cases pass, along with lint-suppressions, affected types, typed lint and fresh P2 review. Its provenance is `c131ec041e1` / #139429, not a human report of post-call input mutation. The final conflict repair keeps main's equivalent streaming/steering refactors, removes the obsolete retry predicate, and passes 49 owner tests plus lint-suppressions. Cancelled jobs are not counted as passing; final-head hosted CI remains the gate. No CI job was rerun.
- CI `38130432441` had one inherited fixture failure: three `sessions-mutations.catalog-queue` cases selected their configured default while expecting override fields, after #169030 intentionally made that selection a default reset. Integrated main's existing fixture-only correction `194a08e59632`, retaining all assertions. The corrected file passes all 14 cases on clean main under Node and Bun; the three affected cases also pass under Bun on this branch (249.87s project, mostly transformation). Exact-head hosted CI remains the final gate.
- Focused effects suites: **43 passed** across inbound-registry, remote-publication, hot-reload-dispatch and tool-search-scheduling. This includes cancellation, parent confinement, ordinary rollback/failed-activation recovery, and queued implementation replacement. Single-worker wrapper 752.15s including 142.017s compiled-worker preparation; infra 432.15s and agents-core 115.09s. Final restored remote-publication file: **7 passed**, including first reply crossing catalog adoption and exact derived-parent confinement; wrapper 372.77s (184.30s worker preparation; 131.87s Vitest). These loaded-host timings are not a performance claim.
- Integrated native-binding suites: **20 passed**, including exact token cleanup, successor protection, and revocation. The same command passed all **3 lint-suppression tests**. Single-worker wrapper 354.47s including 145.31s worker preparation.
- Current core types and native-binding test graph passed; runtime cycles **0**, Madge cycles **0**; changed-file typed lint passed. The full changed-check run reached an old-base UI duplicate-import error already fixed on main by `48588a65222`; that fix was integrated and the affected UI graph passed. Remaining type graphs and static guards were completed separately without changing baselines.
- Isolated Linux scope run and canonical remaining projects exercised **19,900 passing tests**. Eight failures were investigated: three pinned removed synthetic retry paths and were deleted; five exposed the correctness/fixture issues described above and were repaired with focused proof. Existing platform skips were unchanged. This is combined incremental proof, not a claim that one final-head all-scope invocation was green.
- Final repair suites: **71 passed** across passive runtime, SSE recovery, startup backoff, bootstrap, stream reconciliation/markup/phase coverage; **12 passed** across sandbox/cursor coverage, followed by **2 passed** for the real-append cursor fixture. Final MCP regression retained stdio-exit recovery and HTTP failure semantics; it passed 64 cases but hit two unchanged local child-start deadlines (1s/2s). Those initial-start paths passed on the isolated Linux run; no timeout, retry, or skip was changed to mask the local failures.
- Full-core Linux lint passed with 13 existing max-lines warnings, none in changed files. Deadcode identified and drove removal of the unused owner-publication helper. Remaining findings were in unmodified config/state/Gateway/UI files. A separate fresh current-main checkout (`f4d601a006`) passed production deadcode and failed full-tree deadcode only on the unrelated `readActiveGatewayLockPortMock` export. The PR does not change any deadcode baseline.
- Blacksmith Testbox did not admit a runner within 15 minutes; AWS quota pressure supplied an undersized instance, which was released. The authorized Hetzner fallback supplied the Linux proof above. All owned remote leases are stopped. Hosted CI on the exact final head remains the landing gate; no CI jobs were rerun.

<details>
<summary>Audit coverage ledger and retained boundaries</summary>

| Mechanism (base lines) | Scenario and provenance | Decision |
| --- | --- | --- |
| context-cache-projection.ts:145-213, context.ts:87-109,146-169 | Cancellation/replacement during pure batched metadata computation. bf7840f / #119607 fixed a measured multi-second RPC stall by yielding and atomic publication. Mid-batch authority callbacks were extra cancellation machinery; no effect occurs in projection. | REMOVE repeated projection/early checks; KEEP cooperative yields and the caller's check immediately before publication. |
| context-runtime-state.ts:33-38 | bf7840f / #119607 seeds an old global singleton and new cache module in a synthetic child process; no human report of mixed code versions within one live process. | REMOVE old-module/cache-pair normalization, its only reuse flag, and the synthetic migration test. Ordinary process startup and same-version bundled singleton sharing remain. |
| prepared-model-runtime-lease.ts:149-164 | 8720fbf / #153386. Human report #153313 by stackingrockss includes the deployed Docker version, profiler samples, and repeated boot-loop observations. Its infinite retry was caused by non-idempotent runtime selection normalization. | KEEP normalized owner selection and a visible error when a settled replacement never published; REMOVE the acquisition retry loop entirely, so it cannot spin. |
| prepared-model-catalog-worker.ts:71-220 | 349aef7 / #150354. Human report #149538 by 609NFT describes copied production fleet state, 632 agents, 504 failed health probes and growing RSS. #161738 by matthematics1137 reports 92 worker lifetimes, OOMs and 1.285 TB written. | KEEP one bounded shared worker, borrower cleanup, failure logging, and ordinary crash recovery. These are measured resource and real concurrency contracts, not permission to retain unrelated reload fences. |
| prepared-model-runtime.refresh-scope.ts:240 | d56279c / #151597 by obviyus describes a controlled worker crash and synthetic Gateway regression, not a human production report. Later #161738 independently establishes actual recurring worker failures. | KEEP source-bound failure reporting and bounded recovery to avoid reintroducing the observed restart/discovery amplification. The #151597 PR alone is not accepted incident evidence. |
| prepared-model-runtime.resources.ts:30-127 | 73b4086 / #143109 contains native regressions and synthetic compiled CLI/Gateway proof, no linked human incident. | KEEP physical resource claims until ordinary concurrent borrowers settle and shutdown joins their cleanup; these are required cleanup mechanics, not a blanket historical-incident exemption. Inspected the complete resource owner; no extra reload retry protocol lives here. |
| prepared-model-runtime.plugin-lifetime.ts:230-319 | 382c987 / #159448 links #157842 by highfly-hi: five-agent Linux deployment with catalog-worker heap increasing 70-80 MB per scheduled turn, watchdog restarts and before/after version evidence. | KEEP final registry-reference release, current execution authority, and ordinary borrowed-resource settlement. Retained memory claims are scoped to physical lifecycle, not all historical publication machinery. |
| prepared-model-runtime.lifecycle.ts:101-164 | a718c1c / #162484 by jalehman records actual lossless-claw maintenance calls stuck about 45 minutes during reload until restart. a3e4005 / #162301 explicitly says synthetic Gateway, no production deployment. | KEEP refusal of plugin work waiting on its own drain and process-close settlement. #162301 is synthetic evidence, not an independent incident exemption. |
| prepared-model-runtime-lease.ts acquisition loop and borrowed-generation branch | 79e6755 / #128138 and related #127217 describe synthetic QA-channel/config replacement tests; #127217 explicitly reports that its pre-fix real-Gateway run still delivered replies. Retained inbound-registry tests exposed ordinary nested selected-parent borrowing as a distinct contract. | REMOVE retry/rebind loop. KEEP exact open-parent borrowing and selection confinement; a reload during new acquisition may fail that request visibly. |
| prepared-model-runtime.published-owner.ts:91-203 | a718c1c / #162484 added retry/recursive rereads alongside the real plugin-drain repair. That incident justifies self-drain refusal and ordinary settlement, not recursive passive owner reselection. | REMOVE repeated rereads/retries; wait once, then project or activate once. Pure catalog-stale bookkeeping no longer revalidates generation after its await. |
| prepared-model-runtime.configured-refresh.ts remote catalog adoption | 504d290 / #158000 has explicitly synthetic config/auth churn and fixture-provider proof; no human incident cited for the reread loop, per-attempt controllers or three-attempt owner settlement recovery. | REMOVE those race-specific retries, plus early duplicate currentness checks/error relabeling. KEEP the final owner/authority check, atomic rows/pricing commit, current catalog ordering, and ordinary cancellation/disposal. |
| prepared-model-runtime.configured-refresh.ts:396-430 parent subscriptions | 504d290 / #158000; same synthetic churn proof. Parent-generation subscriptions duplicate the final owner/generation/config check. | REMOVE parent-generation early cancellation listeners. KEEP shutdown and candidate-retirement cancellation, bounded work, cleanup, and the final serialized effect check. |
| prepared-model-runtime.owner.ts:612-631 batch supersession retry | f3c52bd / #152467. Tests force one auth owner to supersede while a sibling is building. No independent human incident identified for sibling retry. | REMOVE retry of the surviving batch; retain source-bound credential/current-owner checks and report the original publication failure. |
| prepared-model-runtime.owner.ts:124-134 unused publication probe | dd2d66c / #130856 introduced a helper returning matching/pending publication facts for acquisition retries. Its callers are gone; full-repository search finds only the definition. | REMOVE the dead helper/export. Credential-refresh cancellation remains supported by the direct, abortable configured-owner wait and its unchanged regression tests. |
| sandbox/registry.kernel.ts:396,420; sandbox/registry.ts:295 | 2889a99 / #151172 is not treated as an incident report. Read-only admission accepts older schemas; tableExists consumes admitted schema.tables facts, not repeated SQL/format validation. | KEEP the existing absent-table empty/null contract. No runtime foreign-commit or repeated validation probe exists in these calls. |
| harness/native-session/binding-leases.ts | cfef174 / #158396 moved writes to workers; elapsed-time rechecks were covered by synthetic clock-jump tests. 283d5e6 / #164197 supplies native successor authority behavior, not a blanket exemption. | REMOVE prepared callback plumbing and post-worker wall-clock-only rechecks. KEEP exact-row CAS, token/phase/failure checks, current mutation authority, bounded acquisition, renewal, and write settlement. |
| harness/context-engine-logical-turn.ts | #143491/#140023 supply synthetic lifecycle tests, not qualifying human incident evidence. The owner actually holds resources used by outstanding context-engine work. | KEEP ordinary work completion and deferred disposal until implementation settlement; no extra synthetic reload retry was retained here. |
| harness/model-catalog.ts:168-177,242-284,353 | 6c44634 / #134524 repairs human availability report #134460. Passive replacement/closure branches were additional maintainer hardening and synthetic variants, not that report's failure. | REMOVE passive isCurrent callbacks and ambient registry replacement checks. KEEP exact owned registry/config, provider outcomes, discovery, selection and the actual availability repair. |
| auth-profiles/oauth-refresh-peers.ts | #166183/#167002/#166659 are not claimed as human incident evidence. Refresh credentials rotate/revoke and carry account identity; copied historical peers must not replay spent tokens or inherit another account. | KEEP these credential/identity effect boundaries and ordinary uncertain-write settlement. No auth-profile schema, secrets, permissions or durability changes. |
| worktrees lifecycle/removal | Audited run-lease-owner.ts, service-preparation.ts, eviction.runtime.ts and gc-removal.ts. They coordinate destructive removal of user artifacts with live checkout/source handles, exact refs and ordinary parallel sessions. No PR title is treated as incident evidence. | KEEP current-row removal/exclusive source checks and rollback/cleanup custody for writes and deletion. Removing them would risk user artifacts, independently prohibited by the data-loss boundary. |
| tool-search-scheduling.ts | 9b93fc8 / #140767 adds ancestry reentrancy and queued object/mode identity checks with automated interactive/headless regressions. Production catalogs exclude control tools; recursive calls using the same runtime were synthetic only. | REMOVE unreachable nested-call ancestry. KEEP one exact queued implementation/mode check at the effect, catalog-ID authorization, FIFO/exclusion, abort and implementation settlement. |
| agent-steering-queue.ts:194-263 | 3f761a8 / #163195 records Peter's actual three-day production errors. The incident justifies owner/FIFO repair, not a fingerprint of every result label/task/time/outcome/origin/transcript field. | REMOVE full payload fingerprints and deep-equality invalidation. KEEP run-owner identity, prepared result authority, current requester store, pending-row effect checks, FIFO, exact lease/status acknowledgment and release. |
| agent-bundle-mcp-manager.ts and manager-install.ts | 89c1a09 / #138694 reports synthetic fail-before/real-transport proof but no cited actual-use incident for repeated crossed-publication acquisition/reload. | REMOVE the acquisition retry/rebind loop and repeated reload replay. KEEP the runtime-key queue, ordinary cleanup, one postcreation config catchup, requester credentials/authorization and live tool effect checks. |
| agent-bundle-mcp-runtime.ts catalog generations | 1cf8ea4 / #125564 and follow-up 1d03e5d / #167642 have synthetic notifications/listing interleavings, not human reports for replaying tools/list during its own response. | REMOVE catalog invalidation generations, replay of a notification arriving inside tools/list, and the impossible repeated replacement-retirement loop. KEEP listing single-flight, caching, bounds, diagnostics, normal reconnect, one retry for an actually exited previously healthy server, and execution authority. |
| prepared-model-runtime-lease.ts / plugin-lifetime.ts configured-generation re-admission | 171df4e / #168410, landed during this lane, describes a gated Docker reproduction with catalog publication 0.3s after admission, not an actual human-user incident. | REMOVE configured-generation retry and its now-unused WeakSet plus the two retry-only tests. KEEP fail-closed superseded-generation rejection and the new derived-parent confinement security test. |

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation extensions: deepinfra gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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.

2 participants