Repository navigation
fix(skills): stop calling the updater's own install a modified copy - #11249
Conversation
📝 WalkthroughWalkthroughUpdater-lock hashes now allow supported global skill installations with matching canonical bytes to be classified as 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| @@ -4,6 +4,7 @@ | |||
| "../electron.vite.config.*", | |||
| "../build-plugins/**/*", | |||
| "../src/main/**/*", | |||
| "../src/renderer/src/lib/skill-freshness-display-status.ts", | |||
There was a problem hiding this comment.
Renderer file included directly in node tsconfig
skill-freshness-display-status.ts is a renderer-side module, and adding it here by explicit path (rather than moving the function to src/shared/) creates a cross-boundary coupling in the build config. The function is currently safe — it only imports from src/shared/ — but if it ever gains a renderer-specific import (a DOM type, a Vite-only virtual module, etc.), the node TypeScript compilation would break without any obvious hint about why. Since this is the only renderer path added to the node tsconfig, there's also no lint gate preventing future entries. Moving the function to src/shared/ would satisfy both the test cross-validation goal and the natural module boundary.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Greptile SummaryThis PR fixes a false-positive "Needs attention" state that appeared after using the built-in Update button on a skill. The root cause was that the scan never consulted the updater lock when classifying content newer than the bundled snapshot registry, causing the CLI's own freshly-installed bytes to be flagged as a suspicious "unrecognized" modification.
Confidence Score: 5/5Safe to merge — the fix is narrowly scoped, fails closed on every mismatch, and is verified by three new integration tests that use real git hashing. Both halves of the fix are independently inert and mutually required. The trust is gated on topology (only canonical/provider-alias placements the updater actually writes), a non-null observed git tree SHA, and an exact SHA match against the lock — any of these failing leaves the status as unrecognized, identical to today's behaviour. The shared predicate and the renderer display function are updated in lock-step so the badge and dialog cannot disagree. The new tests use real git write-tree rather than Orca's own port, confirming the hash comparison is not self-validating. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/main/skills/skill-freshness-inventory.ts | Adds trustLockInstalledRevision, applied after deduplication on globally-updatable topologies only; fail-closed on null sha, missing lock entry, or topology mismatch |
| src/shared/skill-freshness.ts | Exports SUPPORTED_GLOBAL_SKILL_TOPOLOGIES for reuse and adds newer-known exemption to isSkillCopyNeedingAttention, keeping the shared predicate consistent with the renderer display function |
| src/renderer/src/lib/skill-freshness-display-status.ts | Adds newer-known exemption to hasBlockedCopy logic in getSkillFreshnessDisplayStatus, matching the shared isSkillCopyNeedingAttention so badge and dialog agree |
| src/main/skills/skill-freshness-inventory.test.ts | Three new integration tests cover: lock-matched canonical bytes classified newer-known, mismatch stays unrecognized, and independent-copy with matching lock hash not trusted; uses real git write-tree for hashing |
| config/tsconfig.node.json | Adds renderer path to node tsconfig so the inventory test can import the display-status function; previously flagged as a cross-boundary coupling concern |
Reviews (2): Last reviewed commit: "fix(skills): stop calling the updater's ..." | Re-trigger Greptile
After a successful headless update the CLI installs source-repo HEAD,
which legitimately runs ahead of any shipped bundle. The scan classified
those bytes 'unrecognized', so the row went amber ('may be modified…
remove it') seconds after our own Update button ran, and the advice
looped: remove + reinstall lands the same newer content.
Scan half: a canonical/alias placement whose observed git tree sha
equals the updater lock's skillFolderHash is the CLI's own install, not
a user edit — reclassify it 'newer-known'. Display half: 'newer-known'
is recognized official content ahead of this build with nothing to fix,
so it no longer marks the copy blocked. Eligibility is deliberately
unchanged: ahead of the bundle means there is nothing this build can
update to, and offering one risks the provably-unperformable update
(#11110) when source HEAD still equals the lock.
Copies whose sha does not match the lock, copies with no lock entry,
same-name copies outside the placements the command writes, and
plugin-cache behavior all stay flagged exactly as before.
9f44f60 to
2979851
Compare
…tablyai#11249) After a successful headless update the CLI installs source-repo HEAD, which legitimately runs ahead of any shipped bundle. The scan classified those bytes 'unrecognized', so the row went amber ('may be modified… remove it') seconds after our own Update button ran, and the advice looped: remove + reinstall lands the same newer content. Scan half: a canonical/alias placement whose observed git tree sha equals the updater lock's skillFolderHash is the CLI's own install, not a user edit — reclassify it 'newer-known'. Display half: 'newer-known' is recognized official content ahead of this build with nothing to fix, so it no longer marks the copy blocked. Eligibility is deliberately unchanged: ahead of the bundle means there is nothing this build can update to, and offering one risks the provably-unperformable update (stablyai#11110) when source HEAD still equals the lock. Copies whose sha does not match the lock, copies with no lock entry, same-name copies outside the placements the command writes, and plugin-cache behavior all stay flagged exactly as before.
…tablyai#11249) After a successful headless update the CLI installs source-repo HEAD, which legitimately runs ahead of any shipped bundle. The scan classified those bytes 'unrecognized', so the row went amber ('may be modified… remove it') seconds after our own Update button ran, and the advice looped: remove + reinstall lands the same newer content. Scan half: a canonical/alias placement whose observed git tree sha equals the updater lock's skillFolderHash is the CLI's own install, not a user edit — reclassify it 'newer-known'. Display half: 'newer-known' is recognized official content ahead of this build with nothing to fix, so it no longer marks the copy blocked. Eligibility is deliberately unchanged: ahead of the bundle means there is nothing this build can update to, and offering one risks the provably-unperformable update (stablyai#11110) when source HEAD still equals the lock. Copies whose sha does not match the lock, copies with no lock entry, same-name copies outside the placements the command writes, and plugin-cache behavior all stay flagged exactly as before.
The bug
Click Update on a skill. The CLI fetches source-repo HEAD, writes the bytes, exits 0, records its lock. The run dialog says "Updated 1 skill" (#11220). Then the row goes amber Needs attention, and Details advises the copy "may be modified… Remove it" — about bytes our own button just installed. Following that advice loops: remove + reinstall lands the same newer content. The skill also silently drops out of update eligibility until a future build bundles that revision.
Content newer than the bundle is the steady state, not an edge case — skills/ gets commits ~every other day, so upstream runs ahead of any shipped bundle within days of a release. #11220 fixed the post-run verdict only; the scan itself never consulted the updater lock.
The fix (two halves; each is inert without the other)
skill-freshness-inventory.ts): a canonical/provider-alias placement classifiedunrecognizedwhose observed git tree sha equals the lock'sskillFolderHashis the CLI's own install — reclassify tonewer-known. Judged only over the placements the update command writes; a same-name copy elsewhere earns no trust from someone else's lock entry.newer-knownis recognized official content ahead of this build — exempt it from attention in the two deciders that fix(skills): stop the skill review dialog contradicting the badge that opens it #11128 left: the inlinehasBlockedCopyloop ingetSkillFreshnessDisplayStatus, and the sharedisSkillCopyNeedingAttentionpredicate (which fix(skills): stop the skill review dialog contradicting the badge that opens it #11128 introduced precisely so the badge, the pill's amber Details, and the dialog rows cannot disagree — one edit covers all three).This lands on top of #11128 and #11248, which reshaped the same surface: #11128's shared predicate is where the exemption now lives, and #11248's
newerchip + skipped-reason copy already give a pinned post-runnewer-knownrow honest wording ("later version… Orca left it alone rather than roll it back").Eligibility deliberately unchanged:
newer-knownstill doesn't producehasOutdated, so no update is offered. Ahead of the bundle means there is nothing this build can prove an update would change; offering one risks the provably-unperformable update (#11110) when source HEAD still equals the lock. When a future build bundles a newer revision, the copy classifiesoutdatedvia the snapshot registry and the offer returns on its own.Why trusting the lock is sound (verified against
skillsCLI v1.5.20 source, vercel-labs/skills)skillFolderHashfor GitHub sources is the git tree SHA of the skill folder (Trees API entrytype === 'tree',blob.tsgetSkillFolderHashFromTree; schema comment inskill-lock.ts:26-31). Git tree shas cover contents, modes, symlinks, and nested dirs — sha equality is byte-for-byte folder equality.add.tsinstalls first (installSkillForAgent/installBlobSkillForAgent), then writes lock entries only for skills insuccessfulSkillNames(add.ts~1809-1856). Every mismatch scenario (clone-vs-tree race, skipped file, torn lock write, interrupted install) makes disk ≠ lock and fails closed to today's amber behavior.latestHash !== entry.skillFolderHash(update.ts:373-375,:410-411) — lock vs source, never disk. That's why a stale lock can never be converged by re-running, and why the scan trusting disk == lock is the only honest read.Proof
unrecognized/amber; no lock entry stays flagged; a same-name independent copy at the lock's own sha is not trusted; plugin-cache behavior untouched; anewer-known-only skill produces no dialog row (would recreate the badge/dialog disagreement fix(skills): stop the skill review dialog contradicting the badge that opens it #11128 removed, from the other side).write-treein an isolated GIT_DIR), not Orca's own tree-sha port.Live A/B (real app, isolated $HOME, real-git-hashed lock; fresh main process per side)
Fixture: bundled
orchestration+orca-clicopied to$HOME/.agents/skillswith an appended line (unknown to every bundled snapshot), provider symlinks, lock v3 with each folder's realgit write-treesha.origin/main @ a721125 (includes #11128/#11248) — scan:
unrecognizeddespite sha == lock; sidebar + pill amber "Needs attention"; Details now shows the full misleading advice for both of the CLI's own installs:this branch @ 2979851, same fixture — scan:
newer-known; sidebar + pill "Up to date", no attention affordance, no "modified" text anywhere:Live negative control on this branch: appending one more line (lock not updated) flips the same skill back to
unrecognized/ "Needs attention" on Re-check; restoring the bytes flips it green again.Pre-rebase A/B against a6423d5 (before #11128 landed)
Same fixture and result at the badge/pill level. One rig note from that round: the dialog could not render the "may be modified… Remove it" sentence there, because before #11128 the dialog only listed outdated-or-pinned skills — the badge said "Needs attention" while the dialog said "All installed Orca skills are up to date":