Skip to content

fix(skills): stop the scan issue budget evicting a read failure - #11221

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/skill-scan-keeps-attention-issue
Jul 28, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/skill-scan-keeps-attention-issue

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

The wrong banner

scanKnownPluginSkillCandidates bounds how many issues one scan reports. An issue survives that bound only when it is required:

const required = explainsCandidate || isTruncatingSkillScanReason(reason)

Neither set intersects the attention set. In src/shared/skill-freshness.ts, SKILL_SCAN_ATTENTION_REASONS is ['io-error'] and SKILL_SCAN_TRUNCATING_REASONS is ['entry-limit', 'candidate-limit']. So io-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-limit row, 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-root is 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. isSkillScanIssueNeedingAttention is refactored into a reason-level isSkillScanAttentionReason (mirroring the existing isTruncatingSkillScanReason / isSkillScanIssueTruncatingScan pair) so the main-process scan and the renderer badge stay driven by one set.

The bound

explainsCandidate charging 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 = 4 caps 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 existing issue-limit row 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 — 16 outside-root links, then an ELOOP link sorting later. Verified red on origin/main (70c81c4b32): the scan returned 16 outside-root rows plus issue-limit, with the io-error absent.
  • 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 clearing tsbuildinfo), oxlint, both code-quality audits, max-lines ratchet, and 209 skills tests across 22 files — all green.

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

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a silent false-negative in the plugin skill freshness scanner: io-error issues could be evicted from the display budget by 16 outside-root entries that sort alphabetically earlier, causing the UI to report "All installed Orca skills are up to date" over a path that could not be read. The fix promotes io-error issues to "required" in recordIssue, allowing them to bypass the 16-slot display budget up to a cap of 4, bounded to prevent unbounded memory growth on pathological trees.

  • skill-freshness.ts: Extracts isSkillScanAttentionReason(reason) as a reason-level predicate (mirroring the existing isTruncatingSkillScanReason / isSkillScanIssueTruncatingScan pair), and delegates the existing isSkillScanIssueNeedingAttention to it — a single definition now drives both the scan and the renderer badge.
  • skill-plugin-cache-scan.ts: Adds MAXIMUM_PLUGIN_SCAN_ATTENTION_ISSUES = 4 and an attentionIssueCount tracker; attention issues are "required" (bypass the 16-slot budget) until the reserve is exhausted, after which normal issue-limit handling applies.
  • Tests: Two new scenarios — one verifying the eviction fix is live, one pinning the reserve cap — both confirmed red on origin/main.

Confidence Score: 5/5

Safe 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 attentionIssueCount, the issueKeys deduplication gate is preserved, and the issue-limit sentinel fires correctly whether attention issues arrive before or after the display budget is spent.

Files Needing Attention: No files require special attention.

Important Files Changed

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]
Loading

Reviews (1): Last reviewed commit: "fix(skills): stop the scan issue budget ..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a685982-abbd-4796-b948-5ead0fdaed84

📥 Commits

Reviewing files that changed from the base of the PR and between 6d4e335 and 70882de.

📒 Files selected for processing (3)
  • src/main/skills/skill-plugin-cache-scan.test.ts
  • src/main/skills/skill-plugin-cache-scan.ts
  • src/shared/skill-freshness.ts

📝 Walkthrough

Walkthrough

The 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 ELOOP read failures remain surfaced, are classified as requiring attention, and are bounded with an issue-limit issue.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is missing required template sections, including Screenshots, AI Review Report, Security Audit, and Notes. Restructure the PR description to the required template and add the missing sections, especially Screenshots, AI Review Report, Security Audit, and Notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: preserving read failures from scan issue-budget eviction.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 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.

@brennanb2025
brennanb2025 merged commit 930ff96 into main Jul 28, 2026
39 checks passed
zpyoung pushed a commit to zpyoung/orca that referenced this pull request Jul 29, 2026
…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.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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.
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