Skip to content

fix(skills): refresh persisted snapshots after restart - #71497

Closed
vincentkoc wants to merge 1 commit into
mainfrom
fix/skills-snapshot-restart-version
Closed

vincentkoc wants to merge 1 commit into
mainfrom
fix/skills-snapshot-restart-version

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • Seed the process-local skills snapshot version at gateway/CLI startup instead of starting every process at version 0.
  • Force persisted version: 0 snapshots from older processes to refresh once after restart, covering both gateway reply and CLI agent paths.
  • Add focused regression coverage plus a changelog entry.

Fixes

Fixes #69715
Fixes #55489
Fixes #54209
Fixes #49059
Fixes #67459

Related

Supersedes the same root-cause direction in #69716 while preserving the broader fix in the shared refresh-state layer. That covers the gateway reply path and the CLI agent path from one place.

Validation

  • OPENCLAW_LOCAL_CHECK=0 pnpm test src/agents/skills/refresh-state.test.ts src/agents/skills/refresh.test.ts src/auto-reply/reply/session-updates.test.ts
  • OPENCLAW_LOCAL_CHECK=0 pnpm check:changed

@vincentkoc vincentkoc added the dedupe:parent Primary canonical item in dedupe cluster label Apr 25, 2026
@vincentkoc vincentkoc self-assigned this Apr 25, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Apr 25, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 14, 2026
@clawsweeper

clawsweeper Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed June 21, 2026, 9:34 AM ET / 13:34 UTC.

Summary
The PR seeds the old src/agents/skills refresh-state version with Date.now(), adds a regression test, and edits CHANGELOG.md.

PR surface: Source +1, Tests +20, Docs +1. Total +22 across 3 files.

Reproducibility: yes. for the stale-branch defect: source and GitHub state show the PR edits the old src/agents/skills path while current main uses src/skills/runtime. The original restart bug is no longer reproduced on current main because the replacement implementation and tests are present in v2026.6.9.

Review metrics: 1 noteworthy metric.

  • Session Snapshot Invalidation Default: 1 startup-version seed change. The intended behavior changes persisted session snapshot invalidation after process restart, which is why the merged replacement needed focused session-state coverage.

Stored data model
Persistent data-model change detected: serialized state: CHANGELOG.md, serialized state: src/agents/skills/refresh-state.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: superseded
Canonical: #93513
Summary: The same restart skills-snapshot bug was carried forward into merged replacement PR #93513, which is the canonical implementation now present in current main and release v2026.6.9.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🌊 off-meta tidepool
Patch quality: 🧂 unranked krab
Result: blocked by patch quality or review findings.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

Risk before merge

  • [P1] This branch is conflicting and targets src/agents/skills, which no longer exists on current main, so it should not be treated as a merge candidate.
  • [P1] The intended behavior changes when persisted session skill snapshots rebuild after process restart; the safe implementation is the already-merged src/skills/runtime version, not this stale branch.

Maintainer options:

  1. Treat This As Context Only (recommended)
    Because the current-path replacement has merged, maintainers should keep this source PR only for attribution/context or close it explicitly, not land it.
  2. Revive Only With A Full Rebase
    If maintainers decide this branch still needs to land, it must be rebased onto src/skills/runtime and drop the obsolete old-path diff first.

Next step before merge

  • [P2] No code repair is needed; the remaining action is an explicit maintainer decision to close this preserved source PR or keep it as context.

Security
Cleared: The diff touches only a TypeScript refresh-state helper, a focused test, and changelog text; it adds no dependencies, workflows, scripts, permissions, or secret handling.

Review findings

  • [P2] Move the seed to the live skills runtime — src/agents/skills/refresh-state.ts:10
  • [P3] Drop the release-owned changelog edit — CHANGELOG.md:17
Review details

Best possible solution:

Keep the merged src/skills/runtime implementation from #93513 and let a maintainer explicitly close this source PR when the preserved context is no longer needed.

Do we have a high-confidence way to reproduce the issue?

Yes for the stale-branch defect: source and GitHub state show the PR edits the old src/agents/skills path while current main uses src/skills/runtime. The original restart bug is no longer reproduced on current main because the replacement implementation and tests are present in v2026.6.9.

Is this the best way to solve the issue?

No as a landing branch. The best fix already landed in #93513 against the live shared runtime, while this PR is now useful only as preserved source context unless a maintainer chooses otherwise.

Full review comments:

  • [P2] Move the seed to the live skills runtime — src/agents/skills/refresh-state.ts:10
    This diff changes src/agents/skills/refresh-state.ts, but current main no longer has that tree; the live helper is src/skills/runtime/refresh-state.ts. As submitted, this branch cannot fix the runtime without being rebased onto the current owner path.
    Confidence: 0.94
  • [P3] Drop the release-owned changelog edit — CHANGELOG.md:17
    Normal OpenClaw PRs should keep release-note context in PR metadata or the squash message; release generation owns CHANGELOG.md. This branch should not land the manual changelog entry.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.92

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 11a2e03bd4de; fix evidence: release v2026.6.9, commit 1884cedd350e.

