Skip to content

fix(agent-cli-update): re-check CLI updates when the status bar popover opens - #48287

Merged
nwparker merged 1 commit into
stablyai:mainfrom
2SinceJuly:fix/48270-cli-update-refresh
Nov 24, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
2SinceJuly:fix/48270-cli-update-refresh

Conversation

@2SinceJuly

@2SinceJuly 2SinceJuly commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The status bar tells you when a coding agent's command-line tool (Claude Code, Codex and so on) is out of date. If you update that tool yourself in a terminal, Orca used to keep saying "1 CLI update" for up to ten minutes. Now Orca checks again when you open that list, so a tool you just updated drops off it.

What Changed

Before: a CLI updated in a terminal never goes through runAgentCliUpdate, so no finish event fires. The renderer asks each host at most once every 10 minutes (CHECK_INTERVAL_MS). Opening the popover did nothing, so the badge stayed stale.

After: opening the CLI updates popover runs the ordinary check for each host it lists, as long as the last check was more than 10 s ago (instead of 10 minutes).

Mechanism:

  • agent-cli-updates.ts: main's checkAgentCliUpdates body moves unchanged into checkPastInterval(target, interval). checkAgentCliUpdates calls it with CHECK_INTERVAL_MS (10 min, as before). The new checkAgentCliUpdatesOnOpen calls it with OPEN_CHECK_INTERVAL_MS (10 s). Both send the same unforced agentCliUpdate.check, share the in-flight dedupe (an open joins a check that is already out) and share the checkedAt bookkeeping, so a check started by an open also counts as the periodic one.
  • AgentCliUpdateStatusSegment.tsx: Popover onOpenChange calls checkAgentCliUpdatesOnOpen once per listed host when the popover opens.

The host side is unchanged. It re-reads launcher stamps (async fs) and runs --version only for a CLI whose stamp changed. That covers Homebrew/npm/native installs of claude, codex, devin, kimi and the other stamp-tracked CLIs.

Why

A finish event can't help, because a terminal update never calls Orca. Opening the list is the moment the user wants a fresh answer, and an ordinary check is cheap when nothing changed. The original PR added a "Check again" button and a force flag that re-ran --version on the host. Review found that it spawned a full CLI runtime per listed CLI per click. It also needed new UI, a new RPC param and a second in-flight path on the host. This version adds no UI and no API change, and it spawns nothing when nothing changed.

Linked Issue

Refs #48270

This is a partial fix. hermes, copilot and qwen-code update outside their launcher, so their stamp doesn't change. They still clear only after the host's existing 10-minute version cache, as on main. CLIs behind a Volta, mise or asdf shim have the same limit, because the stamp sees the unchanged shim. Both are follow-ups.

Visual Proof

N/A. There is no new or changed UI: the popover, its rows and the badge render exactly as on main. The only difference is when a check runs, so a row for a CLI that was updated in a terminal disappears once the popover opens. The slice tests below cover that timing. The only UI-side change is a Radix onOpenChange prop.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

  • Reproduced on main with a scratch slice test: two checkAgentCliUpdates(local) calls send 1 RPC (the second is throttled for 10 minutes), so a terminal update is never seen.

  • New src/renderer/src/store/slices/runtime-host-updates/agent-cli-updates.test.ts:

    • An open 5 s after a check sends nothing. An open 10 s after sends the ordinary full { agents: AGENT_CLI_UPDATE_AGENTS } ask and clears the list. The next periodic check still waits out its own 10 minutes.
    • An open more than 10 s after a check that is still in flight joins it: 1 RPC, and the open settles only when that answer arrives. With the join removed, this test fails.
  • vitest --config config/vitest.config.ts on src/renderer/src/store/slices/runtime-host-updates and src/main/agent-cli-update: 3 files, 9 tests pass.

  • oxlint, oxfmt --check, anti-slop oxlint, code-quality native oxlint, ast-grep and check-changed-code-quality are clean on the changed files.

  • Platforms: unit tests on macOS. The change is platform-neutral: it adds no paths, shell work or new RPC fields. Remote and SSH hosts use the same agentCliUpdate.check RPC, and hosts without the capability are still skipped by hostAnswers.

Performance

