Skip to content

feat(skills): run skill updates in the background without a terminal - #10843

Merged
brennanb2025 merged 5 commits into
mainfrom
brennanb2025/feedback-terminal-visibility-ux
Jul 28, 2026
Merged

brennanb2025 merged 5 commits into
mainfrom
brennanb2025/feedback-terminal-visibility-ux

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Update skills dialog had no primary action at all. Its footer was only Re-check and Close — the real action was a pre-filled command sitting in an embedded PTY that you had to click into and press Enter on. Orca already builds and validates that command, so it now just runs it.

  • The terminal is gone from the default path. A headless runner in main executes npx --yes skills update <names> --global -y.
  • The run is backgrounded. Closing the dialog no longer cancels it — main owns the run, and the status bar carries it.
  • Status-bar segment next to the memory/terminal indicators: spinner while running, a green check on success that clears itself after 4s, and a failure that persists until you act on it. Clicking it reopens the dialog.
  • Versions dropped from the rows; the skill list and skip reasons are visible instead of hidden behind a disclosure.

Linear

Part of STA-664 — Improve Orca agent skill update flow.

That ticket asks for a safe update path instead of "sending users to Settings -> CLI", and specifies the exact command form:

npx --yes skills update orchestration --global --yes

Avoid plain npx skills update -y because it infers scope from cwd and can update the wrong scope.

This PR ships that verbatim — npx --yes skills update <names> --global -y, with --global explicit — plus the ticket's safety preconditions: the skill must already be installed, be one of Orca's managed skills, and sit in tracked global/home scope (SUPPORTED_GLOBAL_SKILL_TOPOLOGIES gates eligibility). Its fallback rule is honoured too: on failure the dialog surfaces the error and the exact command to copy rather than retrying background writes.

Not closing the ticket. STA-664's headline ask is auto-update at user-intent boundaries (starting an orchestration workflow, opening a Linear-linked worktree, first computer-use attempt), plus per-runtime scoping and a failure cooldown. This PR builds the mechanism those triggers would call, but the triggers themselves aren't here — so it's Part of, not Fixes.

Why it's shaped this way

I unpacked [email protected] and read dist/cli.mjs rather than guessing at its capabilities:

  • update has no --json. parseUpdateOptions matches only -g, -p, -y, and positional names; options.json is set solely in parseListOptions. Unknown flags are silently dropped, so passing --json would look accepted and do nothing.
  • Progress granularity is per-source, not per-skill. updateGlobalSkills groups by bySource and does one fetchRepoTree for the whole group. Every Orca skill shares one source, so the slow network phase is a single opaque step. Per-skill progress does not exist to be shown, however you parse.
  • So the progress bar is deliberately indeterminate rather than a faked percentage, and per-skill outcomes come from re-scanning inventorySkillFreshness after exit — anything still in eligibleUpdateNames didn't land. That's byte-level ground truth needing zero parsing. When the re-scan has a verdict it outranks the exit code.
  • Captured output is shown verbatim under Show log and never parsed.

Both --yes flags are load-bearing and separately tested: npx --yes skips the package-install prompt, skills … -y takes the CLI's own non-interactive branch. stdin is 'ignore' so process.stdin.isTTY stays falsy — the other half of that gate.

Also fixed

A width bug the collapsed disclosure used to hide: deep plugin-cache paths set the dialog's width and pushed the footer actions off-screen. Caught only by running the real app.

Screenshots

The dialog

Every state is the same row component — pressing Update changes the row in place rather than swapping the dialog's body for a different layout. A test asserts the row is literally the same DOM node from available through pending to done.

Before running. One row per skill, with the badge immediately right of the name. Locations are collapsed behind a per-skill disclosure with a count, instead of every path being dumped inline.

ready

Expanded. Paths and their chips on demand.

expanded

Running. The row keeps its place and its right edge; the badge gives way to a pending circle left of the name. Indeterminate bar, because the CLI reports no parseable progress.

running

Success. Per-skill checks, sourced from the post-run re-scan rather than stdout.

success

Failure. Same row, red glyph, reason inline, with the exact command to copy.

failed

Status bar (the run survives closing the dialog)

Spinner while running:

bar running

Green check on success:

bar success

Then it retires itself after 4s:

bar cleared

## Testing
  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions

Verified end-to-end in the real app against genuinely-outdated orca-linear and orchestration, driven through the actual nudge → dialog → button:

  • Both went outdated → current on disk; eligibleUpdateNames emptied.
  • Closing mid-run left state running — it does not cancel.
  • Status segment showed spinner → green check → cleared itself.