Label changes

Label justifications:

  • P2: This is a normal-priority skills/session-state bugfix PR with limited blast radius, now superseded by a merged replacement.
  • merge-risk: 🚨 session-state: The PR changes when persisted skill snapshots are considered stale and rebuilt after process restart.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Not applicable because this is a MEMBER-authored maintainer-labeled PR; the external contributor real-behavior proof gate does not apply.
Evidence reviewed

PR surface:

Source +1, Tests +20, Docs +1. Total +22 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 1 +1
Tests 1 20 0 +20
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 23 1 +22

What I checked:

  • Repository policy read: Root AGENTS.md and the scoped src/agents/AGENTS.md were read fully; the maintainer-label protection, session-state compatibility guidance, and release-owned changelog guidance affect this review. (AGENTS.md:28, 11a2e03bd4de)
  • Live PR state blocks cleanup close: Live GitHub state reports this PR as open, draft, conflicting, labeled maintainer, and authored by vincentkoc; the author comment links merged replacement work and says this source PR was kept open for original context. (9fee9af8ced5)
  • Submitted patch targets obsolete path: The PR diff edits src/agents/skills/refresh-state.ts, but current main has no src/agents/skills tree and the live skills runtime now lives under src/skills/runtime. (src/agents/skills/refresh-state.ts:10, 9fee9af8ced5)
  • Current main implements the restart seed: Current main initializes INITIAL_SKILLS_SNAPSHOT_VERSION with Date.now() and assigns globalVersion from it, so persisted older snapshots compare below the current process version. (src/skills/runtime/refresh-state.ts:10, 11a2e03bd4de)
  • Current shared resolver uses the live predicate: resolveReusableWorkspaceSkillSnapshot ensures the watcher, reads getSkillsSnapshotVersion, calls shouldRefreshSnapshotForVersion, and refreshes through the shared runtime path used by gateway and CLI callers. (src/skills/runtime/session-snapshot.ts:58, 11a2e03bd4de)
  • Gateway and CLI callers use the shared runtime: The gateway session update path calls the shared resolver for persisted skillsSnapshot refresh, and the CLI agent path calls the same resolver with watch: false. (src/auto-reply/reply/session-updates.ts:167, 11a2e03bd4de)

Likely related people:

  • vincentkoc: Authored this source PR, the merged replacement PR, and the current merged proof commit for the live src/skills/runtime implementation. (role: recent area contributor and replacement PR owner; confidence: high; commits: 9fee9af8ced5, 1884cedd350e; files: src/agents/skills/refresh-state.ts, src/skills/runtime/refresh-state.ts, src/skills/runtime/refresh-state.test.ts)
  • skadauke: Reported and live-verified the version-reset stale snapshot bug, opened an earlier source PR, and is credited in the merged replacement work. (role: reporter and source-fix contributor; confidence: medium; commits: 32ff26bd2e09, e9fecf8666d0, c9a463b3dc69; files: src/agents/skills/refresh.ts, src/skills/runtime/refresh-state.ts, src/skills/runtime/session-snapshot.test.ts)
  • fif911: Opened an earlier PR with the same restart-version fix direction and regression coverage, and that contribution is credited in the merged replacement PR body. (role: earlier source PR contributor; confidence: medium; commits: cf6ab7b3dbd8, 998d16bdfb02, e9fecf8666d0; files: src/agents/skills/refresh.ts, src/agents/skills/refresh.test.ts, src/skills/runtime/refresh-state.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@vincentkoc

Copy link
Copy Markdown
Member Author

Clownfish 🐠 reef update

Thanks for the contribution here. Clownfish could not safely push to this branch, so it opened a replacement PR from a writable branch and carried the contributor trail along with it.

Replacement PR: #93513
Source PR: #71497
Keeping this PR open so the original context is easy to inspect.
Contributor credit is copied into the replacement PR notes and changelog path.

fish notes: model gpt-5.5, reasoning medium; reviewed against c9a463b.

@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 16, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 17, 2026
@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Closing as replaced by merged #93513 (1884cedd350e600469c1e5cd8fd90f21ec0bec85).

The writable replacement carried this persisted-snapshot restart fix and contributor credit to main; keeping the source PR open no longer preserves unique work.

Please reopen only if a concrete part of this source branch was not carried into #93513. Thanks, @vincentkoc.

@steipete steipete closed this Jul 5, 2026
@shakkernerd
shakkernerd deleted the fix/skills-snapshot-restart-version branch October 19, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling dedupe:parent Primary canonical item in dedupe cluster maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

2 participants