Skip to content

feat(hosts): Resource Manager lists the owning host's processes - #27263

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/d4-d4-v5d
Oct 10, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/d4-d4-v5d

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​176 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​170
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​495 $\color{#cf222e}{\Huge{\mathbf{−}}}$​169 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​326

ELI5

When your projects live on an Orca server, the Resource Manager now shows what that server's terminals are using, under those projects, with the server's name next to each row. Before, it only ever showed this computer, so a heavily loaded server looked like nothing was running.

What Changed

  • Before: opening the Resource Manager on a Mac connected to a Linux Orca server listed only the Mac's own terminals. The server's projects were deliberately left out, so seven busy agents on the server showed as nothing.
  • After: while the Resource Manager is open, each paired server that hosts one of your projects (or folder workspaces) is asked for its own process samples every 2 seconds, the same cadence as this computer. Its workspaces appear under their projects with CPU, memory and history, labelled with the server's name. Those rows have no kill button, because this client cannot end a process on another machine from here. If the server cannot be reached, the panel says "Couldn't reach ; its resources are unknown." instead of showing it as idle. If the server is too old to answer, it says "Update to see its resources."
  • Mechanism: the renderer calls the server's existing diagnostics.memory method (the same one behind orca diagnostics memory) through callRuntimeRpc for each runtime environment found in the repos' and workspaces' execution host ids. The reply is treated as untrusted: unknown fields are ignored and malformed rows are dropped. The merge attributes a server row to a project only when this client places that project on that same server (runtime:<id>); any other row from the server keeps a host-qualified id so it never merges into a same-id row from another host. This computer's own samples are still kept out of server-hosted projects, as before.
  • The session-label helpers moved out of mergeSnapshotAndSessions.ts into resource-session-labels.ts unchanged, to keep the merge file under the line limit.

Why

The design called for a new resources.list method behind a host-resources.v1 capability. Servers already answer diagnostics.memory (since June) with exactly the per-workspace, per-terminal samples the panel renders, computed on the server for its own terminals. Reusing it means no wire change: no new method, no new capability, no new permission, and old servers work as soon as the client updates. A server older than that method answers method_not_found, which the panel turns into the "update server" note the design asked for.

Only an open panel polls, so a closed status-bar chip never contacts the server. Server rows are read-only because ending a remote terminal needs that host's ownership checks, which is a separate change.

Linked Issue

Fixes #24464

Visual Proof

N/A in this run: the machine is load-capped (no local Electron). The row rendering (server name instead of "remote", no kill button) and the notices are covered by component tests.

Testing

  • mergeSnapshotAndSessions.test.ts: a server's samples render under the project it hosts, with the server's name, history and read-only sessions; this computer's sample of the same id stays out; a server row for a project this client places elsewhere stays in its own host-qualified group. On main, the merge had no input for server samples and dropped server-hosted projects entirely.

  • runtime-host-resources.test.ts: only runtime host ids are polled; malformed rows and sessions are dropped; method_not_found → "update"; any other failure → "unknown", never an empty list.

  • ResourceUsageStatusSegment.rows.test.tsx: server rows show the server name and no kill control.

  • pnpm tc:web, pnpm test src/renderer/src/components/status-bar/ (66 files), oxlint, pnpm run check:code-quality:changed.

  • I manually tested these changes locally

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

Review

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

  • SSH: a direct SSH workspace is unchanged (rows still come from this computer's daemon list). An SSH target behind a server is sampled only as far as that server's own sweep sees it.
  • Folder workspaces: attributed by the folder's own host id, so siblings on different hosts stay separate.
  • Web client: its projects are server-hosted, so it now shows the server's samples too.
  • Compatibility: no wire change; old client with new server and new client with old server both behave as before or better.
  • Performance: one request per server every 2 seconds while the panel is open; a slow server never stacks requests.

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)
  • 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)

While the Resource Manager is open, each paired server that hosts one of this
client's projects is asked for its own process samples through the existing
diagnostics.memory method, and those rows render under the server's projects,
named by host and without a kill control. A server that cannot answer is named
as unknown instead of looking idle.
@OrcaWin
OrcaWin requested a review from brennanb2025 as a code owner October 10, 2026 14:53
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Walkthrough

The Resource Manager now polls paired runtime hosts for worktree and session resource data. It parses host responses, merges samples into the resource model, and displays host labels and status notices. Runtime-host sessions are read-only and do not show a kill-session action. Session labels are resolved from tab data and fallbacks.


Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to f62ae