New tests: runner arg construction (both --yes flags, sorted names), stdin-ignore, shell-syntax name rejection, single-run guard, ANSI/CR stripping, re-scan-outranks-exit-code, re-scan failure fallback, cancel, acknowledge. Dialog tests rewritten for the no-terminal UI. Status-segment lifecycle covered including the success linger and error persistence.

⚠️ Pre-existing failure, not from this PR: verify:localization-coverage flags unlocalized "Ghostty" keywords in terminal-advanced-platform-search.ts and terminal-pane-appearance-search.ts. Reproduces identically with this branch stashed.

AI Review Report

Built and reviewed with Claude Code. Risks checked:

  • Fabricated progress data — the original design showed per-skill spinners and stage labels. Reading the CLI source proved that data doesn't exist during the slow phase; those states were removed rather than faked.
  • Exit code vs. disk truth — first implementation let a non-zero exit override a clean re-scan. A test caught the contradiction with its own comment; the re-scan now wins when it has a verdict.
  • Interactive wedge — confirmed both of the CLI's prompt sites gate on options.yes || !process.stdin.isTTY before removing the PTY, so a headless run can't block on input nobody can answer.
  • Cross-platform — resolveCliCommand + getSpawnArgsForWindows handle npx.cmd on Windows; PATH comes from the existing hydrateShellPath login-shell rail, which is what makes nvm/conda setups resolve.
  • max-lines — the dialog crossed the 400-line cap; split into skill-freshness-summary-headline.tsx rather than adding a disable (per AGENTS.md).

Known gaps: the runner targets this machine's global skill homes only — WSL/SSH hosts still fall outside it, matching the existing freshnessInventory scope. fetchRepoTree needs getGitHubToken; without one the CLI prints "Failed to fetch tree" and no-ops, which the re-scan correctly reports as a failure but which I did not exercise live.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a validated skill update runner with inventory-based outcome detection, cancellation, output handling, and lifecycle state. Wires the runner through main-process IPC and preload APIs, including a web fallback. Replaces the freshness dialog’s terminal flow with run-state-driven progress, results, logs, retry, and cancellation UI. Adds renderer state storage, grouped skill rows, localized copy, and a status-bar indicator for ongoing and completed updates.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.71% 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
Title check ✅ Passed The title clearly matches the main change: background skill updates without a terminal.
Description check ✅ Passed The description covers summary, screenshots, testing, and AI review; only optional Security Audit/Notes sections are missing.
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.

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.

@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: 4

🧹 Nitpick comments (6)
src/main/skills/skill-update-run.ts (2)

77-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Swallowed spawn-resolution failure is reported as invalid-names.

A getSpawnArgsForWindows throw is a launcher-resolution problem, not bad input; the caller and UI will blame the skill names, and the underlying error is discarded. At minimum log it before returning.

♻️ Suggested change
     try {
       ;({ spawnCmd, spawnArgs } = getSpawnArgsForWindows(npxCommand, npxArgs))
-    } catch {
+    } catch (error) {
+      console.error('[skill-update] failed to resolve npx spawn args:', error)
       return { started: false, reason: 'invalid-names' }
     }

97-107: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Decode chunks with a stateful decoder.

chunk.toString('utf8') per data event can split a multi-byte character (and an ANSI sequence) across chunks, leaking replacement chars/raw escapes into the displayed log. new StringDecoder('utf8') per stream keeps the tail intact.

src/main/skills/skill-update-run.test.ts (1)

116-130: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

No case emits close after error.

The real ENOENT sequence is error then close; emitting only error hides the double-settle path in SkillUpdateRunner.settle. Adding child.emit('close', null) after the error emit here would pin the one-shot behaviour.

src/main/ipc/skills.ts (1)

58-63: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Validate element types, not just the array.

Array.isArray lets a non-string element through; canonicalizeSkillUpdateNames sorts with localeCompare, which throws on a non-string and rejects the invoke instead of returning { started: false, reason: 'invalid-names' }. The neighbouring skills:discover handler already validates with a schema.

♻️ Suggested change
-      return runner.start(Array.isArray(names) ? names : [])
+      return runner.start(
+        Array.isArray(names) ? names.filter((name): name is string => typeof name === 'string') : []
+      )
src/renderer/src/components/skills/SkillFreshnessUpdateDialog.test.tsx (1)

250-277: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Retry is asserted present but never exercised.

findButton('Retry') only checks rendering. Clicking it and asserting startUpdateRun is called with failedNames (['orchestration'], not the full names) would pin the one behaviour that distinguishes retry from a fresh run.