A small amount of extra work, and only when the user opens the popover. Each open sends at most one RPC per listed host per 10 s, and it joins any check already in flight.

  • --version spawns per open when nothing changed: 0 (scratch vitest with mocked stamps and versions, 6 CLIs listed behind, 10 opens 11 s apart: 0,0,0,0,0,0,0,0,0,0).
  • Cost of one full host check (real fs, real findOwnAgentCli and stamp code, 71-entry login PATH, 14 of 17 CLIs installed and all listed, which is the adversarial case, 40 runs): median 5.9 ms, p90 7.4 ms, max 10 ms. All of it is async. The worst event-loop delay was 3.7 ms, under 16 ms.
  • Renderer: 1000 opens 1 s apart send 100 RPCs (one per 10 s). The worst synchronous call was 0.011 ms.
  • The host check reads hostShellEnvironment(), a 10 s stale-while-revalidate cache, so an open can start at most one background login-shell capture per 10 s per host. Chat starts and the periodic check already do the same today.
  • No polling, timers or sync I/O.

Risk

Level: Low

The riskiest part is more frequent host checks: one per 10 s per host while the user keeps opening the popover. Each check is async and bounded as measured above. Rows can disappear a moment after the popover opens, but only for a CLI that really was updated. Nothing new crosses the wire: an older host answers the ordinary check as before, and an older renderer simply never checks on open. Nothing is persisted. Back it out with a plain revert.

Review

Reviewed in several rounds (correctness, perf, mixed-version compatibility). The forced-read design was replaced with this one to avoid extra --version spawns and new API surface.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Original fix by @2SinceJuly in #48287. Thanks for the report and the fix; authorship is preserved via Co-authored-by.

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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

No actionable comments were generated in the recent review.

Walkthrough

The status-bar segment now checks listed hosts when its popover opens. The update store shares its check flow between the existing 10-minute periodic check and a new 10-second open-triggered check. Tests cover interval handling, stored results, and reuse of an in-flight periodic request.

Severity of issue fixed: Medium

Merge Risk: Low · up to 2f37c

The new popover-open refresh is small and throttled. One earlier concern about the host version cache sometimes re-running version probes could not be checked against the current code, so it is worth confirming before merge. It is a minor performance matter, not a correctness failure.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #48270 accepts either a re-check when the popover opens or a Check again control that re-reads the installed version. The head adds a renderer re-check on open: checkAgentCliUpdatesOnOpen in src… Provide the head diff (or read access) for src/main/agent-cli-update/agent-cli-update-service.ts, agent-cli-update-params.ts, and the agentCliUpdate.check handler, and for AgentCliUpdateStatusSegment.tsx and AgentCliUpdateList.tsx. Confirm …
Passed Passed checks: 3 passed

