Skip to content

fix(skills): match official skill files despite local sidecars - #12812

Merged
Jinwoo-H merged 2 commits into
stablyai:mainfrom
innocarpe:fix/skill-update-extra-file-scope
Aug 6, 2026
Merged

Jinwoo-H merged 2 commits into
stablyai:mainfrom
innocarpe:fix/skill-update-extra-file-scope

Conversation

@innocarpe

Copy link
Copy Markdown
Contributor

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

  • In scope: matchingKnownSnapshot path-keyed subset match
  • Out of scope: changing install/overwrite behavior for sidecar files

Preserves

  • Content drift on any listed official file still fails closed (unrecognized)
  • OS metadata sidecars still ignored at observe time

Evidence

  • Test: pnpm exec vitest run --config config/vitest.config.ts src/main/skills/skill-package-identity.test.ts (8 passed)

User-regression-tradeoffs

  • Extra non-listed files no longer alone block freshness/update eligibility

Fixes #12694

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
@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Skill 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)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the fix and test evidence but omits the required template sections for screenshots, testing, AI review, security audit, and notes. Add the required Summary, Screenshots, Testing, AI Review Report, Security Audit, and Notes sections.
Docstring Coverage ⚠️ Warning Docstring coverage is 46.15% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main fix: matching official skill files when local sidecars exist.
Linked Issues check ✅ Passed The changes implement manifest-listed path matching and preserve rejection of official-file drift, satisfying the requirements in [#12694].
Out of Scope Changes check ✅ Passed The lock and convergence updates support the same sidecar-tolerance objective and do not introduce unrelated changes.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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 Jinwoo-H left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
  • convergableSkillNames re-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 main too. Closing it means naming foreign sidecar paths at observe time, which is a different posture call.
  • skills update deletes 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8e0dfeb and 6663650.

📒 Files selected for processing (10)
  • src/main/skills/skill-freshness-inventory.test.ts
  • src/main/skills/skill-freshness-inventory.ts
  • src/main/skills/skill-freshness-placement-observation.ts
  • src/main/skills/skill-package-identity.test.ts
  • src/main/skills/skill-package-identity.ts
  • src/main/skills/skill-update-convergence.test.ts
  • src/main/skills/skill-update-convergence.ts
  • src/main/skills/skill-update-outcome.ts
  • src/main/skills/skill-update-registration.ts
  • src/shared/skill-freshness.ts

Comment on lines +320 to +328
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)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 with lockHash.
  • src/main/skills/skill-package-identity.test.ts#L218-L248: Add a hash test with both an upstream-added file and agents/openai.yaml.
  • src/main/skills/skill-freshness-inventory.test.ts#L318-L378: Add an integration test that keeps this combined placement newer-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-L48
  • src/main/skills/skill-package-identity.test.ts#L218-L248
  • src/main/skills/skill-freshness-inventory.test.ts#L318-L378

@Jinwoo-H
Jinwoo-H merged commit 12472b8 into stablyai:main Aug 6, 2026
56 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Skill update is skipped for byte-identical skills when the folder contains a file outside the manifest's own files list

2 participants