Repository navigation
Conversation
Greptile SummaryThis PR fixes a stale skills snapshot bug that affected long-lived sessions after a gateway restart. The fix is a single-line change: How the bug occurred: On restart, const shouldRefreshSnapshot = snapshotVersion > 0 && (nextEntry?.skillsSnapshot?.version ?? 0) < snapshotVersion;Since Why
Confidence Score: 5/5Safe to merge — the fix is minimal, correct, and well-explained with no side-effect risks. The one-line change is the simplest possible correct fix. All downstream consumers of getSkillsSnapshotVersion handle the new initial value of 1 correctly: the session-updates guard triggers exactly one rebuild per session per restart, the isolated-agent path handles it, and bumpVersion is unaffected since Date.now() ≫ 1. No existing tests are broken. The PR description thoroughly documents the before/after behavior and verifies it on a live system. No files require special attention.
|
| Filename | Overview |
|---|---|
| src/agents/skills/refresh.ts | Initializes globalVersion to 1 instead of 0, with a thorough explanatory comment. Correctly fixes the stale-snapshot bug without impacting bumpVersion, workspace versioning, or watcher behavior. |
Reviews (1): Last reviewed commit: "fix: initialize globalVersion to 1 so sk..." | Re-trigger Greptile
… gateway restart Long-lived sessions (e.g. the main Telegram session) store a skillsSnapshot with version: 0. After a gateway restart the in-memory globalVersion resets to 0, so the refresh check `snapshotVersion > 0 && stored < snapshotVersion` always evaluates to false. The snapshot is never rebuilt, and skills that were added, renamed, or deleted between restarts remain stale in the prompt. Starting globalVersion at 1 ensures that every session with the default version (0) triggers a single rebuild on its first turn after restart. Subsequent turns reuse the refreshed snapshot (version 1) until the watcher bumps the version again on a SKILL.md change. Fixes openclaw#55489
32b79ba to
32ff26b
Compare
|
Rebased on current main. CI has widespread failures, but none are related to this PR's one-line change (
The passing checks ( This is a one-line fix that prevents stale skill snapshots after gateway restart. Would love to see this included in the next release. |
|
Closing this as duplicate or superseded after Codex automated review. PR #55495 reports a real stale skills-snapshot restart bug, and its linked reproduction in #55489 is useful evidence. Current main still has the bug, but this PR's one-line target is stale after the refresh state moved into Best possible solution: Close #55495 as superseded by canonical maintainer PR #71497, and keep the implementation, regression test, and changelog entry concentrated in the current shared What I checked:
So I’m closing this here and keeping the remaining discussion on the canonical linked item. Codex Review notes: model gpt-5.5, reasoning high; reviewed against 06d409dc2738. |
Problem
Long-lived sessions store a
skillsSnapshotwithversion: 0. After a gateway restart, the in-memoryglobalVersionresets to0, so the refresh check:always evaluates to
false(0 > 0is false). The snapshot is never rebuilt, and skills that were added, renamed, or deleted between restarts remain stale in the agent prompt indefinitely.Fix
Initialize
globalVersionto1instead of0insrc/agents/skills/refresh.ts.This ensures that after any gateway restart, sessions with the default version (
0) triggershouldRefreshSnapshot = trueon their first turn, causing a singlebuildWorkspaceSkillSnapshot()call that picks up the current state of skills on disk.Verified
Reproduced and fixed on a live system:
Before fix: Main Telegram session showed
amazon-shopandwalmart-shop(deleted days ago), missingonline-shop(the replacement). Multiple gateway restarts did not help. Snapshot version stuck at 0.After fix: Gateway restart → main session rebuilt snapshot on first turn → all stale entries removed, all current entries present, version bumped to 1.
Side effects
The only change: every session rebuilds its skill snapshot once on the first turn after each gateway restart (stored version 0 < globalVersion 1). This is:
buildWorkspaceSkillSnapshotreads SKILL.md frontmatter from ~20 filesbumpVersionstill returnsDate.now()sinceDate.now() > 1updateSessionStoreuses async lockFixes #55489