Check name Status Explanation
Out of Scope Changes check Passed The head renderer store change in agent-cli-updates.ts is connected to #48270. It adds a shorter check interval for list opens (OPEN_CHECK_INTERVAL_MS = 10 seconds) and moves the existing check logic …
Title check Passed The title names the main change: the status bar re-checks agent CLI updates when the popover opens. It uses the fix() prefix and a specific scope, and it matches the description and the file summaries…
Description check Passed The description follows the template closely. It has ELI5, What Changed, Why, Linked Issue (Refs #48270, marked as a partial fix), Visual Proof (N/A with reason), Testing, Performance, Risk (Level: Lo…
Full details: Out of Scope Changes check

Explanation

The head renderer store change in agent-cli-updates.ts is connected to #48270. It adds a shorter check interval for list opens (OPEN_CHECK_INTERVAL_MS = 10 seconds) and moves the existing check logic into checkPastInterval. The move keeps capability gating, local-host subscription, in-flight reuse, unchanged-answer suppression, and failure handling. Its comment names the issue's cause: a CLI updated in a terminal sends no finish event. The raw summary also reports new tests for this path, which are related to the issue. The PR description does not mention the open-check path or the 10-second interval. This is a documentation gap, not unrelated work. No unrelated change was found in the inspected evidence. The status segment, host, and test diffs were not read directly, so this verdict rests on the store file and the raw summary.

Full details: Title check

Explanation

The title names the main change: the status bar re-checks agent CLI updates when the popover opens. It uses the fix() prefix and a specific scope, and it matches the description and the file summaries. The title is 77 characters, within a normal range.

Full details: Description check

Explanation

The description follows the template closely. It has ELI5, What Changed, Why, Linked Issue (Refs #48270, marked as a partial fix), Visual Proof (N/A with reason), Testing, Performance, Risk (Level: Low, with a revert plan), Agent skill boundary, Notes, and Checklist. The Linked Issue section uses 'Refs' and 'Fixes #' is absent. The template requires an actual issue link for outside contributors, and the author links #48270 but does not say whether the contributor is a maintainer. The AI Disclosure section is empty and the Review section is brief. The Performance line is filled in with measurements. The unchecked lint/typecheck/test/build item is acceptable because CI covers it. Overall the description is mostly complete.

Full details: Linked Issues check

Explanation

Issue #48270 accepts either a re-check when the popover opens or a Check again control that re-reads the installed version. The head adds a renderer re-check on open: checkAgentCliUpdatesOnOpen in src/renderer/src/store/slices/runtime-host-updates/agent-cli-updates.ts uses a 10-second interval through the shared checkPastInterval helper. This meets the renderer half of the issue's expected outcome for CLIs whose launcher stamp changes on disk. Three points remain unverified:

  1. The issue states that updatesOutsideLauncher CLIs (hermes, copilot, qwen-code) stay stale because the host's UNREAD_RETRY_MS cache (10 minutes) returns the old version even when recheck is requested. A renderer re-check on open only helps if the host answers fresh. The host function installedVersion in src/main/agent-cli-update/agent-cli-update-service.ts was not read, so this cannot be established.
  2. The PR description and the previous assessment describe a Check again button, refreshAgentCliUpdates, and a force flag on agentCliUpdate.check. The head copy of agent-cli-updates.ts contains no refreshAgentCliUpdates and no force parameter. The status segment and list files were not read at head, and the diff tool was unavailable, so it is unknown whether this mechanism exists elsewhere at head.
  3. Whether the force path reaches the host read cache is therefore unknown.

No non-coding requirement applies. Automated test coverage for the new open-check path is reported in the raw summary but was not read.

Resolution

Provide the head diff (or read access) for src/main/agent-cli-update/agent-cli-update-service.ts, agent-cli-update-params.ts, and the agentCliUpdate.check handler, and for AgentCliUpdateStatusSegment.tsx and AgentCliUpdateList.tsx. Confirm that installedVersion returns a fresh version for updatesOutsideLauncher CLIs when a re-check is requested from the open path or from the explicit refresh path. Confirm the mechanism that the PR description describes (refresh control with force) is present at head, or update the PR description to match the actual mechanism.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 84eea6bd-f201-4191-9678-286afe1067eb
Commits

Reviewing files that changed from the base of the PR and between 5a60389 and 2f37c5d.

Files selected for processing: 3

  • src/renderer/src/components/status-bar/updates/AgentCliUpdateStatusSegment.tsx
  • src/renderer/src/store/slices/runtime-host-updates/agent-cli-updates.test.ts
  • src/renderer/src/store/slices/runtime-host-updates/agent-cli-updates.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

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

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d4a14f0d-987a-44ef-87d8-1cb68a9bd678
Commits

Reviewing files that changed from the base of the PR and between 87da293 and ab40837.

Files selected for processing: 8

  • src/main/agent-cli-update/agent-cli-update-run.test.ts
  • src/main/agent-cli-update/agent-cli-update-service.ts
  • src/main/runtime/rpc/methods/host-management/agent-cli-update.ts
  • src/renderer/src/components/status-bar/updates/AgentCliUpdateList.tsx
  • src/renderer/src/components/status-bar/updates/AgentCliUpdateStatusSegment.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/store/slices/runtime-host-updates/agent-cli-updates.ts
  • src/shared/rpc-contract/host-management/agent-cli-update-params.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

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

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9b6d5773-7067-4d5c-ad46-fabd5a89eb65
Commits

Reviewing files that changed from the base of the PR and between ab40837 and df0d53e.

Files selected for processing: 5

  • src/main/agent-cli-update/agent-cli-update-run.test.ts
  • src/main/agent-cli-update/agent-cli-update-service.ts
  • src/main/runtime/rpc/methods/host-management/agent-cli-update.ts
  • src/renderer/src/store/slices/runtime-host-updates/agent-cli-updates.test.ts
  • src/renderer/src/store/slices/runtime-host-updates/agent-cli-updates.ts
Files skipped from review as they are similar to previous changes: 1

  • src/main/runtime/rpc/methods/host-management/agent-cli-update.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

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

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 072a8edc-d7fe-40df-a8fa-9832c033abc3
Commits

Reviewing files that changed from the base of the PR and between df0d53e and cd290eb.

Files selected for processing: 2

  • src/main/agent-cli-update/agent-cli-update-run.test.ts
  • src/main/agent-cli-update/agent-cli-update-service.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@2SinceJuly

Copy link
Copy Markdown
Contributor Author

Correct, and this was a regression my previous commit introduced rather than a pre-existing gap.

The fallback now read the current entry but still wrote it back with its own seq, which was allocated after every probe that started earlier. So in your scenario the fallback stored 1.0.0 under B's higher sequence, and A's later 2.0.0 was rejected at the guard — the cache kept 1.0.0 while A correctly answered 2.0.0, exactly the split you describe.

Fixed in 5a60389c889. A fallback write now claims no sequence: it reuses the sequence of the entry it is falling back to (0 when there is none), so it can seed an empty cache without ever outranking a read that started earlier. A read that returns a version still claims its own sequence, so the forced-read ordering the guard was added for is unchanged.

The new test covers your ordering: a read started first and left pending, two later reads that answer with nothing read (one of them the second updatesOutsideLauncher pass, so the fallback path runs), then the first read released with the updated version. Without the change the check after it served 1.0.0; with it the cache carries 2.0.0.

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

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4ba3d759-b08d-44b1-a257-1fd31ed60736
Commits

Reviewing files that changed from the base of the PR and between cd290eb and 5a60389.

Files selected for processing: 2

  • src/main/agent-cli-update/agent-cli-update-run.test.ts
  • src/main/agent-cli-update/agent-cli-update-service.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

// put the pre-update version back, where the interval would serve it until the next forced read.
// A fallback claims no sequence, so a read that started earlier still replaces it with what it read.
const writeSeq = read.version ? seq : (stored?.seq ?? 0)
if ((versions.get(cli.program)?.seq ?? 0) < writeSeq) {

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.

Minor · Performance & Scalability · Quick win

Cache unread probe results so the retry interval applies.

When a probe returns no version and no cache entry exists, writeSeq is 0. The guard then tests 0 < 0, so the null result is not stored. Every later check runs another --version probe. The comment on UNREAD_RETRY_MS says an unread version is asked again after the interval, not on every check.

A fallback to a matching cache entry has the same defect. Its writeSeq equals the stored sequence, so the strict comparison blocks the write and the timestamp is not refreshed. After the interval expires, each recheck probes again.

Use <= in the guard and treat a missing entry as -1. A matching fallback then rewrites the same sequence with a refreshed timestamp. An older successful read still cannot replace a newer entry, because its lower sequence fails the comparison.

Suggested fix

--- "a/src/main/agent-cli-update/agent-cli-update-service.ts"
+++ "b/src/main/agent-cli-update/agent-cli-update-service.ts"
@@ -100,7 +100,7 @@
   // put the pre-update version back, where the interval would serve it until the next forced read.
   // A fallback claims no sequence, so a read that started earlier still replaces it with what it read.
   const writeSeq = read.version ? seq : (stored?.seq ?? 0)
-  if ((versions.get(cli.program)?.seq ?? 0) < writeSeq) {
+  if ((versions.get(cli.program)?.seq ?? -1) <= writeSeq) {
     versions.set(cli.program, { stamp, version, at: Date.now(), seq: writeSeq })
   }
   return version
Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
if ((versions.get(cli.program)?.seq ?? 0) < writeSeq) {
if ((versions.get(cli.program)?.seq ?? -1) <= writeSeq) {

…er opens

A CLI updated in a terminal never goes through runAgentCliUpdate, so no
finish event fires, and the renderer asked each host at most once per
10 minutes. The "N CLI updates" badge stayed stale after the user updated.

Opening the CLI updates popover now runs the ordinary check for each
listed host, past a 10 s interval instead of the periodic 10 minutes. It
is the same unforced agentCliUpdate.check, it joins a check already in
flight, and it counts as the periodic check. The host re-reads launcher
stamps and spawns --version only for a CLI whose stamp changed.

Refs stablyai#48270

Co-authored-by: 2SinceJuly <[email protected]>
@nwparker
nwparker force-pushed the fix/48270-cli-update-refresh branch from 5a60389 to 2f37c5d Compare November 24, 2026 15:10
@nwparker nwparker changed the title fix(agent-cli-update): let the status bar re-read CLIs updated in a terminal fix(agent-cli-update): re-check CLI updates when the status bar popover opens Nov 24, 2026
@nwparker
nwparker merged commit 60aa5a5 into stablyai:main Nov 24, 2026
55 of 56 checks passed
MBA3000 added a commit to MBA3000/orca that referenced this pull request Nov 26, 2026
…, spawning nothing

Review on stablyai#49232: an automatic agentCliUpdate.check on every connected host
spawns --version for each installed CLI (and a login-shell capture on
SSH/WSL), the pattern decided against in stablyai#48287/stablyai#48517.

The host now keeps each agent's last check answer and serves it for
agentCliUpdate.check with `cached: true`, without resolving, spawning or
fetching anything; an update run drops the agent's answer. Hosts advertise
agent-cli-update.cached.v1, and the renderer reads the cache only from
those (older hosts ignore unknown params and would run a full check), once
per connection. A cached answer never counts as a check, so the next
user-triggered check still asks the host for real.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants