Repository navigation
fix(models): preserve first chats during catalog updates - #167492
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe branch retains admitted model generations through chat, scheduled-task, and Gateway preparation while isolating older native observations from newer catalog publications. Example: A user sends hello while catalog 300 replaces catalog 200
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still exposes the preparation race, and the related open repair does not supersede its broader coverage. No actionable introduced defect was found. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway publishes model choices, credentials, and plugin registrations for conversations and scheduled tasks. A retained runtime lease keeps those admitted facts available until preparation and execution finish. flowchart TD
A[Chat or scheduled task] --> B[Published model generation]
B --> C[Retain admitted generation]
D[Hosted catalog update] --> B
C --> E[Prepare selected model]
E --> F{Lease and run remain active}
F -->|Yes| G[Execute with admitted facts]
F -->|No| H[Reject and release resources]
G --> H
Technical reviewBest possible solution: Keep preparation custody in the existing publication and scope owners while preserving independent run authorization and isolation from replacement publications. Do we have a high-confidence way to reproduce the issue? Yes: capture dispatch on catalog 200, publish catalog 300, then acquire the selected-runtime lease using the captured generation. Current-main source establishes the rejection window, and the body reports matching failing Gateway runs; this review did not execute it. Is this the best way to solve the issue? Yes: synchronous retention repairs the ownership gap without rebinding admitted turns, adding retries, or weakening exact-snapshot borrowing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 62355575c041. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +186, Tests +439, Docs +4, Other -2. Total +627 across 25 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 9, 2026, 12:27 AM ET / 04:27 UTC (Revision 3). |
Retain admitted generations across reply, cron, and Gateway preparation. Let selected native observations finish under their live turn lease without publishing over a replacement catalog, while preserving revocation fences. Keep the repair in existing runtime owners and preserve the first-turn, canonical-config, cleanup, and native-observation regressions. Refs #167492.
e7019bf to
9940f0f
Compare
Retain the published dispatch generation before asynchronous reply, cron, and Gateway workspace preparation. Allow selected native discovery to finish under the live run lease without publishing over a replacement catalog; preserve closed-lease, revocation, and shutdown fences. Selected release adaptation of #167492. Preserve the release's configured provider eligibility, admission API, and existing session preparation owner. Carry the coherent catalog-source extraction and test-owner relocations. (cherry picked from commit ec7c8bb)
…7492) * fix(models): preserve first turns during catalog updates Retain admitted generations across reply, cron, and Gateway preparation. Let selected native observations finish under their live turn lease without publishing over a replacement catalog, while preserving revocation fences. Keep the repair in existing runtime owners and preserve the first-turn, canonical-config, cleanup, and native-observation regressions. Refs openclaw#167492. * fix(models): preserve typed runtime supersession errors
What Problem This Solves
Fixes first chats and Telegram introductions being refused before inference when a Gateway adopts a hosted model catalog newer than its installed build.
User Impact
A turn that has admitted a model generation retains it through preparation and inference; later turns use the replacement generation. Native observations from an admitted turn cannot overwrite the newer publication. Closed leases, run revocation, cancellation, shutdown, and stale unborrowed readers remain fenced.
Why This Change Was Made
This revision removes all three new production modules from the earlier patch. Retention stays in the existing published owner, borrowing/close handling is shared by the existing generation-scope owner, and native observation stays in catalog access. Existing inventory selection moved into the existing catalog-source owner to satisfy the unchanged 700-line limit. The separate test-support module is also removed.
Comparison against the same current base (
674275e3808e):The reduction removes 61 lines of production growth. The reduced implementation had 24 changed files; the typed-error follow-up adds one assertion in an existing registry-borrow test, bringing it to 25. Two existing tests now live in their existing entrypoint files: the line-growth guard rejected adding their lease expectations to already oversized helpers. Their bodies are byte-identical and use the same reset hook. The original published head on its older base measured +354/−106 production lines.
The remaining pieces protect these contracts:
delivers the first reply when catalog adoption retires its captured dispatch publicationretains runtime custody and emits session creation with %s preparation(both cases)carries the admitted config into execution while preserving agent overrides;admits the published generation and keeps it active through embedded execution;releases the prepared lease when continuation initialization failskeeps native selection bound to its admitted lease(before/during retirement, closed lease, revoked run, shutdown); stale unborrowed and replacement-publication assertions remainrejects native readiness that retires its owner;renews native observations without retaining harness-only host projectionsdoes not reuse a dynamic build captured before a remote publicationHistorical comparison isolates the live-adoption trigger in #158000: parent
f3f02417f117passes the unchanged Telegram case and defers the downloaded catalog until restart; child504d2905d69capplies the same eligible catalog and refuses the introduction. The earlier unleased handoff predates that trigger.Evidence
No new modules, retries, longer timeouts, weaker assertions, suppressions, dependency changes, or CI jobs were added. The mock-export baseline shrinks by two obsolete exceptions. The moved-test replay took 36.58 seconds through the repository wrapper (34.98 seconds Vitest); test count and file selection are unchanged. Linux proof uses Testbox, with the unfinished pressure/build work continued on the authorized AWS fallback. Completed runs were preserved. The existing qualified baseline and historical evidence were reused; changed implementation inputs received fresh proof.
Typed supersession follow-up
The stale explicit-generation guard now preserves
PreparedModelRuntimePublicationSupersededError, includingadmissionBlocked: false, when cancelled initial registry inspection settles. The catalog-progress tuple allowed cancelled construction to reach this guard, where the broader owner-not-published superclass had replaced the expected subclass. The production correction changes one constructor; the existing test retains every assertion and additionally checks the admission flag. Admission, replay, custody, cancellation, and disposal behavior are unchanged.The registry-borrow file failed 1/4 before and passes 4/4 after, including its Linux execution in the whole infra config. The original quota-reset and Telegram-introduction E2E pair passes 10/10 with the build timestamp older than the hosted catalog. The three other CI-selected E2E invocations also pass.
The requested broad proof is complete:
All 24 additional CI-selected rows were replayed (72 plans): all 66 Node invocations passed. Six Bun selections passed; one failed from the base-proven heartbeat issue below. All 35 unique check-changed steps passed across the original invocation and continuation, including production types, all 27 selected test-type graphs, lint, boundary lint, formatting, and deadcode. Direct-API P2 review of the exact follow-up is scoped-clean (0.96). Prior architecture, source-contract, build, pressure, and reduction evidence remains valid for unchanged inputs.
Three unrelated failures were reproduced on clean base
674275e3808e, without weakening assertions or changing unrelated source:src/agents/compaction-planning-worker.test.ts:458: base 29 passed / 1 failed; the elapsed timeout is fractional (2146999999.995321) while the assertion requires integer2147000000. Command:node scripts/run-vitest.mjs src/agents/compaction-planning-worker.test.ts.src/gateway/server-methods/chat-send-global-identity.test.ts, Bun 1.4.2: candidate 14 passed / 9 failed; clean base 11 passed / 12 failed, with the same state-ownership refusal and heartbeat expiry.process.hrtime.bigint()has different parent/Worker origins in Bun, so a new heartbeat Worker in an older process appears stale. The heartbeat producer is99fccf43358c(fix: preserve Gateway ownership with separate Docker CLI containers #164236). The corresponding Linux Node clock probe is coherent. This separate supported-Bun production defect needs a follow-up.src/hooks/bundled/session-memory/capture.test.ts: clean base reproduces the exact oversized-conversation case in its first normal run (41.96s, no pressure). Its raw corruptionUPDATEat line 53 races the reconcile owner's later orphan-sweep write after projection readiness; the fixture producer isd94fe35027e7(refactor(sessions): move transcript reads to retained history owner #166293).No follow-up test or source edit occurred after the successful review. Auto-merge remains coordinator-armed; this update does not request a manual merge or CI rerun.