Repository navigation
refactor: await runtime quarantine health writes - #161579
Conversation
Move ordinary quarantine registration and recovery onto the existing plugin-state worker, preserving namespace, retention, and authoritative in-memory decisions. Join accepted health writes at the actual asynchronous callers without widening public synchronous callbacks. Keep activation cleanup in the existing synchronous publication frame. Preserve absent/native-only state during no-op recovery and retain current-row admission for real deletion. Align fixtures with awaited initialization and retain timed-out CLI bodies before global teardown.
|
🦞👀 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: blocked before merge. Reviewed September 30, 2026, 7:57 AM ET / 11:57 UTC (Revision 9). ClawSweeper reviewWhat this changesThe branch moves context-engine and tool-schema quarantine writes to the plugin-state worker, awaits their completion, and retains plugin resources across the new waits. Merge readiness⛔ Blocked before merge - 4 items remain Keep open. Current main still performs synchronous runtime health writes, and this branch addresses that work through the existing storage owner. The earlier per-key recovery finding is fixed; upgrade and recurring test-cost evidence remain before merge. Priority: P2 Review scores
Verification
How this fits togetherAgent setup selects context engines and projects tools from plugin registrations. Failures enter a runtime quarantine and an SQLite health mirror that Status and Doctor can read. flowchart LR
A[Plugin engines and tools] --> B[Agent setup]
B --> C{Failure detected?}
C -->|Yes| D[Runtime quarantine]
D --> E[SQLite health worker]
E --> F[Status and Doctor]
C -->|No| G[Usable engine and tools]
D --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +370, Tests +704, Other -1. Total +1073 across 61 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single plugin-state owner for health persistence, with settled writes, retained plugin lifetimes, and verified Doctor upgrade behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main calls the synchronous keyed store for runtime health registration and recovery. This read-only review did not execute the runtime. Is this the best way to solve the issue? Yes, provisionally: the branch uses the existing plugin-state worker and preserves the stored record shape; the Doctor upgrade path still needs its required compatibility check. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fcd59e6bdfdb. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
Required health-worker routing adds another runtime-backed storage stripe. The timing fixtures assumed an admissible donation but inherited that unrelated runtime prerequisite, leaving an immovable donor remainder above its budget. Call through to the real prerequisite resolver for the four fixture consumers while preserving full inventories, worker and runner policy, and every existing result assertion. Require the first case to share a donor before observations separate it. Exact base passed all 207 cases; the three routing additions alone reproduced the five CI failures. The corrected fixture passes all 207 plus 112 planner siblings. Selected types, guards, lint, and independent P2 review pass. Production planning policy is unchanged.
Capture registration and native source claims before awaited health writes. Keep first-factory authority checks distinct from already-admitted fallback settlement, and retain lazy fallback construction and disposal ownership. The original ordered 23-file failure reproduces locally; corrected capture passes 311 cases with 11 skips. Final fallback and caller coverage passes 159 and 177 cases respectively, with real SQLite lifetime controls.
Start existing worker clears per captured tool identity so a renewed failure cannot veto recovery of another healthy key. Join every clear and remove its submission only after that operation succeeds and remains current. The existing before-dispatch overlap reproduces the stale healthy record on the old batch path. The corrected tool and context health owners pass 14 cases locally, with three Linux-only process controls skipped on macOS.
Preserve the original poll, deadline, durable-row assertions, and held old completion. On failure, report existing model calls and settlements, change notifications, and abort state without new SQL or success-path logging. The hosted Linux failure remains unclassified; the fixed-main original group passed locally. These observations distinguish pending preparation from model and write progress without weakening the race oracle.
Preserve the canonical Doctor test deletion and retain the failure-only activity diagnostic. Carry the qualified terminal/UI line-cap repair 17d00fc and canonical bootstrap baseline cleanup 0361956. Affected receiving tests pass 249 cases with 3 Linux-only skips. Retain the prior lifecycle proof for unchanged sources and source-bound static repair evidence; the activity race still requires exact-head Linux CI. Co-authored-by: Vincent Koc <[email protected]>
Resolve the sole conflict to the exact canonical #161824 fixture, replacing the superseded failure-only observation with its actual publication join. Preserve the delayed prior-owner result and all persistence and cancellation assertions. Whole recap owner plus health and Doctor compatibility checks pass 47 cases with 3 Linux-only skips; scoped independent P2 review is clean. The separately observed Doctor legacy-yes timeout remains unclassified.
Observe the first legacy yes-mode case through its existing test signal. Keep lazy loading, the original maintenance promise and object, all six cases, the 30-second deadline, and every outcome assertion unchanged. Print only phase timings, settlement and migration counts on interruption. Selected static checks and independent P2 review pass. Local E2E preparation was refused before tests by the managed Gateway artifact fence; exact-head isolated CI must supply runtime qualification.
|
Merged via squash.
|
* refactor: await runtime quarantine health writes Move ordinary quarantine registration and recovery onto the existing plugin-state worker, preserving namespace, retention, and authoritative in-memory decisions. Join accepted health writes at the actual asynchronous callers without widening public synchronous callbacks. Keep activation cleanup in the existing synchronous publication frame. Preserve absent/native-only state during no-op recovery and retain current-row admission for real deletion. Align fixtures with awaited initialization and retain timed-out CLI bodies before global teardown. * test(ci): make runtime placement prerequisites explicit Required health-worker routing adds another runtime-backed storage stripe. The timing fixtures assumed an admissible donation but inherited that unrelated runtime prerequisite, leaving an immovable donor remainder above its budget. Call through to the real prerequisite resolver for the four fixture consumers while preserving full inventories, worker and runner policy, and every existing result assertion. Require the first case to share a donor before observations separate it. Exact base passed all 207 cases; the three routing additions alone reproduced the five CI failures. The corrected fixture passes all 207 plus 112 planner siblings. Selected types, guards, lint, and independent P2 review pass. Production planning policy is unchanged. * fix(context-engine): retain sources before health initialization Capture registration and native source claims before awaited health writes. Keep first-factory authority checks distinct from already-admitted fallback settlement, and retain lazy fallback construction and disposal ownership. The original ordered 23-file failure reproduces locally; corrected capture passes 311 cases with 11 skips. Final fallback and caller coverage passes 159 and 177 cases respectively, with real SQLite lifetime controls. * test(subagents): expect retained engine initialization callback * fix(agents): isolate recovered tool quarantine cleanup Start existing worker clears per captured tool identity so a renewed failure cannot veto recovery of another healthy key. Join every clear and remove its submission only after that operation succeeds and remains current. The existing before-dispatch overlap reproduces the stale healthy record on the old batch path. The corrected tool and context health owners pass 14 cases locally, with three Linux-only process controls skipped on macOS. * test(gateway): report activity recap relocation failures Preserve the original poll, deadline, durable-row assertions, and held old completion. On failure, report existing model calls and settlements, change notifications, and abort state without new SQL or success-path logging. The hosted Linux failure remains unclassified; the fixed-main original group passed locally. These observations distinguish pending preparation from model and write progress without weakening the race oracle. * test(doctor): report interrupted maintenance phase Observe the first legacy yes-mode case through its existing test signal. Keep lazy loading, the original maintenance promise and object, all six cases, the 30-second deadline, and every outcome assertion unchanged. Print only phase timings, settlement and migration counts on interruption. Selected static checks and independent P2 review pass. Local E2E preparation was refused before tests by the managed Gateway artifact fence; exact-head isolated CI must supply runtime qualification. --------- Co-authored-by: Vincent Koc <[email protected]>
* refactor(agents): simplify old runtime bookkeeping Use one catalog discovery pass, local-process stop promise, presentation completion path, diagnostic recovery batch, and generated-media rollback owner. Reuse directory parameter declarations and keep sandbox validation at its existing boundary without repeating the same blocked-path checks. Remove the duplicate full-map primary-probe prune. Trust JSON-normalized result previews and group identical session-export style declarations without changing their visibility or cascade rules. Keep auth/approval/sandbox policy, normal child and write settlement, transcript/user-data durability, public signatures and Phase E unchanged. Production reduction: 147 net lines across ten old-only files. Best-effort tradeoffs accepted - MCP list_changed during held sibling discovery: #138694 added a synthetic forced-overlap replay, not a cited human incident. The next load refreshes the catalog instead; retirement and execution authority remain enforced. - Competing catalog producer finalization: the same private owner forbids a replacement while its promise is present, so the identity recheck is an internal invariant, not a realistic concurrency boundary. - Local-service post-readiness exit: #154133 describes synthetic parallel qualification, not a human report requiring another health check. The following request reports an exit after readiness; normal shutdown still joins the child, streams and pending termination work. - Local-process stop identity: replacement starts only after the retained authoritative process finishes stopping. The duplicate process reference and identity comparisons cannot observe another production replacement; failed-stop retry and the retiring marker remain intact. - Synchronous presentation self-drain: #156187 extracted this reservation without a cited human incident. Production adapters drain after projection; callbacks return their own work instead of reserving it before invocation. - Quarantine recovery overlap: #161579 explicitly introduced per-key and generation fencing for synthetic before-dispatch/after-reply controls. Same-key overlap can leave a stale or missing status warning until a later failing run or existing TTL. Actual tool exclusion, logs/events, accepted writes, stored shapes and worker/SQL contracts remain unchanged. - Primary-probe cache insertion order: #82707 introduced duplicate pruning. Post-write expiry and capacity bounds remain; refreshing an expired key can retain an earlier insertion position and permit an earlier reprobe after capacity eviction. This is a bounded best-effort throttle cache. - Preview host-prototype pollution: #147278 added own-property gates as part of result retention, not a human inherited-property failure report; linked #147105 proposes the feature. The sole caller passes freshly parsed JSON. A polluted host Object.prototype can affect bounded descriptive samples; retained JSON, reference identity and execution authority remain unchanged. * test(agents): warm MCP sibling before held discovery The discovery/revocation fixture held HTTP tools/list while cold-starting its stdio sibling. Slow startup could exhaust the existing ten-second listing deadline before the test reached revocation, producing a timeout diagnostic or an empty healthy-tool list instead of exercising its overlap. Warm the non-held sibling through its actual runtime owner first, then hold the other server's discovery across revocation. Keep every assertion, deadline, runtime authority check, and cleanup path unchanged. The two affected cases pass through the production materialization path; focused lint, format, and the owning test type graph also pass. The earlier four short-deadline MCP runtime failures remain separately unattributed. * refactor(apple): simplify source resources and microphone permission Use cancellation of owned source-resource tasks instead of a revision counter. Use native async microphone permission APIs instead of manual authorization-state switches and callback continuations. Best-effort tradeoffs accepted: - Resource revision tracking (#148906, feature request #148850, not a human invalidation-race incident): invalidation between prepared context and favicon task admission may allow one lookup with that snapshot; later lookups rediscover. Live route authority and Gateway disabled-fetch policy remain enforced. No protocol, persisted shape, config, permission-prompt or signing changes. Net production reduction: 26 lines (+10/-36); no test changes. Phase E untouched. Pager/notification changes were excluded after #171772 made their files recent under the seven-day rule. BELOW-500 coordinator bundle. Remaining source is byte-identical to the independently reviewed checkpoint. macOS/iOS Simulator/watchOS Simulator arm64 platform builds passed. Actual production-package focused tests passed: 17 VoiceNote XCTest cases and 18 source-resource SwiftTesting declarations including parameters. SwiftFormat, SwiftLint, runtime/madge cycles (zero), lint-suppressions, native-state guard and localization verification passed. Broad check-changed is not green: one bounded reproduction retained ten 20-second artifact-fixture subprocess timeouts and one 120-second signing fixture timeout. Unchanged tooling paths do not run these Swift sources; these are unresolved local failures, not proven hosted-main-red. Intel execution, app-hosted native UI tests requiring an OS sandbox and live microphone effects are not proven. No release_gate or remote lease. * refactor(apple): consolidate activity refresh and watch connection paths * refactor(agents): retain recent MCP contracts in old-code bundle Keep the recently edited reload regression file and its current combined-catalog implementation unchanged from main. Preserve the final source-lane trees for quarantine and Live Activity while retaining newer main behavior. This supersedes the historical source-commit inventories and MCP/quarantine/activity timing tradeoffs. Final bundle: 162 production lines removed; 112 net lines removed including tests (+166/-278, 14 files). Credit source lanes q10, q01 and q02. Fresh final-index review found no actionable P0-P2 defects. Focused proof and exact-head PR CI remain the landing gates. * fix(test): synchronize MCP connection invalidation fixture Hold sibling initialization across client-observed catalog invalidation. Preserve the existing assertions and deadlines; isolate scenario setup so the oversized runtime test does not grow.
…aw#172002) * refactor(agents): simplify old runtime bookkeeping Use one catalog discovery pass, local-process stop promise, presentation completion path, diagnostic recovery batch, and generated-media rollback owner. Reuse directory parameter declarations and keep sandbox validation at its existing boundary without repeating the same blocked-path checks. Remove the duplicate full-map primary-probe prune. Trust JSON-normalized result previews and group identical session-export style declarations without changing their visibility or cascade rules. Keep auth/approval/sandbox policy, normal child and write settlement, transcript/user-data durability, public signatures and Phase E unchanged. Production reduction: 147 net lines across ten old-only files. Best-effort tradeoffs accepted - MCP list_changed during held sibling discovery: openclaw#138694 added a synthetic forced-overlap replay, not a cited human incident. The next load refreshes the catalog instead; retirement and execution authority remain enforced. - Competing catalog producer finalization: the same private owner forbids a replacement while its promise is present, so the identity recheck is an internal invariant, not a realistic concurrency boundary. - Local-service post-readiness exit: openclaw#154133 describes synthetic parallel qualification, not a human report requiring another health check. The following request reports an exit after readiness; normal shutdown still joins the child, streams and pending termination work. - Local-process stop identity: replacement starts only after the retained authoritative process finishes stopping. The duplicate process reference and identity comparisons cannot observe another production replacement; failed-stop retry and the retiring marker remain intact. - Synchronous presentation self-drain: openclaw#156187 extracted this reservation without a cited human incident. Production adapters drain after projection; callbacks return their own work instead of reserving it before invocation. - Quarantine recovery overlap: openclaw#161579 explicitly introduced per-key and generation fencing for synthetic before-dispatch/after-reply controls. Same-key overlap can leave a stale or missing status warning until a later failing run or existing TTL. Actual tool exclusion, logs/events, accepted writes, stored shapes and worker/SQL contracts remain unchanged. - Primary-probe cache insertion order: openclaw#82707 introduced duplicate pruning. Post-write expiry and capacity bounds remain; refreshing an expired key can retain an earlier insertion position and permit an earlier reprobe after capacity eviction. This is a bounded best-effort throttle cache. - Preview host-prototype pollution: openclaw#147278 added own-property gates as part of result retention, not a human inherited-property failure report; linked openclaw#147105 proposes the feature. The sole caller passes freshly parsed JSON. A polluted host Object.prototype can affect bounded descriptive samples; retained JSON, reference identity and execution authority remain unchanged. * test(agents): warm MCP sibling before held discovery The discovery/revocation fixture held HTTP tools/list while cold-starting its stdio sibling. Slow startup could exhaust the existing ten-second listing deadline before the test reached revocation, producing a timeout diagnostic or an empty healthy-tool list instead of exercising its overlap. Warm the non-held sibling through its actual runtime owner first, then hold the other server's discovery across revocation. Keep every assertion, deadline, runtime authority check, and cleanup path unchanged. The two affected cases pass through the production materialization path; focused lint, format, and the owning test type graph also pass. The earlier four short-deadline MCP runtime failures remain separately unattributed. * refactor(apple): simplify source resources and microphone permission Use cancellation of owned source-resource tasks instead of a revision counter. Use native async microphone permission APIs instead of manual authorization-state switches and callback continuations. Best-effort tradeoffs accepted: - Resource revision tracking (openclaw#148906, feature request openclaw#148850, not a human invalidation-race incident): invalidation between prepared context and favicon task admission may allow one lookup with that snapshot; later lookups rediscover. Live route authority and Gateway disabled-fetch policy remain enforced. No protocol, persisted shape, config, permission-prompt or signing changes. Net production reduction: 26 lines (+10/-36); no test changes. Phase E untouched. Pager/notification changes were excluded after openclaw#171772 made their files recent under the seven-day rule. BELOW-500 coordinator bundle. Remaining source is byte-identical to the independently reviewed checkpoint. macOS/iOS Simulator/watchOS Simulator arm64 platform builds passed. Actual production-package focused tests passed: 17 VoiceNote XCTest cases and 18 source-resource SwiftTesting declarations including parameters. SwiftFormat, SwiftLint, runtime/madge cycles (zero), lint-suppressions, native-state guard and localization verification passed. Broad check-changed is not green: one bounded reproduction retained ten 20-second artifact-fixture subprocess timeouts and one 120-second signing fixture timeout. Unchanged tooling paths do not run these Swift sources; these are unresolved local failures, not proven hosted-main-red. Intel execution, app-hosted native UI tests requiring an OS sandbox and live microphone effects are not proven. No release_gate or remote lease. * refactor(apple): consolidate activity refresh and watch connection paths * refactor(agents): retain recent MCP contracts in old-code bundle Keep the recently edited reload regression file and its current combined-catalog implementation unchanged from main. Preserve the final source-lane trees for quarantine and Live Activity while retaining newer main behavior. This supersedes the historical source-commit inventories and MCP/quarantine/activity timing tradeoffs. Final bundle: 162 production lines removed; 112 net lines removed including tests (+166/-278, 14 files). Credit source lanes q10, q01 and q02. Fresh final-index review found no actionable P0-P2 defects. Focused proof and exact-head PR CI remain the landing gates. * fix(test): synchronize MCP connection invalidation fixture Hold sibling initialization across client-observed catalog invalidation. Preserve the existing assertions and deadlines; isolate scenario setup so the oversized runtime test does not grow.
What Problem This Solves
Runtime setup and recovery still perform caller-thread SQLite writes when recording context-engine and tool-schema quarantines. Moving those writes off-thread also requires retaining the selected plugin resources before the first new await.
User Impact
This is an internal persistence migration. Quarantine decisions, stored data, retention, and public callback contracts remain unchanged. Ordinary health writes are awaited; loader activation retains its existing synchronous publication boundary.
Why This Change Was Made
Registration uses the existing plugin-state worker. Recovery selects and deletes current matching rows inside its admitted transaction, without creating or migrating state for a no-op cleanup. Runtime callers join diagnostic writes after synchronous tool normalization and permission publication, before acknowledging completion.
Context-engine resolution captures the exact registrations and retains their native sources before awaiting initialization or quarantine recording. Factories remain lazy. First-factory admission checks current authority; recovery of already-admitted work retains its original resource lifetime and settlement. Rejection, cancellation, and disposal release the retained sources through the existing owner. No public plugin callback becomes asynchronous.
Evidence
The first executed CI failed before product tests because its tested merge lacked the separate canonical manifest fix; the branch now includes it. The next run exposed a routing-dependent synthetic timing fixture: exact base 207 passed, adding the three required worker-routing rows reproduced five failures. The fixture now names its intended runtime consumers through the real prerequisite resolver, retaining production placement policy and assertions. Actual Linux CI subsequently passed all 207 cases.
That same CI exposed the source-retention regression repaired here; it is not treated as pre-existing or waived. The new head still requires current CI and review. An earlier local CLI timeout was not reproduced and remains unattributed, rather than labelled flaky.