Repository navigation
fix(skills): match official skill files despite local sidecars - #12812
Conversation
Scope known-snapshot matching to manifest-listed files so agent-written sidecars (e.g. agents/openai.yaml) no longer mark a package unrecognized and block updates when official bytes still match. Preserves fail-closed detection when a listed file's content drifts. Fixes stablyai#12694
📝 WalkthroughWalkthroughSkill package identity now tracks per-file Git entries, matches snapshots by path against current official paths, and computes an official-path tree hash. Sidecar files can remain outside official-path identity, while tampered official files prevent snapshot matches. Freshness and update outcome logic use shared lock matching. Update convergence now resolves installations by release revision and validates all observable placements. Tests cover sidecars, upstream additions, stale revisions, plugin-cache copies, and packages without official paths. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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 |
Sidecar tolerance stopped at the snapshot match, leaving three disk-vs-official comparisons still judging the whole folder. The lock-comparable hash covered every observed file, so a clean update beside agents/openai.yaml reported as failed and read 'may be modified'. It is now carried both whole and scoped to the current bundle's paths, and either may satisfy the lock: the sidecar case only ever matches scoped, while an upstream revision that ADDS a file only ever matches whole, so publishing one alone would trade this bug for stablyai#11220. Convergence re-derived the disk revision from that same whole-folder digest, which no revision matches once a sidecar lands, retiring the stuck-lock gate and arming an update the command provably cannot perform; it now honours the revision observation already resolved. Subset matching also let an older revision launder drift on a file the current bundle lists, since that revision does not list it and so read it as a neighbour. Identity now keys tolerance on what the current bundle owns.
Jinwoo-H
left a comment
There was a problem hiding this comment.
Thanks for this — the diagnosis is right and the linked issue is a real P0. Freshness was requiring the folder to match the manifest entry for entry, so one unrelated neighbour made a byte-identical skill read "may be modified" and dropped it from the update list permanently.
Worth stating plainly for anyone reading later: this was entirely ours. npx skills update does not care about extra files — I planted an agents/openai.yaml and ran it directly, and it updated the folder without complaint. Orca simply never asked on the user's behalf.
I pushed a follow-up commit rather than send this back, since the fix was incomplete in ways that only show up downstream.
Sidecar tolerance stopped at the snapshot match. Three other comparisons still judged the whole folder:
- The lock-comparable folder hash still covered every observed file, so a successful update beside a sidecar reported as failed and kept reading "may be modified". It is now carried both whole and scoped to the current bundle's paths, and either may satisfy the lock — the sidecar case only ever matches scoped, an upstream revision that adds a file only ever matches whole, so publishing one alone just trades this bug for #11220. There is a test for each direction.
convergableSkillNamesre-derived the disk revision from that same whole-folder digest, which matches no revision once a sidecar lands. The stuck-lock gate silently retired itself and would arm an update the command provably cannot perform. It now uses the revision observation already resolved.- Subset matching let an older revision launder drift on a file the current bundle lists, since that revision does not list it and so read it as a neighbour — a tampered package reporting as merely outdated, with an update offered and no amber anywhere. Tolerance now keys on what the current bundle owns. Latent today (every bundled skill is a single
SKILL.md) and live the first time one ships a second file.
Also: the original commit fails skill-freshness-inventory.test.ts (keeps a plugin-cache copy with known official files unrecognized). That test encoded the old fail-closed posture, so I rewrote it to encode the new one rather than delete it. Worth running the whole src/main/skills suite rather than the single identity file.
Validation. 180 tests in src/main/skills (was 174); typecheck and lint clean. Every new test verified to fail when its specific fix is reverted. Perf audit: +0.85 µs per placement against a 137 µs baseline, no new I/O and no retention spanning an await. Verified live in the app with a real sidecar in ~/.agents/skills/computer-use/ — amber "Review skill" before, green "Up to date" after, same machine, same file.
Known gaps, none of them regressions:
- A folder holding both a sidecar and an upstream-added file matches neither hash and stays unrecognized. Broken on
maintoo. Closing it means naming foreign sidecar paths at observe time, which is a different posture call. skills updatedeletes the sidecar when it runs — it wipes and recreates the folder. That is the installer's behavior with or without Orca, but it does mean this fix restores updates without preserving the neighbour that motivated it.- Symlinked extras and folders past the observation size limits still read unrecognized. Pre-existing and orthogonal.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8a658aca-f37f-47af-8490-64f3f2ba9146
📒 Files selected for processing (10)
src/main/skills/skill-freshness-inventory.test.tssrc/main/skills/skill-freshness-inventory.tssrc/main/skills/skill-freshness-placement-observation.tssrc/main/skills/skill-package-identity.test.tssrc/main/skills/skill-package-identity.tssrc/main/skills/skill-update-convergence.test.tssrc/main/skills/skill-update-convergence.tssrc/main/skills/skill-update-outcome.tssrc/main/skills/skill-update-registration.tssrc/shared/skill-freshness.ts
| export function officialPathsGitTreeSha( | ||
| observed: ObservedSkillPackage, | ||
| officialPaths: ReadonlySet<string> | ||
| ): string { | ||
| const scoped = observed.treeEntries.filter((entry) => officialPaths.has(entry.path)) | ||
| return scoped.length === 0 || scoped.length === observed.treeEntries.length | ||
| ? observed.observedGitTreeSha | ||
| : skillPackageGitTreeSha(scoped) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Preserve lock matching when an upstream file and a sidecar coexist.
A package with an upstream-added unlisted file and agents/openai.yaml matches neither current hash. The whole-tree hash includes the sidecar. The scoped hash removes the upstream file. matchesUpdaterLock then returns false, so skillPlacementLanded reports a successful update as failed.
src/main/skills/skill-package-identity.ts#L320-L328: Add a lock-comparison identity that excludes recognized agent sidecars but retains other observed files.src/main/skills/skill-update-registration.ts#L44-L48: Compare the new identity withlockHash.src/main/skills/skill-package-identity.test.ts#L218-L248: Add a hash test with both an upstream-added file andagents/openai.yaml.src/main/skills/skill-freshness-inventory.test.ts#L318-L378: Add an integration test that keeps this combined placementnewer-known.
Based on the PR objective, unowned sidecars must not block updates.
📍 Affects 4 files
src/main/skills/skill-package-identity.ts#L320-L328(this comment)src/main/skills/skill-update-registration.ts#L44-L48src/main/skills/skill-package-identity.test.ts#L218-L248src/main/skills/skill-freshness-inventory.test.ts#L318-L378
…yai#12812) * fix(skills): match official skill files despite local sidecars Scope known-snapshot matching to manifest-listed files so agent-written sidecars (e.g. agents/openai.yaml) no longer mark a package unrecognized and block updates when official bytes still match. Preserves fail-closed detection when a listed file's content drifts. Fixes stablyai#12694 * fix(skills): scope lock trust and convergence to official files too Sidecar tolerance stopped at the snapshot match, leaving three disk-vs-official comparisons still judging the whole folder. The lock-comparable hash covered every observed file, so a clean update beside agents/openai.yaml reported as failed and read 'may be modified'. It is now carried both whole and scoped to the current bundle's paths, and either may satisfy the lock: the sidecar case only ever matches scoped, while an upstream revision that ADDS a file only ever matches whole, so publishing one alone would trade this bug for stablyai#11220. Convergence re-derived the disk revision from that same whole-folder digest, which no revision matches once a sidecar lands, retiring the stuck-lock gate and arming an update the command provably cannot perform; it now honours the revision observation already resolved. Subset matching also let an older revision launder drift on a file the current bundle lists, since that revision does not list it and so read it as a neighbour. Identity now keys tolerance on what the current bundle owns. --------- Co-authored-by: Jinwoo-H <[email protected]>
Description
Treat a skill placement as matching a known snapshot when every manifest-listed file matches, even if local sidecars exist (e.g.
agents/openai.yaml).This unblocks skill updates that were permanently skipped as "modified" despite byte-identical
SKILL.md.Focused fix
matchingKnownSnapshotpath-keyed subset matchPreserves
Evidence
pnpm exec vitest run --config config/vitest.config.ts src/main/skills/skill-package-identity.test.ts(8 passed)User-regression-tradeoffs
Fixes #12694