Skip to content

fix(skills): keep skills fresh after watcher failures - #157591

Merged
vincentkoc merged 3 commits into
mainfrom
fix/skills-ancestor-native-recovery-20260924
Sep 25, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
fix/skills-ancestor-native-recovery-20260924

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

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 is ae90c1781967a2a4c570796d315440b71cedad52 against main 36abfd8797ab3134405770fe17822cfa5dd2de70. The watcher owners and recovery/edit assertions match the reviewed candidate; inherited remote-drain changes were separately checked.

Current hosted proof Result
macOS 15.7.9, Node 24.20.0 Original test group: all 45 refresh cases and all 11 missing-root cases passed. Higher/intermediate ancestor rows: 3.724 s / 4.272 s.
Windows Server 2025, Node 24.20.0 All seven Windows watcher cases passed; missing-root 9 passed / 2 intentional symlink skips. Higher/intermediate ancestor rows: 3.775 s / 4.111 s.
Linux watcher groups, Node 24.21.0 Structural 4, refresh 45, churn 17, recovery 32, rescan 31, missing-root 11, and workspace transport 8 passed.
Gateway groups All 39 chat-metadata lifecycle and 13 early-startup cases passed.
Hosted build-artifacts gate pnpm build:ci-artifacts and 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 predecessor cd773d1c's refresh.ts and 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.

File under src/skills/runtime/ Passed Managed seconds Vitest seconds
refresh.structural-change.test.ts 4 18.831 17.230
refresh.test.ts 45 19.176 17.490
refresh.churn.test.ts 17 18.225 16.490
refresh.recovery.test.ts 32 19.329 17.730
refresh.rescan.test.ts 31 19.048 17.410
refresh.missing-root.integration.test.ts 11 27.956 26.280

Scoped 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: cd773d1c reproduced false later-sibling coverage with the two pre-fix owners; a28e8e30 reproduced stale cached content in three startup orders with the pre-fix 899fb027 owner. The earlier full canonical pnpm build passed at 899fb027 in 1261.681 managed seconds; it is historical proof, separate from the current hosted build profile.

  • Named follow-up: qualify pooled-loss scope for stock Chokidar’s preexisting implicit missing-path ancestor expansion. The new observation scope records explicit requests, not an exhaustive inventory of native handles.
  • Named follow-up: reduce the untouched UI startup CSS payload. The earlier full build reported a nonfatal advisory at 51,170 B gzip against a 51,200 B ceiling.

@vincentkoc vincentkoc self-assigned this Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review September 24, 2026 21:04
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 24, 2026, 8:06 PM ET / September 25, 2026, 00:06 UTC (Revision 3).

ClawSweeper review

What this changes

The 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
Reviewed head: 79b57069f864fdc90de2a5d84d3a50ce3472ae43

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The owner-level repair has meaningful real Linux watcher proof and no concrete code finding, with native platform qualification still needed.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): At the current head, the production watcher owner and real Linux filesystem watchers exercise ancestor loss, replacement, recovered Skill reads, and a later edit, with reported passing after-fix results and a failing predecessor control. Physical Windows and macOS qualification remains a separate merge risk. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): At the current head, the production watcher owner and real Linux filesystem watchers exercise ancestor loss, replacement, recovered Skill reads, and a later edit, with reported passing after-fix results and a failing predecessor control. Physical Windows and macOS qualification remains a separate merge risk. No stored-data contract changes.
Evidence reviewed 9 items Repository identity: The checkout remote identifies the target repository.
Current-main behavior: Current main retains failed ancestor roots and lacks the branch's verified-availability publication, so the distinct recovery behavior is still needed.
Observed-change ordering: The proposed owner publishes an observed structural change while subscribers still hold the watcher, before asynchronous retirement can stall.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - The current head has no physical Windows or macOS result for higher- and intermediate-ancestor recovery. An incorrect availability transition on either platform could let agent preparation reuse stale Skills snapshots.
  • Complete next step (P2) - Record current-head physical Windows and macOS higher- and intermediate-ancestor recovery results, including a subsequent Skill edit, before merge.
Agent review details

Security

None.

PR surface

Source +342, Tests +2170, Docs +5. Total +2517 across 27 files.

View PR surface stats
Area Files Added Removed Net
Source 10 645 303 +342
Tests 16 2387 217 +2170
Docs 1 7 2 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 27 3039 522 +2517

Review metrics

Metric Value Why it matters
Production and test growth production +342 net lines, tests +2170 net lines The PR body attributes production growth to shared watcher custody and cancellation; the large test addition covers distinct recovery and platform cases.
Plugin watch events 1 event added: available This changes a documented plugin-facing callback while preserving the older host fallback.

Merge-risk options

Maintainer options:

  1. Qualify native recovery (recommended)
    Exercise real higher- and intermediate-ancestor loss, recovery, and a subsequent Skill edit on Windows and macOS at this head before merging.

Technical review

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. At the current head, the production watcher owner and real Linux filesystem watchers exercise ancestor loss, replacement, recovered Skill reads, and a later edit, with reported passing after-fix results and a failing predecessor control. Physical Windows and macOS qualification remains a separate merge risk. No stored-data contract changes.

Label justifications:

  • P2: Stale Skills after watcher failure affect agent preparation, with a bounded runtime repair and limited known blast radius.
  • merge-risk: 🚨 compatibility: The branch changes the plugin-facing watch event contract and platform watcher recovery behavior, so existing hosts and operating systems need qualification.
  • merge-risk: 🚨 session-state: A premature coverage-recovered signal could cause an agent to reuse a stale cached Skill snapshot.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): At the current head, the production watcher owner and real Linux filesystem watchers exercise ancestor loss, replacement, recovered Skill reads, and a later edit, with reported passing after-fix results and a failing predecessor control. Physical Windows and macOS qualification remains a separate merge risk. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. At the current head, the production watcher owner and real Linux filesystem watchers exercise ancestor loss, replacement, recovered Skill reads, and a later edit, with reported passing after-fix results and a failing predecessor control. Physical Windows and macOS qualification remains a separate merge risk. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Kimi Yu: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record current-head physical Windows and macOS higher- and intermediate-ancestor recovery results, including a later Skill edit.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-24T21:13:56.556Z sha 899fb02 :: blocked before merge. :: none
  • reviewed 2026-09-24T22:41:07.984Z sha fefe59b :: blocked before merge. :: none

@vincentkoc
vincentkoc force-pushed the fix/skills-ancestor-native-recovery-20260924 branch from 899fb02 to fefe59b Compare September 24, 2026 22:32
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling plugin: file-transfer size: XL labels Sep 24, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 24, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 25, 2026
@vincentkoc
vincentkoc merged commit 82e95b6 into main Sep 25, 2026
247 of 248 checks passed
@vincentkoc
vincentkoc deleted the fix/skills-ancestor-native-recovery-20260924 branch September 25, 2026 04:07
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
* fix(skills): refresh skills after watcher recovery failures

* fix(skills): publish observed changes before watcher retirement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. plugin: file-transfer proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant