Skip to content

fix(skills): keep a failed update run honest when nothing converged - #11112

Closed
brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/skill-update-exit-code-honesty
Closed

brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/skill-update-exit-code-honesty

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

What regressed

#11105 (a866083) reclassified outdated as not-a-failed-run so a clean-exit lock-drift no-op stops arming the red banner + Retry loop. Correct — but finish() in src/main/skills/skill-update-run.ts discards spawnError whenever the re-scan verdict is empty (failedNames ?? (spawnError ? names : []) short-circuits on []). Pre-#11105 an empty verdict proved the requested skills converged; post-#11105 it also covers "left old and untouched".

Exact false-success path: offline / npx ENOENT / non-zero exit -> CLI writes nothing -> skills still merely outdated -> verdict [] -> run publishes green "Updated N skills" and a green status-bar check, masking the process failure.

Fix

Thread the command's own result into the verdict (the cheap honest signal — no pre-run state, no stdout parsing):

  • skill-update-run.ts: rescan(names, spawnError !== null)
  • ipc/skills.ts: forwards the flag
  • skill-update-outcome.ts: outdated is forgiven only when the CLI reported success; current/newer-known still count as landed even on a failed exit (a peer skill can fail the process — preserves the tested behavior)

The #11105 core fix survives: exit 0 + outdated -> success, no banner, no Retry.

Test evidence

  • pnpm vitest run outcome + run + ipc/skills tests: 38/38 pass
  • Mutation 1 — forgive outdated unconditionally: still blames an outdated copy when the command itself failed fails (1/12)
  • Mutation 2 — runner always passes commandFailed=false: reports the failure when the command failed and nothing converged fails (1/20)
  • Peer-skill pin (treats a clean re-scan as success even though the exit code is non-zero) and both fix(skills): stop reporting a failed update when the CLI succeeded #11105 reversal pins still pass
  • rm -f config/*.tsbuildinfo && pnpm run tc: clean

a866083 stopped blaming the run for copies `skills update` merely leaves
old (lock drift: the CLI compares its lock to the source, prints up-to-date,
exits 0, writes nothing). But finish() discards the spawn error whenever the
re-scan verdict is empty — so after that change an offline or ENOENT run whose
skills stayed merely outdated published green "Updated N skills".

Thread the command's own result into the verdict: `outdated` is forgiven only
when the CLI reported success. Current/newer-known copies still count as landed
even on a non-zero exit (a peer skill can fail the process), and the clean-exit
lock-drift case still settles success.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: superseded by the revert in #11110. This patched the spawnError/exit-code interaction inside the forgiven-outdated semantics from a866083, but the forgiveness itself was the wrong layer — on the exact user-reported path (clean exit 0, CLI no-ops off its lock cache) it turns a universal false red into a universal false green. The real fix is upstream eligibility gating (don't offer an update the command cannot converge: lock skillFolderHash vs the disk revision's gitTreeSha via matchingKnownSnapshot in skill-package-identity.ts), owned by @nwparker on nwparker/fix-skill-updater-registration. The exit-code-honesty test pins in this branch are worth carrying into that work.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 95ea3424-afd2-4a8d-8086-d0ba63199096

📥 Commits

Reviewing files that changed from the base of the PR and between 54ed8c2 and cd7d98a.

📒 Files selected for processing (5)
  • src/main/ipc/skills.ts
  • src/main/skills/skill-update-outcome.test.ts
  • src/main/skills/skill-update-outcome.ts
  • src/main/skills/skill-update-run.test.ts
  • src/main/skills/skill-update-run.ts

📝 Walkthrough

Walkthrough

Skill update outcome evaluation now accepts a command failure flag. Outdated placements are forgiven only when the update command succeeds; they can count as failures when the command fails. SkillUpdateRunner passes this state to its rescan dependency, IPC wiring forwards it to outcome evaluation, and tests cover both successful and failed command scenarios.

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

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