Repository navigation
fix(skills): stop the scan issue budget evicting a read failure - #11221
Conversation
The per-scan issue budget kept an issue only when it explained a candidate or truncated the walk. Neither set intersects the attention set, so 'io-error' — the sole reason a plugin-cache scan can raise "Needs attention" — was droppable. Once 16 ordinary issues filled the budget (16 'outside-root' vendor symlinks is an install shape the scan itself documents as normal), a later read failure was evicted for a generic 'issue-limit' row that raises neither attention nor truncation, and the dialog headline read "All installed Orca skills are up to date" over a path that could be hiding a stale copy. Attention issues now outrank the budget, capped at a small reserve so an adversarial tree of unreadable folders cannot pin one issue per folder.
Greptile SummaryThis PR fixes a silent false-negative in the plugin skill freshness scanner:
Confidence Score: 5/5Safe to merge. The change is narrowly scoped to the issue-recording budget inside the plugin cache scan, leaves the walk, update verdict, and convergence gate untouched, and is backed by two new tests that were red on main. The fix is logically sound across all orderings of attention vs. non-required issues: sequential awaits prevent any race on Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/shared/skill-freshness.ts | Extracts isSkillScanAttentionReason as a reason-level predicate; isSkillScanIssueNeedingAttention now delegates to it. Clean, additive refactor with no behavioral change to existing callers. |
| src/main/skills/skill-plugin-cache-scan.ts | Adds attentionIssueCount and MAXIMUM_PLUGIN_SCAN_ATTENTION_ISSUES = 4 to allow io-error issues to bypass the 16-slot display budget up to a bounded reserve. Logic is sequential (no async races), deduplication via issueKeys is preserved, and the issue-limit sentinel fires correctly for both early and late attention issues. |
| src/main/skills/skill-plugin-cache-scan.test.ts | Adds two targeted regression tests: one verifying the eviction bug is fixed (red on main), one pinning the reserve cap with a mutation-killing assertion. Both skip on Win32 (symlink behaviour parity). createCacheBehindSpentBudget helper is reused cleanly across both cases. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["recordIssue(path, reason, code, explainsCandidate)"] --> B{issueKeys has key?}
B -- yes --> Z[return — duplicate, skip]
B -- no --> C{isSkillScanAttentionReason AND attentionIssueCount < 4?}
C -- yes --> D[attention = true]
C -- no --> E[attention = false]
D --> F{required? explainsCandidate OR attention OR isTruncatingSkillScanReason}
E --> F
F -- required = true --> H[add to issueKeys, increment attentionIssueCount if io-error, push issue]
F -- required = false --> G{issues.length >= 16?}
G -- no --> H
G -- yes --> I{issue-limit already in issues?}
I -- no --> J[push issue-limit sentinel, return]
I -- yes --> K[return — budget spent]
Reviews (1): Last reviewed commit: "fix(skills): stop the scan issue budget ..." | Re-trigger Greptile
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe changes centralize attention-reason classification for skill freshness issues, add a cap of four retained attention-class plugin scan issues, and update scan issue recording to enforce that cap. Tests add cache fixtures with budget-consuming symlinks and verify that late 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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 |
…lyai#11221) The per-scan issue budget kept an issue only when it explained a candidate or truncated the walk. Neither set intersects the attention set, so 'io-error' — the sole reason a plugin-cache scan can raise "Needs attention" — was droppable. Once 16 ordinary issues filled the budget (16 'outside-root' vendor symlinks is an install shape the scan itself documents as normal), a later read failure was evicted for a generic 'issue-limit' row that raises neither attention nor truncation, and the dialog headline read "All installed Orca skills are up to date" over a path that could be hiding a stale copy. Attention issues now outrank the budget, capped at a small reserve so an adversarial tree of unreadable folders cannot pin one issue per folder.
…lyai#11221) The per-scan issue budget kept an issue only when it explained a candidate or truncated the walk. Neither set intersects the attention set, so 'io-error' — the sole reason a plugin-cache scan can raise "Needs attention" — was droppable. Once 16 ordinary issues filled the budget (16 'outside-root' vendor symlinks is an install shape the scan itself documents as normal), a later read failure was evicted for a generic 'issue-limit' row that raises neither attention nor truncation, and the dialog headline read "All installed Orca skills are up to date" over a path that could be hiding a stale copy. Attention issues now outrank the budget, capped at a small reserve so an adversarial tree of unreadable folders cannot pin one issue per folder.
The wrong banner
scanKnownPluginSkillCandidatesbounds how many issues one scan reports. An issue survives that bound only when it isrequired:Neither set intersects the attention set. In
src/shared/skill-freshness.ts,SKILL_SCAN_ATTENTION_REASONSis['io-error']andSKILL_SCAN_TRUNCATING_REASONSis['entry-limit', 'candidate-limit']. Soio-error— the sole reason a plugin-cache scan can raise "Needs attention" — was droppable.Once 16 non-required issues fill the budget, a later read failure is evicted and replaced by a generic
issue-limitrow, which raises neither attention nor truncation. The freshness dialog then reports "All installed Orca skills are up to date" over a path Orca could not read — a path that could be hiding a stale copy of any bundled skill.This is not a contrived shape.
outside-rootis what fills the budget on an ordinary install: the scan's own comments document vendors linking skills out of the cache as normal packaging, and directory entries are walked in alphabetical order, so a read failure that sorts late is exactly the one that gets evicted.The fix
Attention issues now outrank the display budget, reusing the existing shared reason set rather than a second copy of the predicate.
isSkillScanIssueNeedingAttentionis refactored into a reason-levelisSkillScanAttentionReason(mirroring the existingisTruncatingSkillScanReason/isSkillScanIssueTruncatingScanpair) so the main-process scan and the renderer badge stay driven by one set.The bound
explainsCandidatecharging is bounded by the candidate cap; unconditional attention charging would not be. A tree with hundreds of unreadable directories would pin one issue per directory in memory, so this trades a wrong banner for unbounded growth.MAXIMUM_PLUGIN_SCAN_ATTENTION_ISSUES = 4caps the reserve. One kept issue is all the badge needs to be truthful; a few more give the dialog enough distinct paths to read as a pattern, and the existingissue-limitrow still says there are others. Worst case per root is 16 listed + 4 reserved.Tests
keeps a read failure that lands after the display budget is spent— 16outside-rootlinks, then anELOOPlink sorting later. Verified red onorigin/main(70c81c4b32): the scan returned 16outside-rootrows plusissue-limit, with theio-errorabsent.bounds how many read failures outrank the display budget— pins the reserve. Verified it kills the mutation that drops the cap (8 kept vs 4 expected).No existing test was weakened.
Scope
Only the scan issue budget. The update verdict, convergence gate, and updater are untouched.
Checks
pnpm typecheck(after clearingtsbuildinfo),oxlint, both code-quality audits, max-lines ratchet, and 209 skills tests across 22 files — all green.