A server session with the same ID as a local session can hide the local row. This is a narrow mergeability risk that merits owner awareness or a fix.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 17 files. (1 skipped:… 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: showing processes owned by remote hosts in the Resource Manager.
Description check Passed The description is comprehensive. It includes the user impact, implementation details, rationale, linked issue, visual-proof explanation, testing coverage, compatibility notes, and checklist status. I…
Linked Issues check Passed Issue [#24464] requires Resource Manager visibility for processes and workspaces hosted by a remote Orca server. The controller collects runtime host IDs, polls each paired host while the panel is ope…
Out of Scope Changes check Passed The changes stay within issue [#24464]. The polling hook, response validation, merge updates, notices, read-only behavior, UI rendering, translations, and automated tests directly support remote Resou…

Full details: Docstring Coverage

Explanation

Docstring coverage is 20.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 17 files. (1 skipped: 1 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

  • 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

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


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 498ded2b-833a-4f00-bd94-384e026fc5fb
📥 Commits

Reviewing files that changed from the base of the PR and between 6cbbe45 and f62ae7a.

📒 Files selected for processing (18)
  • src/renderer/src/components/status-bar/ResourceUsageStatusSegment.rows.test.tsx
  • src/renderer/src/components/status-bar/ResourceUsageStatusSegment.tsx
  • src/renderer/src/components/status-bar/mergeSnapshotAndSessions.test.ts
  • src/renderer/src/components/status-bar/mergeSnapshotAndSessions.ts
  • src/renderer/src/components/status-bar/resource-session-labels.ts
  • src/renderer/src/components/status-bar/resource-usage-folder-merge.test.ts
  • src/renderer/src/components/status-bar/resource-usage-merge-types.ts
  • src/renderer/src/components/status-bar/resource-usage-popover-body.tsx
  • src/renderer/src/components/status-bar/resource-usage-session-rows.tsx
  • src/renderer/src/components/status-bar/resource-workspace-host.ts
  • src/renderer/src/components/status-bar/runtime-host-resources.test.ts
  • src/renderer/src/components/status-bar/runtime-host-resources.ts
  • src/renderer/src/components/status-bar/use-resource-usage-actions.ts
  • src/renderer/src/components/status-bar/use-resource-usage-derived-model.test.tsx
  • src/renderer/src/components/status-bar/use-resource-usage-derived-model.ts
  • src/renderer/src/components/status-bar/use-resource-usage-status-controller.ts
  • src/renderer/src/components/status-bar/use-runtime-host-resources.ts
  • src/renderer/src/i18n/locales/en.json

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

Comment on lines +109 to +124
const sessions: UnifiedSessionRow[] = wt.sessions.map((s) => {
seenSessionIds.add(s.sessionId)
const tabId = index.ptyIdToTabId.get(s.sessionId) ?? null
return {
sessionId: s.sessionId,
paneKey: s.paneKey,
pid: s.pid,
label: resolveSnapshotSessionLabel(s, row.worktreeId, index),
bound: ctx.workspaceSessionReady && boundPtyIds.has(s.sessionId),
agentOwnership: ownershipBySessionId.get(s.sessionId) ?? 'unknown',
tabId,
cpu: s.cpu,
memory: s.memory,
hasLocalSamples: true,
...(row.readOnly ? { readOnly: true } : {})
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -n -C3 'function makePtySessionId|parsePtySessionId|@@' src/shared/pty-session-id-format.ts

Repository: stablyai/orca

Length of output: 1399


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- mergeSnapshotAndSessions.ts ---'
nl -ba src/renderer/src/components/status-bar/mergeSnapshotAndSessions.ts | sed -n '1,260p'
printf '%s\n' '--- runtime host resource ingestion references ---'
rg -n -C4 --glob '*.{ts,tsx}' 'ingestSampledWorktree|readOnly|runtimeHostId|seenSessionIds' src/renderer/src/components/status-bar src/renderer/src | sed -n '1,360p'
printf '%s\n' '--- PTY session ID implementation ---'
nl -ba src/shared/pty-session-id-format.ts | sed -n '1,180p'
printf '%s\n' '--- session ID creation and daemon-row filtering ---'
rg -n -C3 --glob '*.{ts,tsx}' 'makePtySessionId|ptyIdToTabId|boundPtyIds|ownershipBySessionId|sessionId.*@@|@@.*sessionId' src | sed -n '1,360p'

Repository: stablyai/orca

Length of output: 42182


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- runtime-host resource types and producer ---'
rg -n -C5 --glob '*.{ts,tsx}' 'runtimeHostResources|diagnostics\.memory|memory.*worktrees|WorktreeMemory|host\.worktrees' src/renderer src/main src/shared | sed -n '1,420p'
printf '%s\n' '--- focused merge tests around remote samples and collisions ---'
rg -n -C12 --glob 'mergeSnapshotAndSessions.test.ts' 'remote|readOnly|seenSessionIds|collision|same.*session|sessionId' src/renderer/src/components/status-bar/mergeSnapshotAndSessions.test.ts | sed -n '1,420p'

Repository: stablyai/orca

Length of output: 41948


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- runtime-host response parser ---'
nl -ba src/renderer/src/components/status-bar/runtime-host-resources.ts | sed -n '90,190p'
printf '%s\n' '--- local collector session handoff ---'
rg -n -C8 --glob '*.{ts,tsx}' 'sessions\.push|sessionId:|listRegisteredPtys|registerPty' src/main/memory/collector.ts src/main/ipc/pty.ts src/main/memory/pty-registry.ts | sed -n '1,300p'

Repository: stablyai/orca

Length of output: 10297


Keep remote session IDs out of local merge state.

If a server sample uses the same raw ID as a local daemon session, the read-only sample enters seenSessionIds, so Step 2 skips the local daemon row. It can also inherit local tab binding and agent ownership.

For read-only rows, skip the seenSessionIds insert and clear local interaction state.

Suggested fix
--- "a/src/renderer/src/components/status-bar/mergeSnapshotAndSessions.ts"
+++ "b/src/renderer/src/components/status-bar/mergeSnapshotAndSessions.ts"
@@ -106,20 +106,22 @@
     }
   ): void {
     const repo = ensureRepo(row.repoId, row.repoName)
     const sessions: UnifiedSessionRow[] = wt.sessions.map((s) => {
-      seenSessionIds.add(s.sessionId)
-      const tabId = index.ptyIdToTabId.get(s.sessionId) ?? null
+      if (!row.readOnly) {
+        seenSessionIds.add(s.sessionId)
+      }
+      const tabId = row.readOnly ? null : (index.ptyIdToTabId.get(s.sessionId) ?? null)
       return {
         sessionId: s.sessionId,
         paneKey: s.paneKey,
         pid: s.pid,
         label: resolveSnapshotSessionLabel(s, row.worktreeId, index),
-        bound: ctx.workspaceSessionReady && boundPtyIds.has(s.sessionId),
-        agentOwnership: ownershipBySessionId.get(s.sessionId) ?? 'unknown',
+        bound: !row.readOnly && ctx.workspaceSessionReady && boundPtyIds.has(s.sessionId),
+        agentOwnership: row.readOnly ? 'unknown' : (ownershipBySessionId.get(s.sessionId) ?? 'unknown'),
         tabId,
         cpu: s.cpu,
         memory: s.memory,
         hasLocalSamples: true,
         ...(row.readOnly ? { readOnly: true } : {})
       }
     })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const sessions: UnifiedSessionRow[] = wt.sessions.map((s) => {
seenSessionIds.add(s.sessionId)
const tabId = index.ptyIdToTabId.get(s.sessionId) ?? null
return {
sessionId: s.sessionId,
paneKey: s.paneKey,
pid: s.pid,
label: resolveSnapshotSessionLabel(s, row.worktreeId, index),
bound: ctx.workspaceSessionReady && boundPtyIds.has(s.sessionId),
agentOwnership: ownershipBySessionId.get(s.sessionId) ?? 'unknown',
tabId,
cpu: s.cpu,
memory: s.memory,
hasLocalSamples: true,
...(row.readOnly ? { readOnly: true } : {})
}
const sessions: UnifiedSessionRow[] = wt.sessions.map((s) => {
if (!row.readOnly) {
seenSessionIds.add(s.sessionId)
}
const tabId = row.readOnly ? null : (index.ptyIdToTabId.get(s.sessionId) ?? null)
return {
sessionId: s.sessionId,
paneKey: s.paneKey,
pid: s.pid,
label: resolveSnapshotSessionLabel(s, row.worktreeId, index),
bound: !row.readOnly && ctx.workspaceSessionReady && boundPtyIds.has(s.sessionId),
agentOwnership: row.readOnly ? 'unknown' : (ownershipBySessionId.get(s.sessionId) ?? 'unknown'),
tabId,
cpu: s.cpu,
memory: s.memory,
hasLocalSamples: true,
...(row.readOnly ? { readOnly: true } : {})
}

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] Resource Manager doesnt work with Remote Server

2 participants