Repository navigation
fix(skills): keep skills fresh after watcher failures - #157591
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 24, 2026, 8:06 PM ET / September 25, 2026, 00:06 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch makes Skills watchers retain subscribers through failures and shutdown, refresh cached Skills after observed changes, and restore snapshot reuse only after watch coverage is verified. Merge readiness⛔ Blocked before merge - 2 items remain Current main contains the earlier directory-replacement fix, but it does not contain this PR’s watcher-failure recovery. The PR remains useful. Its Linux evidence is strong; physical Windows and macOS recovery at the current head remains unverified. Priority: P2 Review scores
Verification
How this fits togetherThe Skills runtime watches local and remote Skill sources and updates cached snapshots when their contents change. Gateway and agent preparation consume those snapshots to present current Skills to users and agents. flowchart LR
A[Skill files] --> B[Local and remote watchers]
B --> C{Coverage verified?}
C -- Yes --> D[Change notifications]
C -- No --> E[Preparation refresh]
D --> F[Cached Skill snapshots]
E --> F
F --> G[Gateway and agents]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +342, Tests +2170, Docs +5. Total +2517 across 27 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep preparation refresh active whenever watch coverage cannot be certified, and qualify recovery plus a later Skill edit on physical Windows and macOS before merging. Do we have a high-confidence way to reproduce the issue? Yes. Current main retains the failure state without this recovery path, and the PR supplies a focused failing control and real Linux watcher scenario; this read-only review did not execute them. Is this the best way to solve the issue? Yes. The shared watcher owner is the appropriate place to retain subscriptions, reconcile content, and certify availability; native platform evidence is still needed for the claimed recovery behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 73a2c9791b88. LabelsLabel 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
History |
899fb02 to
fefe59b
Compare
|
Merged via squash.
|
* fix(skills): refresh skills after watcher recovery failures * fix(skills): publish observed changes before watcher retirement
What Problem This Solves
Skills could stay stale after watcher failure or replacement, and shutdown could leave observers alive. A replacement becoming ready did not by itself prove that its descendants had continuous observation.
User Impact
Preparation checks Skills while observation is unreliable. Recovery is announced only after coverage is verified. Retired observers finish closing; pooled watchers retain preparation refresh when renewed native coverage cannot be verified.
Release note: keep Skills fresh after watcher failures and join retired watchers during shutdown.
Why This Change Was Made
The shared watcher owner retains subscribers and close results, quarantines failed retirement, and verifies content after ancestor observation returns. Verified content refreshes cached readers during an outage without declaring observation healthy. Observed structural changes invalidate cached readers before retirement, so a held or failed close cannot discard a known change. Shutdown and disposal cancel replacement. Availability-only recovery stays separate from content revisions and Gateway refreshes.
Ownership and scope
The canonical registry owns observation-loss scopes, subscription custody, and publication. Known pooled observation loss survives release and ordinary shutdown. Ancestor watchers retain their explicit observation scope separately from logical group identity, including the parent requested on nonpolling macOS. This replaces sticky failed-root bookkeeping.
Production changes are +645/-303 (+342); tests +2387/-217 (+2170); docs +7/-2 (+5). Production growth owns retirement results, cancellation, shared subscribers, and verified availability. Stock Chokidar 5, dependency pins, configuration, and default transport selection are unchanged.
The branch builds on the landed Skills watcher fix #156324. Complete-owner and corrective reviews leave no outstanding accepted finding.
Evidence
CI attempt 2 passed for
79b57069f864fdc90de2a5d84d3a50ce3472ae43: 138 successful jobs, 16 intentionally skipped jobs, and the required aggregate gate passed. Its tested merge isae90c1781967a2a4c570796d315440b71cedad52against main36abfd8797ab3134405770fe17822cfa5dd2de70. The watcher owners and recovery/edit assertions match the reviewed candidate; inherited remote-drain changes were separately checked.pnpm build:ci-artifactsand artifact checks passed; 13 build phases completed in 3m 28s.The native ancestor rows also verify later edits. Windows verifies discovery and subsequent deep edits without preparation. macOS executes the stock pooled-watcher branch: preparation reads later edits while the peer remains live and availability stays false. This does not claim renewed native coverage for an uncertain pooled watcher.
These results satisfy both Before-merge items and the Rank-up move in the exact-head ClawSweeper review. That review reports no actionable code or security finding.
Focused causal proof and measured costs
At exact
79b57069, 140 focused Linux cases and all seven scoped checks passed. The control substituted only predecessorcd773d1c'srefresh.tsand reproduced one stale cached-content failure after deletion, before close completion or replacement readiness. The other three cases were filtered skips; there were no setup, suite, or unhandled errors. Full candidate source was restored before positives.src/skills/runtime/refresh.structural-change.test.tsrefresh.test.tsrefresh.churn.test.tsrefresh.recovery.test.tsrefresh.rescan.test.tsrefresh.missing-root.integration.test.tsScoped checks cover both line ratchets, assertion safety, formatting, core types, services test types, and core lint. All 24 managed commands joined; source, runtime, stock dependencies, and controller identity remained stable. These Linux x64 runs used Node 24.19.0, pnpm 12.4.2, TypeScript 7.0.2, Vitest 5.0.1, four CPUs and one worker. Costs are individual focused runs, not total hosted CI.
Earlier causal controls remain source-attributed:
cd773d1creproduced false later-sibling coverage with the two pre-fix owners;a28e8e30reproduced stale cached content in three startup orders with the pre-fix899fb027owner. The earlier full canonicalpnpm buildpassed at899fb027in 1261.681 managed seconds; it is historical proof, separate from the current hosted build profile.