Skip to content

fix(skills): stop calling the updater's own install a modified copy - #11249

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/skill-scan-trusts-lock
Jul 29, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/skill-scan-trusts-lock

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

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)

  • Scan (skill-freshness-inventory.ts): a canonical/provider-alias placement classified unrecognized whose observed git tree sha equals the lock's skillFolderHash is the CLI's own install — reclassify to newer-known. Judged only over the placements the update command writes; a same-name copy elsewhere earns no trust from someone else's lock entry.
  • Display: newer-known is 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 inline hasBlockedCopy loop in getSkillFreshnessDisplayStatus, and the shared isSkillCopyNeedingAttention predicate (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 newer chip + skipped-reason copy already give a pinned post-run newer-known row honest wording ("later version… Orca left it alone rather than roll it back").

Eligibility deliberately unchanged: newer-known still doesn't produce hasOutdated, 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 classifies outdated via the snapshot registry and the offer returns on its own.

Why trusting the lock is sound (verified against skills CLI v1.5.20 source, vercel-labs/skills)

  • skillFolderHash for GitHub sources is the git tree SHA of the skill folder (Trees API entry type === 'tree', blob.ts getSkillFolderHashFromTree; schema comment in skill-lock.ts:26-31). Git tree shas cover contents, modes, symlinks, and nested dirs — sha equality is byte-for-byte folder equality.
  • The lock is written only after the files land: add.ts installs first (installSkillForAgent/installBlobSkillForAgent), then writes lock entries only for skills in successfulSkillNames (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.
  • Its update predicate is 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.
  • Non-GitHub sources record a custom sha256 (64 hex) that can never equal a 40-hex tree sha — the new path is inert there, again failing closed.

Proof

  • Fail-first: the new tests are red with the fix reverted (both on the original base a6423d5 and re-verified after rebasing onto a721125).
  • Per-half mutation (re-run post-rebase): reverting the scan half alone → 2 tests fail; reverting the whole display half → 2 fail; reverting ONLY the shared-predicate exemption → 2 fail (display unit + grouping row test); reverting ONLY the inline-loop exemption → 2 fail. No piece is silently removable.
  • Must-not-weaken: sha ≠ lock stays 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; a newer-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).
  • Unit tests hash fixtures with real git (write-tree in 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-cli copied to $HOME/.agents/skills with an appended line (unknown to every bundled snapshot), provider symlinks, lock v3 with each folder's real git write-tree sha.

origin/main @ a721125 (includes #11128/#11248) — scan: unrecognized despite sha == lock; sidebar + pill amber "Needs attention"; Details now shows the full misleading advice for both of the CLI's own installs:

A2-details-dialog.png

this branch @ 2979851, same fixture — scan: newer-known; sidebar + pill "Up to date", no attention affordance, no "modified" text anywhere:

B2-orchestration-green.png

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":

A-orchestration-amber.png
A-details-dialog.png
B-orchestration-green.png

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updater-lock hashes now allow supported global skill installations with matching canonical bytes to be classified as newer-known. Inventory tests cover matching hashes, mismatches, and same-name copies outside lock-written placements. Renderer freshness logic treats newer-known installations as up to date while still reporting unrecognized copies. TypeScript configuration now includes the renderer freshness-status module.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately reflects the main change: reclassifying the updater's own installed skill as not modified.
Description check ✅ Passed It covers the bug, fix, screenshots, testing evidence, risk analysis, and notes, but the required template headings aren't used verbatim.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

Comment thread config/tsconfig.node.json
@@ -4,6 +4,7 @@
"../electron.vite.config.*",
"../build-plugins/**/*",
"../src/main/**/*",
"../src/renderer/src/lib/skill-freshness-display-status.ts",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 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-apps

greptile-apps Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

This 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.

  • Scan half (skill-freshness-inventory.ts): Introduces trustLockInstalledRevision, which reclassifies a canonical/provider-alias placement from unrecognized to newer-known when its computed git tree SHA matches the skillFolderHash in the updater lock — scoped exclusively to the topologies the update command writes, so an independent copy at the same name earns no trust from the lock.
  • Display half (skill-freshness-display-status.ts, skill-freshness.ts): Adds newer-known to the exemption list alongside current in both isSkillCopyNeedingAttention (shared) and getSkillFreshnessDisplayStatus (renderer), keeping the badge and the dialog they open in agreement. Update eligibility is deliberately left unchanged so no update is offered for content that is ahead of this build.

Confidence Score: 5/5

Safe 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.

Important Files Changed

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.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/skill-scan-trusts-lock branch from 9f44f60 to 2979851 Compare July 29, 2026 00:20
@brennanb2025
brennanb2025 merged commit 681c4ba into main Jul 29, 2026
38 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/skill-scan-trusts-lock branch July 29, 2026 00:27
zpyoung pushed a commit to zpyoung/orca that referenced this pull request Jul 29, 2026
…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.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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.
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.

1 participant