Skip to content

fix(history): discover CLI-paired servers when opening the host picker - #25355

Closed
tianyilt wants to merge 1 commit into
stablyai:mainfrom
tianyilt:fix/paired-runtime-discovery
Closed

tianyilt wants to merge 1 commit into
stablyai:mainfrom
tianyilt:fix/paired-runtime-discovery

Conversation

@tianyilt

@tianyilt tianyilt commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

ELI5

A server paired through the Orca CLI can be missing from the History host menu until another screen refreshes the saved server list. Opening that menu now refreshes the list, so the server appears without opening Settings first.

What Changed

The History host picker refreshes the saved environment catalog when opened. A new catalog-only store action reuses the existing hydration coordinator, including its overlapping-request coalescing and revision checks, without probing every server. Existing selections remain unchanged, and a failed list read preserves the last known hosts.

Why

The menu previously depended on a catalog populated elsewhere in the renderer. Refreshing at the point of use discovers CLI pairing changes while avoiding unnecessary network probes or replacing the current host selection.

Linked Issue

Fixes #25251

Visual Proof

Captured in headless Chromium using the actual controls and application styles, with generic saved-host fixtures. The existing SSH host remains selected in both images.

Before:
Host menu before catalog refresh

After:
Host menu after catalog refresh

Testing

  • I manually tested these changes locally: rendered the actual controls in headless Chromium and inspected both captures on macOS.
  • Automated tests added/updated.

Passed locally on macOS:

  • 78 tests across six files: new catalog-refresh and picker interaction tests, runtime status, host scope, header focus, and settings tests.
  • Full pnpm typecheck across Node, CLI, and renderer projects.
  • Electron Vite production build for main, preload, and renderer.
  • Changed-code quality gate, focused lint, formatting checks, and git diff --check.

New tests cover saved-host additions/removals, concurrent opens, pairing changes during a pending read, failed reads, and preserving an SSH selection while discovering a paired server. Full-suite tests, full lint, packaging, and Linux/Windows checks are left to CI.

AI Disclosure

Implemented and reviewed with OpenAI Codex.

Review

The change lists saved metadata through an existing API and adds no new transport, credential handling, filesystem access, platform shortcuts, or server-status cache. Local, SSH, and paired-runtime host choices retain their current selection behavior. The catalog action is shared across platforms; Linux and Windows were not run locally.

Agent skill upstream boundary

  • Not applicable; no skill source or registry is changed.

Notes

This fix is scoped to discovering saved hosts in the History picker. It does not change remote transcript reading (already addressed in #20455) or the separate CLI removal/transport issue #20995.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots attached
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Local targeted tests, typecheck, build, and changed-code checks pass; CI will cover broader checks

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

✅ No new issues found.

Reviewed changes

  • Catalog-only store action — refreshRuntimeEnvironmentCatalog reuses createRuntimeStatusHydration without the per-host status probe, so opening the host picker re-lists saved environments cheaply.
  • Optional status probe — refreshEnvironmentStatus is now optional and the hydration loop skips the Promise.allSettled fan-out when it is absent.
  • Picker refresh on open — VaultHostScopeMenu calls the action on onOpenChange(open), and AiVaultPanel already subscribes to runtimeEnvironments, so newly-listed CLI-paired hosts re-render into the menu.
  • Tests — factory-level coverage for add/remove, coalescing, concurrent pairing edits, and failed reads; plus a picker interaction test that preserves the existing SSH selection.

ℹ️ Coalescing is per-action, not shared

The two hydration actions have independent inFlight/expectedRevisions/rerunRequested closures, so a picker open during boot hydration issues a second list() and publish rather than joining the first. I traced this and it is redundant, not incorrect — reconcileCatalogRows no-ops equal rows and setRuntimeEnvironments is idempotent for them — but the PR description's "overlapping-request coalescing" applies only within a single action. No change required; flagging so the description isn't read as a cross-action guarantee.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0c45e0a5-8f16-4d82-baee-b6c90b7c54f2
📥 Commits

Reviewing files that changed from the base of the PR and between 0a8c572 and b992551.

📒 Files selected for processing (6)
  • src/renderer/src/components/right-sidebar/AiVaultPanelControls.catalog.test.tsx
  • src/renderer/src/components/right-sidebar/AiVaultPanelControls.tsx
  • src/renderer/src/store/slices/runtime-status-catalog-refresh.test.ts
  • src/renderer/src/store/slices/runtime-status-hydration.ts
  • src/renderer/src/store/slices/runtime-status-types.ts
  • src/renderer/src/store/slices/runtime-status.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.


📝 Walkthrough

Walkthrough

The runtime status slice adds an action to refresh the runtime environment catalog. The history host picker calls this action when it opens. Hydration skips status refresh when no status reader is provided. Tests cover catalog updates, concurrent refresh behavior, rejected catalog reads, and selection of a newly listed server in the picker.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to b9925

No merge-blocking issue is established; the change is ready to merge after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to b9925

The change is narrowly scoped to refreshing saved hosts. Opening the menu does not itself select a host or request connection checks, and existing identity checks protect catalog publication. No introduced security concern was established in the inspected flow; incomplete coverage of interruption and broader host-routing behavior limits confidence.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected flow reaches the desktop user's saved runtime catalog and its shared renderer host caches. Influencing newly discovered host metadata requires influence over that existing catalog or its pairing inputs; the new menu handler does not accept arbitrary network destinations.

Security Findings and Attack Paths

  • inferred — No introduced authority bypass was established in the inspected menu-to-list path. Opening invokes catalog discovery rather than connect or status operations, and the menu's scope-change callback remains tied to selection. This conclusion does not establish the security of all downstream host-execution paths.

Trust Boundaries and Controls

  • observed — The existing main-to-renderer catalog projection removes deviceToken and publicKeyB64 from endpoints. The storage reader enforces a one-megabyte file limit and validates the catalog schema before returning rows. These are reused controls, not new protections introduced by this PR.

Resilience and Maintainability Implications

  • observed — Regression evidence covers a pairing-revision change during listing and host removal during status probing. The stale listing is discarded and removed status ownership is not retained. These checks support identity-based failure containment for the reused publisher and coordinator.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files. 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 and concisely describes the main change: discovering CLI-paired servers when the History host picker opens.
Description check ✅ Passed The description covers the required sections with clear user impact, implementation details, rationale, linked issue, before-and-after visuals, testing, and review notes.
Linked Issues check ✅ Passed [#25251] The History host picker refreshes the saved environment catalog when it opens. The catalog-only action lists and publishes current environments without a status probe. The picker test confirm…
Out of Scope Changes check ✅ Passed All changed code supports [#25251]. The picker change triggers catalog discovery, the store and hydration changes implement it, and the tests verify the required behavior. No unrelated changes are pre…
  • Fix all pre-merge checks with AI
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@nwparker

Copy link
Copy Markdown
Contributor

Thanks @tianyilt for tracking this down and for the clear repro and before/after captures. Your diagnosis was right: the History picker only ever saw a server list loaded somewhere else. We landed a broader fix: the desktop app now pushes a refresh to every window whenever the saved-server file changes, so orca environment add shows up in the History picker and every other server menu without opening Settings. You're credited as co-author on the commit. Closing this one in favor of that. Thanks again!

@nwparker nwparker closed this Oct 26, 2026
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.

[Bug]: History host picker misses CLI-paired servers until the catalog refreshes elsewhere

2 participants