src/renderer/src/components/skills/SkillFreshnessUpdateDialog.tsx (1)

112-175: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: extract the run headline into its own component.

This PR already pulled SummaryHeadline and SkillUpdateResultRows into sibling modules; a RunHeadline({ run, summaryKind, eligibleCount, blockedCount }) would apply the same split to this ~60-line IIFE and keep the dialog body readable.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 07f1335c-0363-43a8-9e42-cf481c5c76bf

📥 Commits

Reviewing files that changed from the base of the PR and between dad3e3c and a109a03283d1cea0535939805a25bb9c768ebb49.

📒 Files selected for processing (22)
  • src/main/ipc/skills.ts
  • src/main/skills/skill-update-run.test.ts
  • src/main/skills/skill-update-run.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.test.tsx
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.tsx
  • src/renderer/src/components/skills/skill-freshness-group.tsx
  • src/renderer/src/components/skills/skill-freshness-summary-headline.tsx
  • src/renderer/src/components/skills/skill-update-result-rows.tsx
  • src/renderer/src/components/skills/skill-update-run-store.ts
  • src/renderer/src/components/status-bar/SkillUpdateStatusSegment.test.tsx
  • src/renderer/src/components/status-bar/SkillUpdateStatusSegment.tsx
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/skill-freshness.ts

Comment thread src/main/skills/skill-update-run.ts Resolved
Comment on lines +89 to 97
if (showResult) {
void acknowledgeSkillUpdateRun()
}
notifyInstalledAgentSkillsChanged()
}

const handleTerminalInteraction = (
method: 'keyboard' | 'pointer',
event?: KeyboardEvent<HTMLElement>
): void => {
if (method === 'keyboard' && event?.key === 'Enter') {
terminalSubmittedRef.current = true
}
const handleUpdate = (): void => {
void startSkillUpdateRun(eligibleNames)
}

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.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Unhandled rejections if the update-run IPC calls fail.

startSkillUpdateRun and acknowledgeSkillUpdateRun just await window.api.skills.* and propagate; void here discards the promise without a rejection handler, so a failing IPC call surfaces as an unhandled rejection rather than anything actionable. Prefer catching at the store (so every caller benefits) or at least logging here.

Note: this differs from the fetchKeybindings() case, which already catches internally.

🛡️ Proposed fix in `skill-update-run-store.ts`
 export async function acknowledgeSkillUpdateRun(): Promise<void> {
-  await window.api.skills.acknowledgeUpdateRun()
+  try {
+    await window.api.skills.acknowledgeUpdateRun()
+  } catch (error) {
+    console.error('Failed to acknowledge skill update run', error)
+  }
 }

Source: Learnings

The Update skills dialog had no primary action at all — its footer was only
Re-check and Close, and the real action was a pre-filled command in an embedded
PTY that the user had to press Enter on. Orca already builds and validates that
command, so it now runs it.

- Add a headless runner for `npx --yes skills update <names> --global -y`. Both
  --yes flags are load-bearing: npx's skips the package-install prompt, and the
  skills CLI's takes its own non-interactive branch. stdin is ignored so
  `process.stdin.isTTY` stays falsy, which is the other half of that gate.
- Own the run in main so closing the dialog backgrounds it instead of killing
  it, and surface it in the status bar: spinner while running, a green check on
  success that clears itself, and a failure that persists until acted on.
- Derive per-skill outcomes by re-scanning the freshness inventory after exit
  rather than parsing stdout. `skills update` has no --json (that flag exists
  only on `list`) and reports progress per-source, not per-skill, so the run
  bar is deliberately indeterminate instead of faking a percentage. When the
  re-scan has a verdict it outranks the exit code.
- Drop the version trail from the rows and surface the skill list and skip
  reasons directly instead of hiding them behind a disclosure.

Also fixes a width bug the collapsed disclosure used to hide: deep plugin-cache
paths set the dialog's width and pushed the footer actions off-screen.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/feedback-terminal-visibility-ux branch from a109a03 to 2384c79 Compare July 27, 2026 04:25
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Rebased onto main (13 commits behind). The only conflicts were the four non-English locale catalogs, which are generated — resolved by taking main's copies and re-running sync:localization-catalog from the merged en.json. en.json and web-preload-api.ts auto-merged. Typecheck, locale verify, and 199 test files / 2609 tests re-run green on the new base. Remote head matches local.

Two notes on CI, since this PR touches src/shared/skill-freshness.ts and therefore triggers Skill update round trip:

  1. Version coverage. I read [email protected] source to establish there's no --json on update; that job pins 1.5.17 plus a continue-on-error latest leg. The flags this depends on (-g, -y) are long-standing, and the --json-only-on-list split is what actually matters — but the two versions aren't identical, so the pinned leg is the real signal.

  2. Possible follow-up, deliberately not in this PR. verify-skill-update-roundtrip.mjs:210 runs update <name> --global under a comment calling it "the exact user-visible rail". As of this PR the shipped rail is npx --yes skills update <names> --global -y. Behavior still matches because CI runs non-TTY and the CLI gates on options.yes || !process.stdin.isTTY, so both paths take the same branch — but the script no longer literally mirrors what ships. Aligning it would be a one-line change; I left it out to keep this PR to one thing.

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

♻️ Duplicate comments (1)
src/main/skills/skill-update-run.ts (1)

109-156: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

settle still lacks a one-shot latch — error then close both pass the guard.

Same issue flagged on a prior commit of this file: settle only checks this.run.state !== 'running' on entry, but state doesn't flip out of 'running' until the async rescan(...).then(finish) resolves. When spawn fails, Node emits error then close; both calls to settle see state === 'running', so both proceed — rescanning twice and letting the close message (skills update exited with code null) overwrite the real spawnError (e.g. spawn ENOENT) the user needs to see.

🩺 Suggested fix: add a settling latch
   private settle(names: string[], spawnError: string | null): void {
-    if (this.run.state !== 'running') {
+    if (this.run.state !== 'running' || this.settling) {
       return
     }
+    this.settling = true
     this.child = null

Clear this.settling = false wherever 'running' is next published (start of start()) and in cancel().

🧹 Nitpick comments (2)
src/renderer/src/components/skills/SkillFreshnessUpdateDialog.test.tsx (1)

152-156: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

emitRun silently no-ops when the dialog never subscribed.

pushRun?.(run) swallows a missing subscription, so a regression in onUpdateRun wiring shows up as confusing text assertions instead of a clear failure.

♻️ Assert the subscription exists
 async function emitRun(run: SkillUpdateRun): Promise<void> {
+  expect(pushRun, 'expected the dialog to subscribe to update-run events').not.toBeNull()
   await act(async () => {
     pushRun?.(run)
   })
 }
src/main/skills/skill-update-run.ts (1)

88-117: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

No timeout on the spawned skills update process.

If the child hangs (network stall, prompt the CLI unexpectedly emits despite the non-interactive gate, etc.), the run stays in 'running' forever with no automatic recovery — only a manual cancel() from the UI can unstick it. Consider adding a watchdog timeout that kills the child and settles the run with a clear timeout message.

♻️ Sketch of a watchdog timeout
     this.child = child
+
+    const timeout = setTimeout(() => {
+      child.kill()
+      this.settle(canonicalNames, 'skills update timed out')
+    }, UPDATE_TIMEOUT_MS)
+    child.once('close', () => clearTimeout(timeout))

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 46ab867a-db3e-461e-97f6-6fb6c60b21e0

📥 Commits

Reviewing files that changed from the base of the PR and between a109a03283d1cea0535939805a25bb9c768ebb49 and 2384c79.

📒 Files selected for processing (22)
  • src/main/ipc/skills.ts
  • src/main/skills/skill-update-run.test.ts
  • src/main/skills/skill-update-run.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.test.tsx
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.tsx
  • src/renderer/src/components/skills/skill-freshness-group.tsx
  • src/renderer/src/components/skills/skill-freshness-summary-headline.tsx
  • src/renderer/src/components/skills/skill-update-result-rows.tsx
  • src/renderer/src/components/skills/skill-update-run-store.ts
  • src/renderer/src/components/status-bar/SkillUpdateStatusSegment.test.tsx
  • src/renderer/src/components/status-bar/SkillUpdateStatusSegment.tsx
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/skill-freshness.ts
🚧 Files skipped from review as they are similar to previous changes (20)
  • src/renderer/src/components/status-bar/StatusBar.tsx
  • src/renderer/src/components/status-bar/SkillUpdateStatusSegment.tsx
  • src/main/ipc/skills.ts
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/skills/skill-update-result-rows.tsx
  • src/renderer/src/i18n/locales/es.json
  • src/preload/index.ts
  • src/renderer/src/components/skills/skill-freshness-group.tsx
  • src/renderer/src/web/web-preload-api.ts
  • src/renderer/src/components/skills/skill-update-run-store.ts
  • src/preload/api-types.ts
  • src/main/skills/skill-update-run.test.ts
  • src/renderer/src/components/skills/skill-freshness-summary-headline.tsx
  • src/shared/skill-freshness.ts
  • src/renderer/src/components/status-bar/SkillUpdateStatusSegment.test.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.tsx

The ready and running views were separate components with different row
shapes, so pressing Update swapped the dialog's body for a different layout.
They are now the same `SkillUpdateRow` instances throughout — only the status
slot's contents change — and a test asserts the row is literally the same DOM
node from "update available" through pending to the result.

- Collapse each skill's locations behind its own disclosure. A skill with
  several plugin-cache copies was dumping every path inline and burying the
  actions; the row now shows a location count and expands on demand.
- Put status in a single slot between the name and the count rather than a
  leading icon column. A leading icon has nothing to show in the resting state
  and reserving its box just indented every name past an empty gap.
- Pin the running/finished run's names in `groupSkillFreshness` so a successful
  update doesn't drop its own rows the instant the re-scan lands.

`skill-freshness-group.tsx` becomes `skill-location-chip-copy.ts` — only its
chip label/tooltip helpers survived, and it no longer holds JSX.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Follow-up commit a63abe6ffb unifies the row layout, per review feedback:

  • The ready and running views were separate components with different row shapes, so pressing Update swapped the dialog's body. They're now the same SkillUpdateRow instances throughout; a test asserts the row is literally the same DOM node across available → pending → done.
  • Locations moved behind a per-skill disclosure with a count, instead of dumping every path inline.
  • Status lives in one slot between the name and the count. A leading icon column had nothing to show at rest and just indented every name past an empty gap.
  • groupSkillFreshness now pins the active run's names so a successful update doesn't drop its own rows the moment the re-scan lands.

Worth flagging from QA. To re-stage an outdated skill I overwrote an installed skill's files behind the skills CLI's back. The CLI's lock still recorded the current hash, so skills update printed ✓ All global skills are up to date and exited 0 without changing anything — and Orca's re-scan correctly reported the skill as still outdated and surfaced a failure.

That's the "re-scan outranks the exit code" rule doing real work: a zero exit that changed nothing is not a success. The same thing would happen to a user who hand-edits an installed skill — the old terminal UI would have shown them a green check while the skill stayed stale.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/renderer/src/components/skills/skill-location-chip-copy.tsx (2)

7-80: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Reuse the shared chip-copy helpers.

Import chipLabel and chipTooltip from skill-location-chip-copy.ts and remove these duplicate mappings. SkillUpdateRow.tsx already uses the exported helpers. Based on supplied graph context, this makes the shared module the single translation mapping source.


127-136: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make location-chip tooltips keyboard reachable.

Both TooltipTrigger instances wrap a Badge that renders as a non-focusable span, so keyboard-only users cannot reach the explanatory tooltip. Use a focusable semantic trigger and provide the project-standard visible focus treatment.

  • src/renderer/src/components/skills/skill-location-chip-copy.tsx#L127-L136: render the chip badge through a focusable tooltip trigger.
  • src/renderer/src/components/skills/SkillUpdateRow.tsx#L123-L132: apply the same accessible trigger structure.
🧹 Nitpick comments (1)
src/renderer/src/components/skills/SkillUpdateRow.tsx (1)

12-19: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Keep component comments concise.

These blocks narrate layout implementation details. Reduce them to a brief rationale-only comment or remove them where the code is self-explanatory. As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.

Also applies to: 49-57

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ca1e67ad-b7d1-423d-92a3-9cd8ef9b5b5a

📥 Commits

Reviewing files that changed from the base of the PR and between 2384c79 and a63abe6.

📒 Files selected for processing (11)
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.test.tsx
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.tsx
  • src/renderer/src/components/skills/SkillUpdateRow.tsx
  • src/renderer/src/components/skills/skill-freshness-grouping.ts
  • src/renderer/src/components/skills/skill-location-chip-copy.ts
  • src/renderer/src/components/skills/skill-location-chip-copy.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.tsx
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.test.tsx

Review feedback on the row header: the badge belongs immediately right of the
name so it reads as part of it, and the run's status circle/check belongs to
the left of the name rather than sharing the badge's slot on the far right.

Name, glyph and badge are now one left-aligned group; the location count and
chevron stay right-aligned. `available` still has no leading glyph — an empty
reserved box only indents the name past a gap with nothing in it.
…and stopping copy

Review fixes for the headless skill-update runner.

Main process:
- Judge per-skill outcomes on a positive signal. "Absent from
  eligibleUpdateNames" is not success: a deleted, half-written, or unreadable
  skill also leaves that list, so a corrupt update reported a green check.
  skillUpdateFailedNames now requires every convergent placement to come back
  current or newer-known.
- Retire a child's handlers with a per-run token. A failed spawn emits error
  *and* close, so the second settle clobbered the real spawn ENOENT; a
  cancelled child could also settle, or write output into, the run that
  replaced it. The token guards the rescan's finish closure too.
- Hold the run `running` until the killed process tree is actually dead.
  Releasing on the synchronous path let an immediate re-Update spawn a second
  npx writing the same bundles, with a watchdog so a sweep that never settles
  cannot wedge the run.
- Kill the tree, not just the npx wrapper, via killWithDescendantSweep.
- Publish an error instead of a silent `started: false` when the cmd.exe rail
  rejects the resolved npx path, which a profile directory containing & or %
  is enough to trigger on Windows.
- Coalesce captured output into one push per tick instead of structured-cloning
  the whole buffer to every window on each progress frame.

Renderer:
- Keep rows on screen while the settling re-scan runs. Refreshing the inventory
  nulls it synchronously, so every row vanished at the moment the result
  appeared. Rows render off the last good scan; eligibility stays on the live
  snapshot so nothing is authorized off stale bytes.
- Retry the names that failed, not the eligibility list that same re-scan has
  just emptied.
- Add Stop, restoring the escape hatch the embedded terminal used to provide,
  and say "stopping" on every surface rather than claiming the update keeps
  running in the background.
- Show a skipped skill's reason outside the disclosure, so it no longer depends
  on a mount-time defaultOpen a later re-scan can never re-fire.
- Drop the summary line telling users to open "Update details", a control this
  PR removes; it was translated into four languages.
- Keep the success linger from retiring a result the open dialog is showing.
- Delete skill-location-chip-copy.tsx: an unreferenced copy of the old row
  component, colliding on basename with the module that is actually imported.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review pass — 23 fixes pushed (af01e09baf)

Reviewed across 6 rounds with three independent adversarial lanes (main-process/IPC, renderer/UX, regression/scope) plus the CodeRabbit comments. All lanes returned clean or non-blocking on the final tree.

Two defects in the PR's core mechanism

The re-scan verdict reported success for broken skills. rescanOutdatedNames treated "no longer in eligibleUpdateNames" as landed — but a name also leaves that list when it's deleted, half-written (unrecognized), or unreadable (inaccessible). A failed update showed a green check over a broken skill. Now judged on a positive signal in a new tested module: every convergent placement must return current or newer-known. newer-known counts deliberately — the CLI pulls from the source repo, which runs ahead of the bundled manifest, so demanding strict current would invent false failures.

"Rows keep their place" wasn't true in production. refreshSkillFreshness publishes {inventory: null} synchronously before its first await, and settling a run notifies it — so every row vanished at the exact moment the result appeared, for the length of a full disk re-hash. The test asserting the same DOM node couldn't see it: it mocks the hook and never passes through null.

Process lifecycle

  • A failed spawn emits error and close, so the second settle clobbered the real spawn ENOENT and ran the inventory scan twice. Fixed with a per-run token that also guards the rescan's finish closure.
  • child.kill() killed the npx wrapper, leaving the skills process still writing to global skill homes. Now uses the existing killWithDescendantSweep.
  • On Windows a profile directory containing &, %, or ! makes the cmd.exe rail throw, which returned a silent started: false — Update did nothing, forever, with no error.
  • Output pushes are coalesced instead of structured-cloning up to 32 KB to every window on each \r progress frame.

Why there's now a Stop button

This restores parity, it isn't a new feature. The embedded PTY let you Ctrl-C a wedged npx; removing it left "restart Orca" as the only recovery, while the entire cancel rail shipped across six layers with zero callers. Implementing it correctly required the tree kill above and holding the run running until the tree is actually dead — releasing early let an immediate re-Update spawn a second npx writing the same bundles, which is precisely the corruption the verdict rework exists to detect.

UI correctness

  • Retry sent the eligibility list, which the settling re-scan had just emptied — a guaranteed no-op for the entire window the button is on screen.
  • The success linger retired the run 4 s after it finished, blanking the result under an open dialog.
  • A skipped skill's reason now renders outside the disclosure, so it doesn't depend on a mount-time defaultOpen that a later re-scan can never re-fire.
  • Dropped the summary line reading "Open Update details to see why each one was skipped" — that control no longer exists, and it was translated into four languages, so es/ja/ko/zh users were being fluently directed at nothing.
  • Deleted skill-location-chip-copy.tsx: 143 lines of unreferenced copy of the old row component, colliding on basename with the .ts that bare-specifier imports actually resolve to.

Verification

pnpm typecheck 0 · oxfmt --check src/ 0 · localization catalog 0 (parity 11211 across es/ja/ko/zh) · 146/146 across the 21 affected suites. Every high-value new test was negative-controlled — reverted against the unfixed source to confirm it fails.

Two pre-existing conditions, both confirmed unrelated by baselining with these changes stashed:

  • pnpm lint is red on the Ghostty localization strings in terminal-advanced-platform-search.ts / terminal-pane-appearance-search.ts — as this PR's description already noted.
  • A full local pnpm test shows broad failures from window.localStorage being undefined. This machine runs Node v26.5.0 against the repo's pinned Node 24; Node 26's experimental localStorage shadows happy-dom's. Identical failures with the branch stashed, in files this PR never touches. CI on Node 24 is unaffected.

Known limitations, left deliberately

  • Mixed-topology degradation: if a run updates the canonical copy but leaves a provider-alias a broken symlink, the alias drops out of the convergent set and the name still reports success. Closing it needs the pre-run inventory threaded through to compare convergent-then against convergent-now — a design change, not a patch. Recorded in skillUpdateFailedNames's docstring so it outlives this thread. Every wholly-degraded and removed-entirely case is reported as a failure.
  • No app-quit teardown: killing at will-quit would SIGTERM npx mid-write and create exactly the half-written bundle the verdict rework exists to catch. Orphan-and-finish loses only the verdict, and the update is idempotent.

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

🧹 Nitpick comments (1)
src/renderer/src/components/skills/SkillFreshnessUpdateDialog.tsx (1)

77-81: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Ref mutated during render — swap for the useState "previous render" pattern.

lastInventoryRef.current = state.inventory mutates a ref inside the render body itself (not a one-time lazy init), which React Doctor flags: a discarded/replayed render (e.g. under a startTransition elsewhere in the app) would still leak this write even though that render never committed. React's own docs describe the safe way to do exactly this "keep last value across renders" trick: call a state setter conditionally during render, guarded by an equality check — React then discards and immediately re-renders with the new state instead of leaking a side effect from a render that gets thrown away.

♻️ Proposed fix using `useState` instead of a mutated ref
-  const lastInventoryRef = useRef<SkillFreshnessInventory | null>(null)
-  if (state.inventory) {
-    lastInventoryRef.current = state.inventory
-  }
-  const inventory = state.inventory ?? (state.loading ? lastInventoryRef.current : null)
+  const [lastInventory, setLastInventory] = useState<SkillFreshnessInventory | null>(null)
+  if (state.inventory && state.inventory !== lastInventory) {
+    setLastInventory(state.inventory)
+  }
+  const inventory = state.inventory ?? (state.loading ? lastInventory : null)

And at the reset site:

     if (run.state === 'idle') {
-      lastInventoryRef.current = null
+      setLastInventory(null)
     }

Also applies to: 143-145

Source: Linters/SAST tools


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 54196193-1ae7-4ce8-82c2-483dc1b0f67b

📥 Commits

Reviewing files that changed from the base of the PR and between d8b3a03 and af01e09.

📒 Files selected for processing (17)
  • 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
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.test.tsx
  • src/renderer/src/components/skills/SkillFreshnessUpdateDialog.tsx
  • src/renderer/src/components/skills/SkillUpdateRow.tsx
  • src/renderer/src/components/skills/skill-freshness-summary-headline.tsx
  • src/renderer/src/components/skills/skill-update-run-store.ts
  • src/renderer/src/components/status-bar/SkillUpdateStatusSegment.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/skill-freshness.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/renderer/src/components/status-bar/SkillUpdateStatusSegment.tsx
  • src/shared/skill-freshness.ts
  • src/renderer/src/components/skills/skill-update-run-store.ts
  • src/renderer/src/components/skills/SkillUpdateRow.tsx
  • src/renderer/src/i18n/locales/es.json
  • src/main/ipc/skills.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/components/skills/skill-freshness-summary-headline.tsx
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/ko.json

@brennanb2025
brennanb2025 merged commit 0956d5c into main Jul 28, 2026
38 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#10843)

* feat(skills): run skill updates in the background without a terminal

The Update skills dialog had no primary action at all — its footer was only
Re-check and Close, and the real action was a pre-filled command in an embedded
PTY that the user had to press Enter on. Orca already builds and validates that
command, so it now runs it.

- Add a headless runner for `npx --yes skills update <names> --global -y`. Both
  --yes flags are load-bearing: npx's skips the package-install prompt, and the
  skills CLI's takes its own non-interactive branch. stdin is ignored so
  `process.stdin.isTTY` stays falsy, which is the other half of that gate.
- Own the run in main so closing the dialog backgrounds it instead of killing
  it, and surface it in the status bar: spinner while running, a green check on
  success that clears itself, and a failure that persists until acted on.
- Derive per-skill outcomes by re-scanning the freshness inventory after exit
  rather than parsing stdout. `skills update` has no --json (that flag exists
  only on `list`) and reports progress per-source, not per-skill, so the run
  bar is deliberately indeterminate instead of faking a percentage. When the
  re-scan has a verdict it outranks the exit code.
- Drop the version trail from the rows and surface the skill list and skip
  reasons directly instead of hiding them behind a disclosure.

Also fixes a width bug the collapsed disclosure used to hide: deep plugin-cache
paths set the dialog's width and pushed the footer actions off-screen.

* refactor(skills): use one row component across every update state

The ready and running views were separate components with different row
shapes, so pressing Update swapped the dialog's body for a different layout.
They are now the same `SkillUpdateRow` instances throughout — only the status
slot's contents change — and a test asserts the row is literally the same DOM
node from "update available" through pending to the result.

- Collapse each skill's locations behind its own disclosure. A skill with
  several plugin-cache copies was dumping every path inline and burying the
  actions; the row now shows a location count and expands on demand.
- Put status in a single slot between the name and the count rather than a
  leading icon column. A leading icon has nothing to show in the resting state
  and reserving its box just indented every name past an empty gap.
- Pin the running/finished run's names in `groupSkillFreshness` so a successful
  update doesn't drop its own rows the instant the re-scan lands.

`skill-freshness-group.tsx` becomes `skill-location-chip-copy.ts` — only its
chip label/tooltip helpers survived, and it no longer holds JSX.

* fix(skills): place the status glyph left of the skill name

Review feedback on the row header: the badge belongs immediately right of the
name so it reads as part of it, and the run's status circle/check belongs to
the left of the name rather than sharing the badge's slot on the far right.

Name, glyph and badge are now one left-aligned group; the location count and
chevron stay right-aligned. `available` still has no leading glyph — an empty
reserved box only indents the name past a gap with nothing in it.

* fix(skills): correct the headless update run's verdict, cancel path, and stopping copy

Review fixes for the headless skill-update runner.

Main process:
- Judge per-skill outcomes on a positive signal. "Absent from
  eligibleUpdateNames" is not success: a deleted, half-written, or unreadable
  skill also leaves that list, so a corrupt update reported a green check.
  skillUpdateFailedNames now requires every convergent placement to come back
  current or newer-known.
- Retire a child's handlers with a per-run token. A failed spawn emits error
  *and* close, so the second settle clobbered the real spawn ENOENT; a
  cancelled child could also settle, or write output into, the run that
  replaced it. The token guards the rescan's finish closure too.
- Hold the run `running` until the killed process tree is actually dead.
  Releasing on the synchronous path let an immediate re-Update spawn a second
  npx writing the same bundles, with a watchdog so a sweep that never settles
  cannot wedge the run.
- Kill the tree, not just the npx wrapper, via killWithDescendantSweep.
- Publish an error instead of a silent `started: false` when the cmd.exe rail
  rejects the resolved npx path, which a profile directory containing & or %
  is enough to trigger on Windows.
- Coalesce captured output into one push per tick instead of structured-cloning
  the whole buffer to every window on each progress frame.

Renderer:
- Keep rows on screen while the settling re-scan runs. Refreshing the inventory
  nulls it synchronously, so every row vanished at the moment the result
  appeared. Rows render off the last good scan; eligibility stays on the live
  snapshot so nothing is authorized off stale bytes.
- Retry the names that failed, not the eligibility list that same re-scan has
  just emptied.
- Add Stop, restoring the escape hatch the embedded terminal used to provide,
  and say "stopping" on every surface rather than claiming the update keeps
  running in the background.
- Show a skipped skill's reason outside the disclosure, so it no longer depends
  on a mount-time defaultOpen a later re-scan can never re-fire.
- Drop the summary line telling users to open "Update details", a control this
  PR removes; it was translated into four languages.
- Keep the success linger from retiring a result the open dialog is showing.
- Delete skill-location-chip-copy.tsx: an unreferenced copy of the old row
  component, colliding on basename with the module that is actually imported.

* fix(skills): divide update list from summary
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