Repository navigation
perf(auth-profiles): offload peer settlement and catalog reads - #166183
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. |
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: blocked before merge. Reviewed October 8, 2026, 2:19 PM ET / 18:19 UTC (Revision 15). ClawSweeper reviewWhat this changesMoves OAuth peer updates, shared credential initialization, and personal model-catalog reads into existing database workers while reducing repeated SQLite reads. Warning SQLite table change This PR modifies persisted SQLite tables in Review scores
ProductKind: Performance · Worth it: Yes Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-authored PR retains useful work beyond main. The previous conflict and compatibility concerns are addressed, with no concrete introduced correctness or security finding identified. Priority: P2 Before merge
FindingsNone. Provenance
Agent review detailsHow this fits togetherOpenClaw’s credential subsystem supplies saved accounts to model selection and coordinates OAuth token refresh across agents. Database workers prepare credential facts and settle writes, while the Gateway publishes results under current caller authority. flowchart TD
A[Model selection or token refresh] --> B[Capture caller and database identity]
B --> C[Existing database workers]
C --> D[Read accounts or compare credential]
D --> E[Check current authority]
E --> F[Commit credential changes]
F --> G[Publish acknowledged snapshots]
D --> G
Technical reviewBest possible solution: Complete the existing worker cutover while retaining exact credential comparisons, physical-store custody, current authority, and acknowledged-write settlement. Do we have a high-confidence way to reproduce the issue? Not applicable as a discrete bug reproduction; the recorded paired Gateway workload exercises the database work being moved and reduced. Is this the best way to solve the issue? Yes: the change extends existing database owners and removes the superseded retention reader rather than introducing competing persistence ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d60f85fb9771. Provenance checked
TestingProof path: shipped entry point. Added test files: 27. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: 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 (14 earlier review cycles; latest 8 shown)
|
Merge main to include the catalog export correction and current runtime owners. Bind the Doctor catalog fixture to its selected state root, and observe the bootstrap worker request separately from live physical identity checks. Reuse the existing read-only worker scope for each generation-peer scan while preserving fresh per-request admission, physical identity, and cleanup. The copied-generation test keeps its 10-second deadline and all behavior assertions. Validation: isolated Linux head/base reproductions, five corrected OAuth runs, Doctor and bootstrap suites, adjacent peer recovery and Gateway close tests, worker/import boundaries, production and core test types, and zero madge cycles. Fresh P2 review is clean; the final test-only typing correction removes an unnecessary generic payload read and passes the full core test type lanes. Release-note context: OAuth peer persistence and personal model catalog reads move off the Gateway caller thread without schema or released SDK changes.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Merge main's admission and locked-transcript updates while preserving the auth worker cutover, physical peer custody, and cold post-catalog freshness check. Retain both worker-owned retention reuse and real foreign-write invalidation, and preserve bounded Gateway history pagination and older-message reachability. Extract unchanged personal-account reader commands into a typed worker helper and reuse the existing Gateway session fixture owner to satisfy size guards. Production and affected test types, import cycles, lint, format, and ratchets pass on the integrated tree. Fresh P2 review completed; its obsolete-peer cleanup finding was rejected against the full owner/recovery contract. The final local runtime batch passes 22 selected tests across nine files. Fresh SQL, SDK, and remaining isolated proof stay landing preconditions.
Merge main's generalized TEMP tracking and newer-schema diagnostics. Preserve read-scope revision reuse while using the current tracking owner API, and keep the cold post-catalog freshness check and main's post-restart admission fix. The complete introduced PR delta has a fresh clean P2 review. Post-integration type, cycle, and static proof is recorded against the resolved tree. Focused runtime, strict matched SQL, local SDK, and exact-head CI remain landing gates.
Read catalog objects and the published user version in one pinned compound query. Keep a separate version row for empty catalogs, the native fallback for operator objects that shadow the table-valued PRAGMA, and the post-catalog freshness probe that refuses peer upgrades before data reads. Use a compound SELECT to avoid a SQLite 3.53.4 native column-metadata crash observed with the joined form. The former query crashed in five full-file runs while the prior implementation passed all five; the compound form passes five full 45-case runs and all 121 tests in the five owner suites. New metadata budget regressions fail with the former two-read implementation. Fresh P2 review is clean. The exported declaration surface is unchanged from the completed SDK report. Strict full-workload remeasurement remains a pre-publication gate; no prior failed samples or phase windows are excluded.
Keep changed Inbox snapshots atomic, but return after the existing head read when its revision is unchanged. Retain the initial snapshot path and reread changed heads inside the transaction before loading sources. Restore separate native schema metadata reads after the combined-query optimization exposed SQLite crashes on Linux. Preserve cold freshness, authorizer, rollback, and upgrade checks.
Merge main into dbasync/w6auth, preserving async OAuth settlement, readonly admission, and the retained maintenance history reader. Retain canonical schema contracts and main's session/history changes. Keep bounded helpers in existing owners and align the schema observer with the native data-version query without changing expected counts.
Merge main to resolve concurrent session cleanup and shared-state reader changes. Preserve both history operations and forward the content-version reader through both cold and warm admission, retaining the fresh barrier.
|
Merged via squash auto-merge.
|
…law#166183) * perf(auth-profiles): offload peer settlement and personal catalog reads * perf(auth-profiles): reuse existing peer database admission * fix(auth-profiles): settle captured peers after uncertain fencing * perf(auth-profiles): reuse admitted schema facts for paired reads * test(gateway): preserve fixture owners and verify oversized history * perf(auth-profiles): set reader busy policy during native open * test(gateway): complete persistent fixture cleanup ownership * fix(auth): admit replaced OAuth peer databases Retire a retained validation receipt for a different physical file before a new native opener captures its publication guard. The new worker still performs its normal admission, and revocation after capture still refuses publication. The physical-replacement refresh regression failed five times on the PR and passed five times on main. Existing integrity and reclamation suites pass after the repair; no SQL, schema, or public API changes are added. * perf(trajectory): reuse admitted maintenance readers Read retention aggregates through the existing maintenance lane so stale sweep retries do not repeatedly open and admit snapshot helpers. Keep the full read outside the canonical writer reservation, with captured physical identity and current authority checks. Retain the writer begin/delete operations, lease fences, retry bound, retention policy, and scaled inspection budget. Remove the superseded helper operation and extend the existing append-during-read and cleanup coverage. * perf(sessions): reuse admitted maintenance revision facts * perf(state): reuse cold reader schema admission facts * test(gateway): preserve store selection during fixture reset * test(auth-profiles): drain fixture workers before peer repair * test(state): align retained-reader SQL budgets * perf(sqlite): combine catalog admission metadata reads Read catalog objects and the published user version in one pinned compound query. Keep a separate version row for empty catalogs, the native fallback for operator objects that shadow the table-valued PRAGMA, and the post-catalog freshness probe that refuses peer upgrades before data reads. Use a compound SELECT to avoid a SQLite 3.53.4 native column-metadata crash observed with the joined form. The former query crashed in five full-file runs while the prior implementation passed all five; the compound form passes five full 45-case runs and all 121 tests in the five owner suites. New metadata budget regressions fail with the former two-read implementation. Fresh P2 review is clean. The exported declaration surface is unchanged from the completed SDK report. Strict full-workload remeasurement remains a pre-publication gate; no prior failed samples or phase windows are excluded. * perf(gateway): skip unchanged mention snapshot transactions Keep changed Inbox snapshots atomic, but return after the existing head read when its revision is unchanged. Retain the initial snapshot path and reread changed heads inside the transaction before loading sources. Restore separate native schema metadata reads after the combined-query optimization exposed SQLite crashes on Linux. Preserve cold freshness, authorizer, rollback, and upgrade checks.
## 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>
…168981) ## 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 | openclaw#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 | openclaw#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 | openclaw#128138/openclaw#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 openclaw#153313 remains addressed. | | Configured-generation re-admission | 8b13535 / openclaw#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 | d92dc37 / openclaw#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 | openclaw#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 | 27a0f6d / openclaw#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 | 4616d20 / openclaw#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 | openclaw#134524 fixed the actual availability report openclaw#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 | openclaw#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 | openclaw#140767 covered synthetic nested control calls, not a reachable production control target. FIFO/exclusion and real implementation settlement remain. | | Complete steering metadata fingerprint | openclaw#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 | openclaw#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 | openclaw#125541/openclaw#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 | openclaw#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 `8d45488ae2075bd14a50c881aff6e18c32182538`: `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 `0fa340c21f484740ec7b4ed1169b7b02439aa970` 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 `44d905388f9` / openclaw#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 openclaw#169030 intentionally made that selection a default reset. Integrated main's existing fixture-only correction `a8ef16f77650`, 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 `ef175b247c9`; 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 (`401216ac50`) 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. 0dd154f / openclaw#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 | 0dd154f / openclaw#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 | 9505286 / openclaw#153386. Human report openclaw#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 | 9d58cf2 / openclaw#150354. Human report openclaw#149538 by 609NFT describes copied production fleet state, 632 agents, 504 failed health probes and growing RSS. openclaw#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 | 3e7ca30 / openclaw#151597 by obviyus describes a controlled worker crash and synthetic Gateway regression, not a human production report. Later openclaw#161738 independently establishes actual recurring worker failures. | KEEP source-bound failure reporting and bounded recovery to avoid reintroducing the observed restart/discovery amplification. The openclaw#151597 PR alone is not accepted incident evidence. | | prepared-model-runtime.resources.ts:30-127 | d70d026 / openclaw#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 | 1233536 / openclaw#159448 links openclaw#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 | d92dc37 / openclaw#162484 by jalehman records actual lossless-claw maintenance calls stuck about 45 minutes during reload until restart. 1f3038b / openclaw#162301 explicitly says synthetic Gateway, no production deployment. | KEEP refusal of plugin work waiting on its own drain and process-close settlement. openclaw#162301 is synthetic evidence, not an independent incident exemption. | | prepared-model-runtime-lease.ts acquisition loop and borrowed-generation branch | 1977a39 / openclaw#128138 and related openclaw#127217 describe synthetic QA-channel/config replacement tests; openclaw#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 | d92dc37 / openclaw#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 | 27a0f6d / openclaw#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 | 27a0f6d / openclaw#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 | 4616d20 / openclaw#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 | e56f825 / openclaw#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 | 5c7e44c / openclaw#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 | b272376 / openclaw#158396 moved writes to workers; elapsed-time rechecks were covered by synthetic clock-jump tests. ffd0759 / openclaw#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 | openclaw#143491/openclaw#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 | 01fd244 / openclaw#134524 repairs human availability report openclaw#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 | openclaw#166183/openclaw#167002/openclaw#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 | 49f8d29 / openclaw#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 | 94acbe6 / openclaw#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 | 1d60d3d / openclaw#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 | 140dbbd / openclaw#125564 and follow-up 0818bcb / openclaw#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 | 8b13535 / openclaw#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>
What Problem This Solves
OAuth peer fencing and settlement, lazy shared-auth initialization, and personal model-catalog selection still performed SQLite work on the Gateway caller thread after the ordinary OAuth/save worker cutover.
This PR moves those operations onto the existing auth reader, agent executor, and shared-state writer. It captures physical database identity before waiting, preserves FIFO writes and peer locks, checks the exact credential inside the worker transaction, and publishes acknowledged facts through the snapshot owner. Accepted refreshes retain settlement custody through Gateway close; unknown outcomes are never replayed. Personal catalog links and credentials are prepared together under current caller/default-link authority, including canonical account aliases.
The accompanying performance repairs reuse the admitted trajectory-maintenance reader and session revision facts, avoid an unused maintenance snapshot, and reuse cold schema-admission facts while keeping an explicit fresh probe after catalog capture. Unchanged Mention Inbox snapshots now return after one atomic revision read; changed snapshots reread the head and sources inside their existing transaction. Initial snapshots keep the original path. The native catalog and version reads remain separate. Main's independently landed content-version cache from #166259 and fixed TEMP-tracker schema owner from #166698 are retained. Transactions, pinned snapshots, authorizers, foreign commits, native writes, rollback, replacement, and closure retain their validation and invalidation contracts. Auth reader construction keeps the existing 5000ms busy policy without a setup PRAGMA.
There is no introduced schema, stored-format, retention, permission, configuration-default, environment-name, or breaking released SDK change. Populated or unreadable legacy auth stores remain Doctor-owned. Provider-login/setup compensation remains deferred as described below.
Evidence
Current integrated candidate:
070e755979cebc0f45ec4dfbea151dd962780626, tree451c9d6a1085cf8e33117cb88294684ee4726839, merging mainff9e8818527accde219a9e4da9c7e0ea25a2f04cafter the reviewed3be88510integration. The subsequent three-file conflict resolution retains both trajectory and session-cleanup readers and forwards main’s optional content-version row reader through both admission paths. Conflict resolution preserves main’s extracted async OAuth failure owner, artifact-preserving read-only opener, and retained maintenance history reader, carrying the canonical schema contract through the surviving operation. The observer now recognizes main’s native data-version table query with exactly the same count expectation. Private helpers/types moved into existing modules to satisfy line caps; no new worker module or SQL was introduced. Full introduced-PR P2 review has no actionable findings on the first resolved tree (ba05bdc); the subsequent additive three-file resolution was inspected and preserves both sides. Production types, all 27 core test-type lanes, lint, formatting, all six ratchets, and zero-cycle madge passed on that reviewed tree. Its focused runtime proof passed 259 tests across 12 files (one platform-dependent skip). After the additive resolution, production types, the three affected test-type lanes, formatting, and zero-cycle madge pass; all five focused runtime suites pass (130 tests, 112.37 seconds wrapper wall time): canonical-schema validation, shared-state schema policy and retained connections, session readers, and cleanup readonly behavior. Per maintainer instruction, accepted paired SQL proof is reused after this source-audited integration.Measured candidate:
0269c7b85667aa3b60826c98fda91e36bc114b23, treee75704aecb0c53f89cd69e4f0d380ebfee8d2e9e. Integrated baseline:8204e9172e3825b0be0035ce2257f540fc26f715. All integrations are merge commits. The latest single import conflict retains main’s generalized TEMP tracking owner from #166867 and the PR’s read-scope revision reuse. Main’s newer-schema diagnostic fix from #166906 is preserved. Main's #165921 admission and locked-transcript changes are preserved, together with the PR's explicit cold post-catalog freshness check and snapshot/foreign-commit coverage. Worker metadata updates and a real foreign-connection replacement retain distinct retention tests. Gateway history coverage retains exact first-page bounds and older-message reachability.The final bounded extractions move unchanged personal-account reader commands into a typed worker module and shared history setup into the existing Gateway fixture owner; their wire, SQL, transaction, and fixture-lifecycle contracts stay unchanged.
SQL acceptance
The complete
0269c7b8versus8204e917cohort passes the coordinator-approved non-turn/combined-window rule. Boot+connect medians are 3073→3088 (+15, +0.4881%), below the +2% limit. Separate connection medians remain 338→354 (+16); the original strict per-phase failure is retained in the evidence. The excess is existing deferred startup/housekeeping work occurring within the connection window, not new per-connection requests. Its owners are plugin-state expiry, managed-image inventory, failed-delivery counting, device setup-completion pruning, and remote model-catalog refresh. This is background/bootstrap work, not a claim that all added statements are auth operations. These owners and their request paths are unchanged by this PR; all statements remain counted.The first-turn median improves 3795→3697, warmed statements per turn 1432.3→1405.3 (-27), control-plane 45→37, and total 30029→29578 (-451). Every other phase median, all ten individual warmed-position medians, and every original auth/cold case are non-increasing. All native calls, including prepares, have zero failures. The rejected ownership-row cache was never implemented; native-write visibility and all security/admission checks remain intact.
The unchanged shared harness retains five fixed pairs in order M1,C1,C2,M2,M3,C3,C4,M4,M5,C5, all original 16 auth operations and five cold-bootstrap cases per side, and every failed attempt. The first/warmed-turn gates remain strict; the explicitly approved non-turn tolerance applies to the combined startup window above. Original per-phase results, all individual warmed positions, and every auth/cold case remain reported. No workload, phase marker, sample, periodic task, or statement was excluded or changed.
Both prior cohorts remain recorded as failures under their original strict per-phase rule.
22f607c5versus8204e917increased boot by two statements and control-plane by one because the required fresh post-catalog probes remain.ac9836becombined metadata reads but still failed control-plane (42→45), despite boot 2739→2728, warmed statements/turn 1433.0→1414.9 and total 30054→29687. All ten warmed positions and all auth/cold cases passed; all ten fixtures were retained with zero failed native SQL executions. The additional control-plane SQL is an unchanged periodic delivery read occurring in more candidate samples; it remains counted.The combined metadata query also caused native SQLite crashes and has been completely removed. Trace inspection across all five pairs found one unchanged Inbox snapshot during boot, two during control plane, and three per warmed turn. The final owner repair removes their unnecessary transaction envelopes while preserving changed-snapshot atomicity. The complete measured cohort and explicit revised policy qualification above determine acceptance; projected savings alone are not proof.
Historical proof on
19a8cccdversuse73028f8passed every strict gate: warmed statements/turn 1553.8→1531.2, total 31904→31495, auth caller-thread 127→0/all-thread 127→78, and cold caller-thread 36→0/all-thread 36→34. Earlier failed cohorts exposed repeated retention-helper admission, no-op maintenance metadata work, and a one-statement connect increase; the owning repairs retained freshness, identity and transaction safeguards. Those samples were retained, with no window changes or exclusions. This earlier proof is historical after the required main integration; the fresh comparison above owns acceptance.Runtime and static validation
The new worker-owner regression first failed on the old implementation (two reads instead of one); both foreign-commit consistency cases already passed. After the fast path, all three cases pass: an unchanged revision uses one read and no transaction; a commit before BEGIN is reread; a commit after the transactional head read preserves coherent pinned sources. Test time was 181ms, with 104.97s wrapper wall time including 71.821s compiled-worker preparation. No new timers, Gateway boots, or production test seam.
The full introduced PR at
22f607c5passed P2 review, production types, all 27 test-type lanes, zero import cycles, and all six ratchets. The final Mention Inbox delta has a fresh clean P2 review. Production types, the gateway test-type lane, formatting, lint, and all six ratchets passed on frozen final source. The other 26 test-type lanes and zero-cycle result are reused from the identical owner inputs at22f607c5; there are no new production import edges. The diff still adds zero new environment names.Exact committed
0269c7b8passed five complete 39-case schema-facts repetitions on Linux Node 24.21.0, followed by 136 tests across six files: 104 database-owner cases, three new worker-snapshot cases, and 29 existing Inbox/sharing-target cases. All eight stages completed, source fingerprints matched the committed tree before and after, and every child process joined. Total command wall time was 271.382s. The changed-snapshot and requester/target revocation coverage remained intact.The discarded
ac9836bequery caused one Linux SIGSEGV after 94/110 completed owner cases. Five complete-file attribution runs produced four candidate SIGSEGVs and one 45/45 pass; the main baseline passed 39/39 in all five runs. Native diagnostics reached SQLite's compound-query preparation path. A fresh-prepare trial and a computed-join trial also crashed; none is retained in the final code. The four catalog-query source/test/doc files now exactly match the proven22f607c5implementation. The occasional passing execution was not treated as a fix, and assertions and security checks remain intact.Earlier scoped worker build/import graph, wrapper inventory, physical peer replacement, personal catalog/link, legacy-main, and history fixture proof passed 22 selected tests across nine files. Their test bytes and named owner surfaces remain unchanged; the current database-owner and full-workload proof cover the changed metadata path. The original approved head also passed a published 2026.9.8-driver upgrade cell with readiness HTTP 200 and durable/incognito state checks. Stored formats and upgrade ownership remain unchanged.
CI repair and investigated failures
The inherited directive failure described below was fixed on main by
3cbd049ccfd8b952d9e6a8de7ba7cb0829275ca3, integrated through5576137583d7c1a940ace39e7957e6e9862b0ac1. This PR merged that fix in21096de4; all 172 affected tests now pass locally with unchanged assertions. Before the fix landed, 22 complete candidate/merge-base invocations passed (1,328 test executions). The remaining eight old-head repetitions were explicitly superseded by integration; none were reported as run. No inherited-failure merge exception was submitted.Exact-head GitHub CI and security remain required. The maintainer explicitly authorized reuse of the completed ClawSweeper review after integration and small repairs; its earlier actionable finding is addressed below. No fresh ClawSweeper request is needed.
Historical
19a8cccdCI run 37687633741 completed with 85 successful jobs, 23 skipped, and one failed test shard plus its aggregate. Job113020271140failed eight cases acrossdirective-handling.mixed-inline.test.ts,directive-handling.model.test.ts, andget-reply-native-slash-fast-path.test.ts:Shared-state admission requires the host broker. It tested merge78084e4f7ea89b171ba8d87141f055c6af261aaf, with ordered parents maindc26366b07e7d08395b83de0d767150ffcb6ad50and19a8cccd82b4e92b595fd0682c9ec57a3784f795.The same eight cases failed with the same stack in scheduled main run 37682986551, job 113003741776, before the PR run. Main #166445 introduced an awaited placement read in
apply-session-model-selection.tswithout routing these three callers through a host-owned test project. The failing tests, placement call path, admission refusal, and routing are unchanged by this PR. This is inherited main failure evidence, not a claim that failed CI passed. No CI rerun or security waiver is requested.ClawSweeper revision 14 completed at 2026-10-08T17:19:36.901Z for
0269c7b8, with no correctness or security findings. Its remaining requests were conflict resolution and compatibility confirmation. The integrated source, unchanged stored/released contracts, SDK audit, and upgrade evidence address those requests. The maintainer authorizes reuse on later integration heads.Historical ClawSweeper revision 12 completed at 2026-10-07T21:18:07Z for
19a8cccd, with no actionable findings and no security findings. Its generated config/data-model checklist is covered by the unchanged released signatures and stored formats, preserved Doctor migration ownership, SDK report, and published-driver upgrade proof above. The detailed review explicitly confirms that no stored-data contract change requires migration.CI run 37669537001 on
e7f9097completed with 84 successful jobs, 23 skipped, and one failing test shard plus its downstream aggregate gate. Security-fast passed. The retained-reader test expected ten repeated content-version SELECTs after the intended cache reduced them to zero. Five complete file runs reproduced that assertion failure on the PR; five passed on the merge base. This was PR-caused. The failing case took 34ms in CI; its nine-file shard took 58.07s.Test-only commit
6ac89792b93f518f950f0536883750fe18b4c3farequires zero warm marker queries and proves one reread after a real foreign commit followed by reuse. It also corrected a later stale cold-reopen preparation count: a real-reader trace identifies the two required freshness preparations, before and after catalog capture. The exact expectation is two. All ten config reads, ten warm freshness probes, value, connection-reuse, idle, and eviction assertions remain. Main subsequently landed the same warm-count correction; integration retains both sides' regression coverage. The complete corrected cache/schema suites passed before integration (57 tests, 60.658s) and after the first integration (63 tests, 251.075s); the latest combined owner proof is recorded above. This addresses the sole actionable finding in ClawSweeper's completede7f9097review. Final-head CI and security remain required; the maintainer authorized reuse of this PR’s completed ClawSweeper review, with all earlier findings addressed.Earlier integration work repaired an unreadable-peer fixture race: synchronous reset began resource revocation without joining retained workers, so the next read could encounter closed admission. The fixture now awaits canonical asynchronous closure before the existing reset and physical repair. The original terminal-fence, no-replay, and credential assertions remain.
The overloaded Mac also produced copied-generation timeouts at the unchanged 10s deadline (load 81.73 on 32 logical CPUs). Five complete full-file runs per side on isolated AWS passed all 55 test executions on main and candidate; copied-generation times were 1.938–2.037s on main and 2.541–2.626s on the candidate. The later
e7f9097proof took 2.696s. Passing replays do not establish a fix for saturated-host timing; those local failures remain recorded.Other repaired boundaries include Doctor's fixture execution environment, real worker/credential-row bootstrap and corruption probes, the unchanged 64-agent roster with main's bounded seeding, persistent Gateway store selection, and history identity/pagination/byte bounds/older-message reachability. Replacement peer claims retain path, physical identity and birth time; old physical validation receipts retire before capturing the replacement opener's publication guard. Runtime authority and unknown-outcome handling remain intact.
Source-map and MCP advisory fixes, including #166217, were integrated from main. No security exception or audit suppression was used. The inherited terminal-font type error was also fixed on main and is covered by the passing integrated lanes. Historical failed runs remain 37491951288, 37505155711, 37560667478, and 37566604358.
Released SDK and retained contracts
The native local SDK API diff for
8204e917→22f607c5completed successfully, including native cleanup, with digest34580d79c70143c0ed6415f32957e453093296399a5a11a992de903062e33441: zero entrypoint additions/removals or direct declaration/kind changes. Its 131 reachable changes were audited across eleven final declaration blocks. Nine match the preceding reviewed report; the other changes retain main's TEMP-tracking owner and an internal query-builder argument while allowing an additional callback form. Neither changed internal helper is callable through released SDK exports, runtime APIs, or documented subpaths.This report remains honestly bound to
22f607c5. The later combined-query change was fully reverted. The later Mention Inbox repair changes only the internalmentions.snapshotworker body, preserving its imports, parameters, output contract, and registry identity. The subsequent integration keeps main’s async OAuth peer failure helper and retained maintenance history reader, and only moves private types/helpers between existing modules. The extracted markers retain readonly fields; no released signature changes. No released SDK/runtime/documented subpath exposes a changed signature, and no new compatibility record is required.Released reachability was rechecked against
v2026.10.1-beta.1and latest stablev2026.9.9after integration. Synchronous auth loading/save/upsert, persisted-credential lookup, and owner-resolution adapters retain their signatures. Removed private retention operation/worker modules and the new cold-admission predicate are absent from those releases. No released signature migration requires a new deprecation compatibility record.The released agent-runtime surface, provider-auth, and provider-auth-api-key retain their synchronous adapters. The native candidate reader also serves the CLI's immediate shared-key replacement guard at
src/commands/models/auth-api-key.ts:131. Existing session-send authority reads insrc/gateway/server-methods/chat-metadata-session-read.tsremain outside auth worker grants and moved-operation measurement windows. No new other-owner SQL is added inside those grants.Deferred provider-login/setup work
The follow-up must cover batch persistence with asynchronous conditional compensation; OAuth-safe rollback without reviving consumed predecessors; original physical-store custody through initial reads; the remaining standalone async-upsert authority read; settlement of every accepted receipt without holding FIFO reservations across unrelated config work; and preservation of protected secrets on unknown outcomes. It needs revocation, creation, overlay, native/Doctor, shutdown, nested shared-rotation, SDK, indirect-caller, SQL, and upgrade proof. This runtime debt remains explicitly outside this PR.
Integration and overlaps
The latest integration preserves main's phase-local session writes/no-op maintenance work (#166674), fresh receipt and alias revocation (
58e1c3f/400bab4a), and connect/recovery authority (961f5c0b). The PR's pre-capture replaced-file guard complements main's absent-path creation guard; both use existing in-memory/atomic validation facts and add no SQL. Main's catalog evaluation helper keeps the awaited personal-catalog preparation and default-versus-other-entry runtime pin behavior intact. The new canonical-model-key wrapper dependency is included and explicitly tested.All integrations use merge commits. Main #166867 overlaps TEMP tracking and #166906 extends catalog-error diagnosis; their current designs are retained. Main #165921 overlaps schema admission and transcript ownership; both owners’ semantics are retained with focused conflict resolutions. The later catalog cleanup in #166685 extracts the same evaluation helper; its clean merge with asynchronous preparation was inspected. Main's #166698 TEMP-tracker admission fix is retained with both new owner test suites and the compiled-wrapper dependency entry; the logging/redact-mask inventory addition from #166701 is also preserved. Main's #166259 content-version cache and conversation-worker design are reused, including its added regressions. Main's #166659 auth cleanup consolidation is preserved, including shared parameter/cell/cleanup helpers; terminal-peer cleanup awaits the async worker transition. The base also includes #166690 embedded-runner consolidation, #166539 device-identity worker admission, #166635 transcript-preview retention, #166519 session receipts, #166444 placement workers, #166236 worktree ownership, #166506 cold restoration, #166447 artifact/membership reads, #166591 publication encoding, and #166503 reader/native-library admission facts. Earlier catalog, executor-lifetime, and oversized-history integrations remain. Neighboring auth lanes include #165552, #165680, and prerequisites #165658/#165644; session/incognito and cleanup overlaps are handled with focused hunks and affected proof.