Skip to content

feat(ssh): host-stamped remote foreground identity - #18078

Merged
brennanb2025 merged 11 commits into
mainfrom
brennanb2025/ssh-identity-impl
Sep 3, 2026
Merged

brennanb2025 merged 11 commits into
mainfrom
brennanb2025/ssh-identity-impl

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 28 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​812 $\color{#cf222e}{\Huge{\mathbf{−}}}$​142 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​670
Prod 65 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2415 $\color{#cf222e}{\Huge{\mathbf{−}}}$​813 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1602

ELI5

An SSH pane used to work out which agent was running in it by reading the tab title — the field you type
task notes into. This makes the remote machine answer instead: it reports what is actually running, stamped
with proof that the answer belongs to this pane.

Before / after

Situation Before After
You rename a tab to "fix the claude bug" while Codex is running Pane reports Claude Pane stays Codex
Your VPN drops mid-session Pane can look like the agent finished Pane says it cannot verify, and keeps the agent it knew
A remote command prints terminal-marker-shaped bytes Could impersonate an agent Identity does not move
The host cannot prove what is running (tmux, ambiguous, reattached) Names a plausible agent Reports honestly unverified
An idle host with several remote panes — Zero extra work: 0 inspections, 0 remote process reads

Known limit: SSH to a Windows host still reports unverified. Windows has no foreground-process-group
primitive and the relay has no console/job association, so naming a process there would be a guess. Documented
at the return site and on the type.

Manual testing

Run against a real throwaway Ubuntu 24.04 SSH container (not ssh localhost), driving the app over CDP with an
isolated profile, at this exact head. A real Codex CLI was installed inside the container and run in a real
SSH-backed pane.

  • Live identity — host returned verdict:"live", processName:"codex" with a populated fence
    (shellPid 8034, tty /dev/pts/0, foregroundPgid 8268, process start times).
  • Title cannot override — renamed the tab to Claude Code while Codex ran; identity stayed codex.
    After Ctrl-C with the same misleading title, the pane reported no agent rather than "Claude".
  • Forgery blocked — ran printf '\033]133;A\007forged\033]777;agent=claude\007' > /dev/pts/0 on the remote
    host with Codex live. Identity unchanged, same incarnation, same fence.
  • Fences fire — multiplexer_boundary under tmux; incarnation_mismatch on a stale incarnation.
  • Lost contact vs exit — disconnected the container's network mid-session: structured "unverifiable", the
    known agent survived, and identity re-established on reconnect. A genuine remote process exit reported
    exited with host evidence; a socket close alone could not forge exited.
  • Cost — wrapped the remote ps with a counter. Three idle remote panes for over 60 s produced
    0 inspect calls and 0 remote ps spawns. Five concurrent inspections produced five results from
    one host capture.
  • Reconnect — after disconnect/reconnect the retired PTY was not reused; the new pane established fresh
    evidence on a new incarnation.

Summary

Adds optional host-stamped, fenced foreground-process evidence to direct SSH and paired-runtime inspect-process RPCs, with renderer admission and remote completion tracking.

What this changes for users

Until now, an SSH or remote pane worked out which agent was running by reading the tab title — a
decoration field people type task text into. Local macOS and Linux panes already read the real foreground
process; remote panes were the only ones still guessing. Four things change:

Renaming a tab can no longer change which agent Orca thinks is running. Today, titling a tab
"fix the claude bug" while Codex is running can make the pane report Claude, which changes the icon, the
agent-status row, and anything keyed off pane identity. Verified on a real host: with Codex live, the title was
changed to Claude Code and the identity stayed codex.

A dropped connection no longer looks like a finished agent. Losing contact with a remote host and a remote
process actually exiting are now different answers (unverifiable vs exited) rather than the same silence.
If your VPN drops or wifi blips, the pane says it cannot verify — it does not report your agent as gone, and it
does not clear the agent you already had. Verified by disconnecting the container's network mid-session and
reconnecting.

Remote output can no longer impersonate an agent. Any command on the remote host can print bytes into your
terminal, including bytes shaped like shell-integration markers. Identity now comes from the host's own process
table, not from the byte stream, so a remote printf cannot claim to be an agent. Verified by emitting
marker-shaped OSC 133/OSC 777 bytes at a live pane: identity did not move.

Honest unknowns instead of confident wrong answers. When the host cannot prove what is running — the agent
is inside tmux, the process group is ambiguous, the PID was reused, or the pane was reattached to a different
process — the pane reports that it cannot verify rather than naming a plausible-looking agent. A wrong agent
name is worse than no name, because you cannot tell which panes to trust.

No new background work. Remote hosts are inspected on real events (spawn, attach, reconnect, command
boundary, focus), never on a timer. An idle host with several remote panes performs zero inspections and zero
remote process-table reads; a burst of events shares a single host capture. Measured on a real host over 60
seconds: 0 inspect calls, 0 remote ps spawns.

Known limitation: SSH to a Windows host still reports unverifiable. Windows has no foreground
process-group primitive, and the relay has neither the Windows process table nor a console/job association, so
naming a process there would be a guess. It degrades honestly instead. Lifting this needs a separate,
measured change.

Cost invariant

Remote identity is event-triggered only: no periodic remote identity poll, no remote active-agent cadence, and no hot-window rearm. Idle hosts with many remote panes and no qualifying events perform exactly zero identity RPCs and zero process-table spawns; qualifying bursts coalesce to one shared host capture.

Fences

A live verdict requires authority generation and monotonic observation epoch, PTY id and incarnation, conservative capture age, anchor PID start time, controlling tty, foreground process group, candidate PID start time, multiplexer boundary, ambiguity checks, and complete process-table capture. Missing or failed fences produce unverifiable; exited is emitted only from a matching host tombstone.

Mixed versions

Old client plus new host remains compatible through the additive optional field and legacy fields/list-row schema. New client plus old host treats absent evidence or transport failure as client-side unverifiable with no host metadata, never as a name or exit; automatic legacy inventory polling is suppressed when the capability is absent.

SSH to Windows

SSH-to-Windows remains unverifiable because the relay has no measured ConPTY/job foreground association or creation-time/session fence; returning a descendant name would be an unfenced guess. The code documents this limitation at both return sites and on WindowsFence.

Validation

Focused renderer/relay/daemon/provider suites: 219 tests passed. Typecheck and changed-code quality checks pass. Real-host Linux SSH container validation could not run because the Docker CLI is present but the Docker daemon is unavailable; ssh localhost was not used.

@coderabbitai

coderabbitai Bot commented Sep 2, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 6528b786-b307-4548-8086-11e141eca2a9

📥 Commits

Reviewing files that changed from the base of the PR and between 1b0a310 and 841358b.

📒 Files selected for processing (7)
  • src/main/providers/agent-foreground-process-batch.ts
  • src/main/providers/agent-foreground-process-remote-evidence.ts
  • src/main/providers/ssh-pty-provider-rpc-operations.ts
  • src/main/providers/ssh-pty-provider.ts
  • src/renderer/src/components/terminal-pane/agent-completion-inspection-result.ts
  • src/renderer/src/components/terminal-pane/agent-completion-process-monitor.ts
  • src/shared/child-process/__fixtures__/child-process-import-allowlist.txt

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change adds host-stamped remote foreground-process evidence with PTY incarnation, authority, observation, timing, and platform fences. Daemon, relay, provider, runtime, IPC, preload, and renderer paths forward expected incarnation IDs and evidence results. POSIX process snapshots support validated foreground resolution. Windows and insufficient evidence produce unverifiable results. Recent exits use tombstones. Remote completion handling uses evidence admission and event-triggered inspection instead of periodic process polling.

Merge Risk: 🟡 Moderate · up to 84135

This PR changes remote pane identity and completion decisions to use host process evidence. At the current head, absolute-path tmux/screen commands can bypass the safety fence, while process-snapshot and PTY lifecycle races plus other open correctness and CI issues can produce incorrect identity/completion behavior or prevent required checks from passing. Merge should wait for fixes or explicit owner acceptance.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 54 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the change, motivation, behavior, limitations, testing, and compatibility impact. However, it omits the required Linked Issue entry (Fixes #), formal Visual Proof section or… Complete the repository template. Add a linked issue, provide required before/after visual attachments or a compliant explanation, complete the Testing checkboxes, add AI Disclosure details when applicable, complete Review, Agent skill upst…
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely identifies the main change: host-stamped remote foreground identity for SSH.
Full details: Docstring Coverage

Explanation

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

Full details: Description check

Explanation

The description explains the change, motivation, behavior, limitations, testing, and compatibility impact. However, it omits the required Linked Issue entry (Fixes #), formal Visual Proof section or qualifying N/A statement, checklist items, Agent skill upstream boundary section, Notes section, and clear AI Disclosure and Review sections.

Resolution

Complete the repository template. Add a linked issue, provide required before/after visual attachments or a compliant explanation, complete the Testing checkboxes, add AI Disclosure details when applicable, complete Review, Agent skill upstream boundary, Notes, and Checklist sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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

🧹 Nitpick comments (12)
src/main/providers/agent-foreground-process-batch.ts (1)

71-78: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the discarded WindowsFence construction.

The block builds fence, discards it with void fence, and then returns an unverifiable result that never carries a fence. The values rootCreationTime: 'unavailable' and sessionId: 'unavailable' are placeholders that no consumer reads. Removing the block also drops the only use of the WindowsFence type import in this file.

♻️ Proposed cleanup
-    const fence: WindowsFence = {
-      platform: 'windows',
-      rootProcessId: request.rootPid,
-      rootCreationTime: 'unavailable',
-      sessionId: 'unavailable'
-    }
-    void fence
     return { ...metadata, verdict: 'unverifiable', reason: 'windows_ssh_foreground_unavailable' }
src/shared/remote-foreground-evidence.test.ts (1)

46-68: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a case for an authority-generation change.

admitRemoteForegroundEvidence rejects a stale epoch only when lastAuthorityGeneration === value.authorityGeneration. A host restart mints a new generation and resets the epoch, so an epoch at or below lastObservationEpoch must still be admitted under a different generation. No case covers that branch, and a future change to the epoch guard would pass this suite.

💚 Proposed additional assertion
     expect(
       admitRemoteForegroundEvidence(live, { ...base, lastObservationEpoch: live.observationEpoch })
     ).toBeNull()
+    expect(
+      admitRemoteForegroundEvidence(live, {
+        ...base,
+        lastAuthorityGeneration: 'host-b',
+        lastObservationEpoch: live.observationEpoch
+      })
+    ).toEqual(live)
src/main/daemon/terminal-host-process-inspection.ts (1)

49-70: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Two hosts implement the same evidence envelope independently, and the copies already differ. Both sites wrap the shared resolveRemoteForegroundEvidence with the same steps: check the retirement tombstone for expiry and incarnation equality, emit incarnation_mismatch when the expectation does not match, capture a process-table snapshot, fall back to process_table_unreadable, and stamp authorityGeneration, observationEpoch, capturedAgeMs, ptyId, and ptyIncarnationId. Only the resolver is shared, so the fence semantics can drift per host. Two differences exist today: the relay rejects an empty-string expectedIncarnationId as a mismatch while the daemon treats it as no expectation at all, and the two derive hasChildProcesses by different methods.

  • src/main/daemon/terminal-host-process-inspection.ts#L49-L70: move the incarnation-mismatch branch, the snapshot capture, and the unverifiable fallback into one shared helper, and align the empty-string expectation with the relay so an empty value is a mismatch rather than no expectation.
  • src/relay/pty-handler.ts#L2428-L2477: replace the inline snapshot and unverifiable branches with the same shared helper, so a future change to a fence reason or a stamped field applies to both hosts.
src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts (1)

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

Declare remotePtyIncarnationId on ConnectPanePtySession instead of a local intersection.

This file writes session.remotePtyIncarnationId, and terminal-keydown-fit.ts reads it through getExpectedIncarnationId. Each side declares the member locally, so the writer and the reader are only connected by structural typing. A rename or a type change on one side will not fail typechecking on the other.

Add the member to the shared ConnectPanePtySession type and pick it here like the other members in the Pick<...> list.

src/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.ts (1)

178-179: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

isRemoteRuntimePtyId is redundant in this predicate.

isRemoteExecutionHostPtyId already returns isRemoteRuntimePtyId(ptyId) || parseAppSshPtyId(ptyId) !== null, so the second disjunct can never change the result. The same pair appears again on Line 235 and Line 242. Extract one local helper and use it in all three places, so the classification cannot drift between them.

♻️ Proposed cleanup
+  const isRemotePtyId = (ptyId: string | null | undefined): boolean =>
+    isRemoteExecutionHostPtyId(ptyId)
+
   session.agentCompletionCoordinator = createAgentCompletionCoordinator({
     paneKey: session.cacheKey,
     statusLane: 'pty',
     getPtyId: () => session.transport.getPtyId(),
-    isRemotePtyId: (ptyId) =>
-      Boolean(isRemoteExecutionHostPtyId(ptyId) || isRemoteRuntimePtyId(ptyId)),
+    isRemotePtyId,
src/shared/process-table-snapshot-reader.ts (1)

190-224: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Confirm the /proc fan-out stays bounded on busy hosts.

readLinuxProcessStartTimes issues one concurrent readFile per tty-bearing row through a single Promise.all. On a host with many terminal sessions this opens a large number of simultaneous file handles inside the shared snapshot path. The TTL cache limits the frequency, but not the width of one capture.

Consider a small concurrency limit, or restrict the candidate set to the PIDs the caller actually needs.

src/shared/process-table-snapshot.ts (1)

141-146: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify the dead fallbacks and the duplicated ternary branches.

In the strict parser, group 8 is mandatory in both macStartMatch and numericMatch, so match[8] ?? match[6] always resolves to match[8], and line 146 reduces to command: match[8]. Lines 141-145 also build the identical object in both branches whenever match[7] !== undefined.

The lenient parser has the same pattern: evidenceMatch[5] ?? evidenceMatch[3] and evidenceMatch[8] ?? evidenceMatch[6] ?? evidenceMatch[4] cannot reach their fallbacks, because groups 5 and 8 are mandatory in that regex.

♻️ Proposed simplification
     rows.push({
       pid,
       ppid,
       pgid,
       tpgid,
       stat: match[5],
-      ...(numericMatch && match[7] !== undefined
-        ? { tty: match[6], startTime: match[7] }
-        : macStartMatch
-          ? { tty: match[6], startTime: match[7] }
-          : {}),
-      command: numericMatch ? (match[8] ?? match[6]) : match[8]
+      ...(match[7] !== undefined ? { tty: match[6], startTime: match[7] } : {}),
+      command: match[8]
     })
src/main/runtime/orca-runtime-terminal-create-deduplication.ts (1)

99-105: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

reconcileRemoteTerminalCreate omits incarnationId from the adopted result.

This PR adds incarnationId to RuntimeTerminalCreate, and getPtyExecutionHostMetadata now populates it for both SSH and local hosts. The reconcile path still returns the adopted terminal without it, even though session.incarnationId is available from the controller listing at Line 84 and is already stored by recordPtyWorktree.

A client that adopts a reconciled terminal therefore has no incarnation fence, and admitRemoteForegroundEvidence rejects every evidence record for that pane because expectedIncarnationId stays null. Completion detection degrades to unverifiable until the pane rebinds.

♻️ Proposed fix
     return {
       handle: adoptedHandle,
       ptyId: session.id,
       worktreeId,
+      ...(session.incarnationId ? { incarnationId: session.incarnationId } : {}),
       title: session.title || null,
       surface: 'background'
     }
src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts (1)

533-544: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

findReadyHostSessionHandle mutates transport state from inside a lookup.

The function name and return type describe a pure selection. Line 541 now writes authoritativePtyIncarnationId as a side effect. Three call sites use it: waitForHostSessionHandle (Line 615, Line 665) and waitForResubscribeHostSessionHandle (Line 812). The resubscribe caller may discard the returned handle (the require-replacement and same-handle cases), yet the incarnation write already happened.

Return the incarnation with the handle and let each caller decide when to adopt it.

♻️ Proposed refactor
-  ): string | null {
+  ): { terminal: string; incarnationId: string | null } | null {
     const terminalTabs = getHostSessionTerminalSurfaces(snapshot, hostTabId, {
       matchRequestedLeaf: false
     })
     const selected = leafId
       ? terminalTabs.find(
           (tab) => tab.status === 'ready' && tab.parentTabId === hostTabId && tab.leafId === leafId
         )
       : (terminalTabs.find(
           (tab) => tab.status === 'ready' && tab.parentTabId === hostTabId && tab.isActive
         ) ?? terminalTabs.find((tab) => tab.status === 'ready' && tab.parentTabId === hostTabId))
     if (selected?.status === 'ready') {
-      authoritativePtyIncarnationId = selected.incarnationId ?? null
-      return selected.terminal
+      return { terminal: selected.terminal, incarnationId: selected.incarnationId ?? null }
     }
     return null
   }
src/renderer/src/components/terminal-pane/agent-completion-process-monitor.ts (2)

233-233: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

requestStartedAtMonotonic is captured before the inspection is queued.

enqueueAgentProcessInspection can hold the request before run executes. The timestamp taken here therefore includes queue wait time, and admitRemoteForegroundEvidence adds that wait to capturedAgeMs when it applies the 2000 ms budget.

Under a busy inspection queue, a fresh host capture can be rejected purely because the request waited in the queue. The result is a dropped remote completion, and it is indistinguishable from genuine staleness.

The fence should measure the transport round trip, not the local queue delay. Capture the timestamp at the start of run.

♻️ Proposed fix
     state.inspectionInFlight = true
     const generationAtRequest = state.inspectionGeneration
-    const requestStartedAtMonotonic = performance.now()
     const pendingTitleIdAtRequest = priority === 'pending-title' ? pendingTitle.get()?.id : null
     enqueueAgentProcessInspection({
       priority,
       canRun: () => !state.disposed,
       run: async () => {
+        const requestStartedAtMonotonic = performance.now()
         let inspectedRecognizedAgent = false

98-102: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

The response-time binding-key reset is unreachable.

bindRemoteInspectionGeneration already sets remoteBindingKey for the same ptyId and incarnation at request time (Line 36). The caller at Lines 247-251 also rejects any result whose incarnation changed during the request. So remoteBindingKey !== bindingKey cannot hold here for a remote PTY.

Remove the duplicate reset, or add a comment that names the case it guards.

src/main/daemon/terminal-host-process-inspection.test.ts (1)

35-44: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the tombstone exited verdict and its expiry boundary.

This test covers only the incarnation_mismatch branch. That branch returns before the process-table read, so it is the cheapest case to assert.

The retired-incarnation path is the only producer of the exited verdict, and it is gated by both an incarnation match and a 2-second expiresAt window. Two cases stay untested: an exited session inspected with the matching expectedIncarnationId inside the window must resolve to verdict: 'exited' with reason: 'pty_exit_<code>', and the same inspection after the window must reject with SessionNotFoundError. Use fake timers to move past expiresAt instead of waiting.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 4a7f6d2e-1cb7-4184-b9bf-4d05a8a0a29d

📥 Commits

Reviewing files that changed from the base of the PR and between 058e618 and 99062b1.

📒 Files selected for processing (60)
  • docs/plans/ssh-agent-identity-plan.md
  • src/main/daemon/daemon-foreground-process-protocol.ts
  • src/main/daemon/daemon-pty-adapter-protocol-compatibility.test.ts
  • src/main/daemon/daemon-pty-process-inspection.ts
  • src/main/daemon/daemon-pty-router.ts
  • src/main/daemon/daemon-request-router.ts
  • src/main/daemon/terminal-host-process-inspection.test.ts
  • src/main/daemon/terminal-host-process-inspection.ts
  • src/main/daemon/terminal-host-session-inspection-operations.ts
  • src/main/daemon/terminal-host.ts
  • src/main/ipc/pty/ipc/inspect.ts
  • src/main/ipc/pty/runtime/controller.ts
  • src/main/ipc/pty/runtime/foreground-process-evidence-capability.ts
  • src/main/ipc/pty/runtime/inventory-operations.ts
  • src/main/ipc/pty/runtime/operations.ts
  • src/main/providers/agent-foreground-process-batch.ts
  • src/main/providers/agent-foreground-process-remote-evidence.test.ts
  • src/main/providers/agent-foreground-process.ts
  • src/main/providers/pty-process-inspection.ts
  • src/main/providers/pty-provider-contract.ts
  • src/main/providers/ssh-agent-session-capabilities.ts
  • src/main/providers/ssh-pty-provider.test.ts
  • src/main/providers/ssh-pty-provider.ts
  • src/main/runtime/orca-runtime-create-runtime-owned-mobile-session-terminal.ts
  • src/main/runtime/orca-runtime-perform-mobile-session-pty-records-refresh.ts
  • src/main/runtime/orca-runtime-publish-pty-backed-mobile-session-terminal.ts
  • src/main/runtime/orca-runtime-refresh-pty-worktree-records-with-controller-inventory.ts
  • src/main/runtime/orca-runtime-resolve-terminal-pane.ts
  • src/main/runtime/orca-runtime-restore-structured-agent-session-tabs-once.ts
  • src/main/runtime/orca-runtime-terminal-create-deduplication.ts
  • src/main/runtime/rpc/methods/terminal/terminal-query-methods.ts
  • src/main/runtime/rpc/methods/terminal/unary-schemas.ts
  • src/main/runtime/runtime-pty-controller-contract.ts
  • src/preload/api/pty-api.ts
  • src/preload/api/pty-bridge-stream-and-serialization.ts
  • src/preload/api/ssh-bridge.ts
  • src/relay/pty-handler-inventory-process-evidence.test.ts
  • src/relay/pty-handler.ts
  • src/renderer/src/components/terminal-pane/agent-completion-coordinator-types.ts
  • src/renderer/src/components/terminal-pane/agent-completion-poll-scheduler.ts
  • src/renderer/src/components/terminal-pane/agent-completion-process-monitor.ts
  • src/renderer/src/components/terminal-pane/pane-foreground-agent-tracker.test.ts
  • src/renderer/src/components/terminal-pane/pane-foreground-agent-tracker.ts
  • src/renderer/src/components/terminal-pane/pane-foreground-process-reader.ts
  • src/renderer/src/components/terminal-pane/pty-connection/fresh-spawn-start.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pane-agent-identity.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
  • src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts
  • src/renderer/src/components/terminal-pane/pty-connection/terminal-keydown-fit.ts
  • src/renderer/src/components/terminal-pane/pty-transport-types.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/renderer/src/runtime/runtime-terminal-inspection.ts
  • src/shared/foreground-process-evidence.ts
  • src/shared/process-table-snapshot-reader.ts
  • src/shared/process-table-snapshot.ts
  • src/shared/remote-foreground-evidence-admission.ts
  • src/shared/remote-foreground-evidence.test.ts
  • src/shared/runtime-mobile-session-tab-contracts.ts
  • src/shared/runtime-terminal-contracts.ts
  • tests/e2e/remote-agent-completion-authority.unit.test.ts

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

Comment thread docs/plans/ssh-agent-identity-plan.md Outdated
Comment on lines +221 to +225
* `exited` requires positive host evidence: a host-delivered exit/tombstone tied to the
exact `authorityGeneration`, PTY id, and `ptyIncarnationId`, or a complete host capture
that proves the incarnation's anchor is gone according to the host's retirement record.
A missing map entry, client-side set removal, socket close, or `terminal_gone` with no
matching host tombstone is `unverifiable`.

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

sed -n '1,130p' src/main/runtime/unstopped-pty-verification.ts

rg -n -C 8 \
  'resolveUnstoppedPtyVerdict|verifyUnstoppedPtys|process-exit|tombstone|status: .exited.' \
  src tests

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- verifier implementation ---'
cat -n src/main/runtime/unstopped-pty-verification.ts | sed -n '1,150p'

printf '%s\n' '--- direct symbol references ---'
rg -n -C 12 --glob '*.ts' --glob '*.tsx' \
  '\bresolveUnstoppedPtyVerdict\b|\bverifyUnstoppedPtys\b' src tests

printf '%s\n' '--- relevant plan sections ---'
cat -n docs/plans/ssh-agent-identity-plan.md | sed -n '205,245p;320,350p'

Repository: stablyai/orca

Length of output: 23058


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- teardown consumer ---'
cat -n src/main/runtime/worktree-teardown.ts | sed -n '190,270p'

printf '%s\n' '--- verdict contract ---'
cat -n src/shared/pty-liveness-verdict.ts | sed -n '1,180p'

printf '%s\n' '--- process-list contract and implementations ---'
rg -n -C 10 \
  'listProcesses\s*\(|interface IPtyProvider|type IPtyProvider|PtyProcess' \
  src/main/providers src/main src/shared -g '*.ts' -g '*.tsx' | head -n 360

printf '%s\n' '--- scoped repository conventions and learnings ---'
find /tmp/coderabbit-repo-knowledge/stablyai/orca-89dc44e4 -type f -name '*.md' -print

Repository: stablyai/orca

Length of output: 35346


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- provider contract ---'
cat -n src/main/providers/pty-provider-contract.ts | sed -n '1,150p'

printf '%s\n' '--- local process listing ---'
rg -n -C 12 'function listLocalPtyProcesses|export .*listLocalPtyProcesses|listProcesses\(\)' \
  src/main/providers/local-pty-session-operations.ts \
  src/main/providers/local-pty-provider.ts \
  src/main/providers/ssh-pty-provider.ts

printf '%s\n' '--- applicable repository knowledge ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -type f -name '*.md' -print 2>/dev/null | head -n 80

Repository: stablyai/orca

Length of output: 16169


Scope the tombstone-only exited rule.

resolveUnstoppedPtyVerdict returns status: 'exited' when listProcesses() omits a failed PTY ID. This contradicts the shared PtyLivenessVerdict contract, which requires positive owning-host evidence and treats inventory silence as unverifiable.

If the planned foreground-completion path reuses this verdict, it can treat a non-incarnation-specific inventory result as proof of exit. State that resolveUnstoppedPtyVerdict is outside the foreground-completion contract, or add a separate host-tombstone-based verdict.

Comment thread docs/plans/ssh-agent-identity-plan.md Resolved
Comment thread src/main/daemon/terminal-host.ts Resolved
// Multiplexers can make a descendant appear foreground while the user is
// actually interacting with another session. This relay has no measured
// multiplexer/session fence, so remain conservative for the whole subtree.
if ([root, ...descendants].some((row) => /(?:^|\s)(?:tmux|screen)(?:\s|$)/i.test(row.command))) {

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 | 🟠 Major | ⚡ Quick win

The multiplexer fence misses tmux/screen launched by an absolute path.

The pattern requires tmux or screen to start at the beginning of the command line or follow whitespace. A command line such as /usr/bin/tmux new-session or /opt/homebrew/bin/tmux attach does not match, because the token is preceded by /. Absolute-path invocation is common, and login shells and wrappers frequently produce it.

When the pattern misses, the resolver continues and can return verdict: 'live' for a subtree that runs inside a multiplexer. That is the exact case the comment above says must stay conservative, because the foreground descendant may belong to a multiplexer window the user is not viewing. The renderer then admits host-stamped evidence and can attribute an agent identity or a completion to the wrong pane.

The added test at src/main/providers/agent-foreground-process-remote-evidence.test.ts:66 uses the bare command tmux new-session, so it does not exercise this path.

Match on the command basename instead of raw text position.

🐛 Proposed fix to match the executable basename
-  if ([root, ...descendants].some((row) => /(?:^|\s)(?:tmux|screen)(?:\s|$)/i.test(row.command))) {
+  if (
+    [root, ...descendants].some((row) => {
+      const executable = row.command.trim().split(/\s+/)[0] ?? ''
+      const name = executable.slice(executable.lastIndexOf('/') + 1).toLowerCase()
+      return name === 'tmux' || name === 'screen'
+    })
+  ) {
     return { ...metadata, verdict: 'unverifiable', reason: 'multiplexer_boundary' }
   }
📝 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
if ([root, ...descendants].some((row) => /(?:^|\s)(?:tmux|screen)(?:\s|$)/i.test(row.command))) {
if (
[root, ...descendants].some((row) => {
const executable = row.command.trim().split(/\s+/)[0] ?? ''
const name = executable.slice(executable.lastIndexOf('/') + 1).toLowerCase()
return name === 'tmux' || name === 'screen'
})
) {
return { ...metadata, verdict: 'unverifiable', reason: 'multiplexer_boundary' }
}

this.foregroundEvidenceProbe ??
this.mux
.request('pty.getCapabilities', undefined, {
signal: options.signal,

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

Do not bind the shared probe to one caller's signal.

foregroundEvidenceProbe is shared. If the first caller aborts, this signal cancels the physical pty.getCapabilities request. The catch then resolves the shared probe as false, so concurrent callers without an aborted signal also treat a capable relay as unsupported.

Create the physical request without options.signal. Keep cancellation at waitForSshCapabilityProbe. Add a regression test with an aborted first caller and a live concurrent caller.

Proposed fix
         .request('pty.getCapabilities', undefined, {
-          signal: options.signal,
           timeoutMs: 5_000
         })
📝 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
signal: options.signal,

Comment on lines +724 to +729
lifecycle.handlePtyData("printf '\\033]133;A\\007\\033]777;agent=codex\\007\\033]133;D;0\\007'")
await flushSettleRead(COMMAND_SETTLE_MS)

expect(publish).not.toHaveBeenCalledWith(
expect.objectContaining({ agent: 'codex', shellForeground: false })
)

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 | 🟠 Major | ⚡ Quick win

The forged-OSC payload contains no escape bytes, so this test does not exercise the fence.

The string literal uses \\033 and \\007. In a JavaScript double-quoted string, \\ produces one backslash, so the data passed to handlePtyData is the literal text \033]133;A\007... and not the ESC and BEL control bytes. createOsc133CommandFinishedScanner matches on real control bytes, so no command-start and no command-finish event fires. tracker.onCommandStarted and tracker.onCommandFinished never run, flushSettleRead has no scheduled read to flush, and publish is never called.

The negative assertion then passes for the wrong reason. A regression that lets forged remote output assert an agent identity would not fail this test.

Use real control bytes, and assert that no agent was published at all so the check cannot pass vacuously.

💚 Proposed fix
-    lifecycle.handlePtyData("printf '\\033]133;A\\007\\033]777;agent=codex\\007\\033]133;D;0\\007'")
+    lifecycle.handlePtyData('\x1b]133;A\x07\x1b]777;agent=codex\x07\x1b]133;D;0\x07')
     await flushSettleRead(COMMAND_SETTLE_MS)
 
-    expect(publish).not.toHaveBeenCalledWith(
-      expect.objectContaining({ agent: 'codex', shellForeground: false })
-    )
+    expect(remoteRead).toHaveBeenCalled()
+    expect(publish).not.toHaveBeenCalledWith(expect.objectContaining({ agent: 'codex' }))
📝 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
lifecycle.handlePtyData("printf '\\033]133;A\\007\\033]777;agent=codex\\007\\033]133;D;0\\007'")
await flushSettleRead(COMMAND_SETTLE_MS)
expect(publish).not.toHaveBeenCalledWith(
expect.objectContaining({ agent: 'codex', shellForeground: false })
)
lifecycle.handlePtyData('\x1b]133;A\x07\x1b]777;agent=codex\x07\x1b]133;D;0\x07')
await flushSettleRead(COMMAND_SETTLE_MS)
expect(remoteRead).toHaveBeenCalled()
expect(publish).not.toHaveBeenCalledWith(expect.objectContaining({ agent: 'codex' }))

}): void => {
authoritativeExecutionHostId = terminal.executionHostId ?? authoritativeExecutionHostId
authoritativeHostPlatform = terminal.hostPlatform ?? authoritativeHostPlatform
authoritativePtyIncarnationId = terminal.incarnationId ?? null

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 | 🟠 Major | ⚡ Quick win

adoptExecutionMetadata clears a known incarnation when the terminal record omits it.

The two neighbouring fields preserve their previous value on absence (?? authoritativeExecutionHostId, ?? authoritativeHostPlatform). incarnationId instead resets to null.

Concrete regression in attachHostSessionMirror:

  1. findReadyHostSessionHandle records the incarnation from the session-tabs snapshot (Line 541).
  2. The terminal.resolvePane block calls adoptExecutionMetadata(terminal) at Line 921.
  3. RuntimeTerminalResolvePane.incarnationId is optional. getPtyExecutionHostMetadata omits it when the PTY record is missing or pty.incarnationId is falsy.
  4. authoritativePtyIncarnationId resets to null, and the result at Lines 956-961 omits incarnationId.

The renderer's getExpectedIncarnationId then stays null, and admitRemoteForegroundEvidence rejects every record for that pane, because it returns null whenever expectedIncarnationId === null. Remote completion detection stays permanently unverifiable for a pane whose incarnation was already known.

The same reset happens at Line 1532 when waitForPublishedHostSessionHandle calls rebindRemoteTerminalHandle(update.terminalHandle) with one argument (Line 1596); that path has no incarnation to supply.

Clearing on a genuine identity change is correct. Clearing on a merely absent field is not. Distinguish the two.

🐛 Proposed fix
   const adoptExecutionMetadata = (terminal: {
     executionHostId?: ExecutionHostId
     hostPlatform?: NodeJS.Platform
     incarnationId?: string | null
   }): void => {
     authoritativeExecutionHostId = terminal.executionHostId ?? authoritativeExecutionHostId
     authoritativeHostPlatform = terminal.hostPlatform ?? authoritativeHostPlatform
-    authoritativePtyIncarnationId = terminal.incarnationId ?? null
+    // Why: an absent field is unknown, not a proven identity change. Only an
+    // explicit null retires the fence; undefined keeps the last known value.
+    if (terminal.incarnationId !== undefined) {
+      authoritativePtyIncarnationId = terminal.incarnationId
+    }
   }

If the reset is deliberate, add the reason as a comment and make resolvePane always carry the incarnation, so the two sources cannot disagree.

📝 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
authoritativePtyIncarnationId = terminal.incarnationId ?? null
const adoptExecutionMetadata = (terminal: {
executionHostId?: ExecutionHostId
hostPlatform?: NodeJS.Platform
incarnationId?: string | null
}): void => {
authoritativeExecutionHostId = terminal.executionHostId ?? authoritativeExecutionHostId
authoritativeHostPlatform = terminal.hostPlatform ?? authoritativeHostPlatform
// Why: an absent field is unknown, not a proven identity change. Only an
// explicit null retires the fence; undefined keeps the last known value.
if (terminal.incarnationId !== undefined) {
authoritativePtyIncarnationId = terminal.incarnationId
}
}

Comment on lines +41 to +43
const evidenceMatch = trimmed.match(
/^(\d+)\s+(\d+)\s+(?:(-?\d+)\s+(-?\d+)\s+)?(\S+)(?:\s+(\S+)\s+(\d+))?\s+(.+)$/
)

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 | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Description: Locate all callers of the process-table parsers and the row shapes they feed.
set -euo pipefail

echo '--- callers of the parsers ---'
rg -nP -C6 '\b(parseProcessTableRows|parseStrictProcessTableRows)\s*\(' --type=ts

echo
echo '--- every ps argument list in the repo (column shapes) ---'
rg -nP -C3 "['\"]-a?xo['\"]|pid=,ppid=" --type=ts

echo
echo '--- files that build ProcessTableRow-like input strings ---'
rg -nP -C4 '\bProcessTableRow\b' --type=ts -g '!**/node_modules/**'

Repository: stablyai/orca

Length of output: 182


🏁 Script executed:

set -euo pipefail
echo '--- repository conventions and learnings ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print
for f in /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/{repo-conventions,learnings,architecture}/*.md; do
  [ -f "$f" ] && { echo "--- $f"; head -80 "$f"; }
done

echo '--- target file ---'
cat -n src/shared/process-table-snapshot.ts

echo '--- parser symbols and direct callers ---'
rg -n -C5 'parse(ProcessTableRows|StrictProcessTableRows)|process-table-snapshot|PS_ARGS|pid=,ppid=' --glob '*.ts' --glob '*.tsx' .

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

set -euo pipefail
echo '--- target file ---'
wc -l src/shared/process-table-snapshot.ts
cat -n src/shared/process-table-snapshot.ts

echo '--- exact parser references across tracked source ---'
rg -n -C4 'parseProcessTableRows|parseStrictProcessTableRows|process-table-snapshot' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' .

echo '--- process-table conventions, if any ---'
rg -n -i -C3 'process.?table|snapshot|ps_args|ps args' /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings/src.md /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings/repo-wide.md || true

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

set -euo pipefail
echo '--- snapshot reader and PS_ARGS binding ---'
wc -l src/shared/process-table-snapshot-reader.ts
cat -n src/shared/process-table-snapshot-reader.ts

echo '--- production imports and calls, excluding tests/config ---'
rg -n -C5 'get(ProcessTableSnapshot|StrictProcessTableSnapshot)|parse(ProcessTableRows|StrictProcessTableRows)|PS_ARGS' src --glob '!**/*.test.ts'

echo '--- all direct parser calls, excluding the already inspected target test file ---'
rg -n -C3 'parse(ProcessTableRows|StrictProcessTableRows)\s*\(' src --glob '*.ts' --glob '!src/shared/process-table-snapshot.ts' --glob '!src/shared/process-table-snapshot.test.ts'

Repository: stablyai/orca

Length of output: 30630


🏁 Script executed:

set -euo pipefail
echo '--- command-to-process-name consumer ---'
rg -n -C8 'getForegroundProcessNameFromProcessTable|recognizeAgentProcessFromCommandLine|row\.command|command\)' src/main src/relay src/shared --glob '*.ts' --glob '!**/*.test.ts'

echo '--- parser-related test contracts around legacy and numeric command shapes ---'
sed -n '280,375p' src/shared/process-table-snapshot.test.ts

Repository: stablyai/orca

Length of output: 50370


Prevent the optional TTY/start-time group from consuming command tokens. When parseProcessTableRows or parseStrictProcessTableRows receives 100 1 100 100 Ss node 8080 server.js, the optional group parses node and 8080 as tty and startTime, so command becomes server.js. This can prevent recognizeAgentProcessFromCommandLine(row.command) from identifying the foreground agent. Anchor the group on a TTY-like token or parse the fixed columns positionally.

Source: Linters/SAST tools

Comment thread src/shared/process-table-snapshot.ts Resolved
Comment on lines +102 to +106
runtimeCall.mockRejectedValue(
new Error('Runtime request timed out before terminal.inspectProcess completed')
)
await vi.advanceTimersByTimeAsync(60_000)
expect(runtimeCall).not.toHaveBeenCalled()

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

This test does not exercise the transport failure it names.

runtimeCall.mockRejectedValue(...) is set at Line 102, but the assertion at Line 106 is expect(runtimeCall).not.toHaveBeenCalled(). No call ever consumes the rejection, so the mock is dead setup. The body proves only that a remote pane makes no cadence RPC, which the first test already asserts at Line 61.

To cover the stated behavior, trigger an event-driven inspection the way the title tests do, then assert the rejection produces no dispatch and no repeated calls.

The same gap applies to the title at Line 165. It claims process-exit dispatches "only for a positive host tombstone", but the body asserts only the positive case. Add a negative turn in which the second response carries a non-exited verdict, and assert dispatchCompletion receives no process-exit meta.

💚 Proposed fix to exercise the rejected inspection
     coordinator.startProcessTracking()
     runtimeCall.mockRejectedValue(
       new Error('Runtime request timed out before terminal.inspectProcess completed')
     )
+    coordinator.observeTitle('Codex working')
+    coordinator.observeTitle('/tmp/failed-inspection')
     await vi.advanceTimersByTimeAsync(60_000)
-    expect(runtimeCall).not.toHaveBeenCalled()
+    expect(runtimeCall).toHaveBeenCalledOnce()
     expect(dispatchCompletion).not.toHaveBeenCalled()
📝 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
runtimeCall.mockRejectedValue(
new Error('Runtime request timed out before terminal.inspectProcess completed')
)
await vi.advanceTimersByTimeAsync(60_000)
expect(runtimeCall).not.toHaveBeenCalled()
runtimeCall.mockRejectedValue(
new Error('Runtime request timed out before terminal.inspectProcess completed')
)
coordinator.observeTitle('Codex working')
coordinator.observeTitle('/tmp/failed-inspection')
await vi.advanceTimersByTimeAsync(60_000)
expect(runtimeCall).toHaveBeenCalledOnce()
expect(dispatchCompletion).not.toHaveBeenCalled()

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

Important

The evidence machinery is sound overall — the additive wire field, capability handshake, incarnation/epoch/age admission, and event-only cost invariant are all handled carefully. Two things need attention before merge: the PID-reuse fences listed in the plan aren't actually compared against anything, and the paired-runtime (daemon) path regresses the foregroundProcess compatibility field relative to both the relay and its own prior behavior.

Reviewed changes

  • Evidence contract — new RemoteForegroundEvidence (live/unverifiable/exited) with PosixFence/WindowsFence and a runtime validator in src/shared/foreground-process-evidence.ts.
  • Renderer admission — admitRemoteForegroundEvidence rejects missing incarnation binding, pty/incarnation mismatch, stale age, and non-increasing epochs on the same authority generation.
  • Host resolvers — relay PtyHandler.inspectProcess and daemon TerminalHost.inspectProcess both delegate to resolveRemoteForegroundEvidence, which enforces POSIX tty/pgid/tpgid/start-time, tty-boundary, multiplexer, and ambiguity fences; Windows-over-SSH stays unverifiable.
  • Process-table reader — process-table-snapshot-reader.ts extracts the memoized ps reader, adds Linux /proc/<pid>/stat start ticks and a macOS lstart marker, plus a getSnapshotWithAge for conservative capture age.
  • Tombstones — relay and daemon retain {incarnationId, code, expiresAt} on exit and replay a matching exited verdict on inspect.
  • Capability + inventory projection — relay advertises foregroundProcessEvidenceVersion: 1; mobile auto-refresh is suppressed against legacy hosts and sends includeForegroundProcessEvidence: false to skip host process-table work.
  • Renderer completion — pane-foreground-agent-tracker/createPaneForegroundProcessReader route remote reads through inspectRuntimeTerminalProcess; the poll scheduler short-circuits remote cadence.

⚠️ PID-reuse fences are asserted, not compared

The plan (and the PR summary's "Fences" section) lists "anchor PID start time" and "candidate PID start time" as required fences against PID reuse, but resolveRemoteForegroundEvidence only requires a start time to be present on the shell and candidate within the current capture. It never compares that start time against a prior observation, so a shell whose PID was reused by an unrelated process between spawn and inspect is not detected. The incarnation/authority/epoch fencing covers PTY replacement and host restart, but not a live incarnation whose anchor PID silently changed ownership. Either store the spawn-time anchor start marker and compare it here, or document this as an explicit R1 limitation alongside the Windows note.

Technical details
# PID-reuse fence is decorative

## Affected sites
- src/main/providers/agent-foreground-process-batch.ts:80-146 — `resolveRemoteForegroundEvidence` requires `root.startTime` and `candidate.row.startTime` to be non-empty but never compares them to a stored spawn-time value.

## Required outcome
- Detect anchor PID reuse: capture the shell's host-native start marker at spawn and reject `live` when the inspect-time marker differs (or is absent).
- Detect candidate PID reuse: same comparison for the selected foreground process, or document why a single-capture consistency check is sufficient for R1.

## Suggested approach
- Thread a spawn-time start marker into `BatchedForegroundProcessRequest` (alongside `rootPid`/`fallbackProcess`) and compare in the resolver; degrade to `unverifiable` with a stable reason on mismatch.

## Open questions for the human
- Is a single-capture start-time presence check acceptable for R1 (given epoch/incarnation fencing already bounds staleness), or does the plan's reuse fence need implementing now?

ℹ️ Nitpicks

  • foregroundProcess on the daemon path returns null for a live shell verdict (idle shell), while the relay preserves the shell name via evidence.processName ?? managed.pty.process — keep the two host paths consistent (see inline comment).
  • Tombstone retention differs between host implementations: relay 5_000ms vs daemon 2_000ms, with no shared constant or comment explaining why the reconnect grace window differs.
  • The macOS lstart column parsing (macStartMatch in parseStrictProcessTableRows/parseProcessTableRows) and the new tty=/etimes= columns are untested against a real host — the PR notes Linux SSH container validation couldn't run and macOS wasn't exercised at all. A fixture capturing real ps -axo … lstart= output would guard this.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

}
}
return {
foregroundProcess: evidence.verdict === 'live' ? evidence.processName : foregroundProcess,

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.

For a live verdict with processName: null (idle shell foreground), this returns foregroundProcess: null, whereas the pre-existing daemon behavior returned the shell name (session.getForegroundProcess()), and the relay path preserves it via evidence?.verdict === 'live' ? (evidence.processName ?? managed.pty.process) || null : managed.pty.process || null. Mixed-version or legacy consumers of this compatibility field would see null for an idle shell on the paired-runtime path but a shell name on the SSH path. Mirror the relay fallback: evidence.verdict === 'live' ? (evidence.processName ?? foregroundProcess) : foregroundProcess.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status for PR #18078\n\n- Two same-model review passes completed; final review is clean with no proven in-scope correctness, compatibility, security, or performance findings.\n- Fixed and pushed:\n - preserved legacy one-argument runtime inspection calls when no incarnation fence is supplied;\n - changed remote descendant traversal to linear time;\n - rejected delayed evidence from previously accepted authority generations;\n - bounded/pruned retired PTY evidence records in both daemon and relay;\n - added focused expiry/capacity coverage.\n- Validation: 7 focused files passed (1,325 tests, 1 skipped); passed; lint/format hooks and passed.\n- OSS precedent review completed privately; the design follows host-authoritative, fenced remote process/session identity with explicit degraded states and additive compatibility fields.\n- Electron/Grok orchestration was started with Playwright CDP-only constraints, but the worker did not produce a final screenshot report before this review ended; no screenshot evidence is claimed here.\n- Required real SSH/Linux validation remains blocked/unverified because the throwaway Docker SSH target could not start with the local Docker daemon unavailable. was not used.\n\nCurrent recommendation: land after the real SSH/Linux validation gate is run successfully; otherwise keep this residual risk explicit.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron CDP validation (ssh-identity-impl worktree)

Validated on this branch (brennanb2025/ssh-identity-impl @ 99062b1467), not PR #18062 (that is fix-omp-selector). App identity: Orca: brennanb2025/ssh-identity-impl. Playwright CDP only.

Scenario

Launched this worktree's Electron app, imported SSH host openclaw, launched Grok locally, then connected SSH, opened folder workspace /tmp as openclaw-tmp, and launched Grok on the remote PTY.

Visible

  • Local: tab grok, sidebar Grok - Idle, Grok TUI.
  • SSH: tab grok, sidebar under openclaw-tmp shows Grok - Idle now, remote Grok TUI (login/approval screen). Status bar showed Workspace conflict.

Backing

SSH PTY ssh:ssh-1788327674392-6l3kxj@@pty2:… inspectProcess returned host-stamped foregroundProcessEvidence with verdict: live, processName: grok, posix fence (tty: pts/88, shell pid, incarnation, observation epoch). Same PTY was live / bash before Grok.

Gaps

Renderer paneForegroundAgentByPaneKey did not get an SSH-pane entry in this session (title/sidebar still showed Grok). Remote Grok was not fully signed in. Paired-runtime remote: and SSH-to-Windows unverifiable paths were not exercised. A recoverable terminal-workbench HMR error was dismissed and the workbench recovered.

Screenshots (uncropped, not committed):

SSH Hosts settings:

SSH Hosts settings

Local Grok identity:

Local Grok identity

SSH workspace (pre-Grok):

SSH workspace

SSH Grok identity:

SSH Grok identity

@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 (1)
src/renderer/src/components/terminal-pane/pane-foreground-process-reader.ts (1)

48-48: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject evidence after the PTY binding changes.

expectedIncarnationId is captured before reader(...) resolves. The admission call on Line 48 does not compare it with the current binding. If the pane rebinds during the RPC, evidence for the retired incarnation still matches the captured PTY and incarnation and returns remoteEvidenceAccepted: true for the new binding. Re-read the current incarnation or use a binding-generation token after the await, then discard the result when it changed.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 65a08699-2cf8-4029-868e-3ed224aac2f6

📥 Commits

Reviewing files that changed from the base of the PR and between 99062b1 and 9832c18.

📒 Files selected for processing (10)
  • src/main/daemon/terminal-host.ts
  • src/main/providers/agent-foreground-process-batch.ts
  • src/main/runtime/orca-runtime-restore-structured-agent-session-tabs-once.ts
  • src/relay/pty-handler.ts
  • src/renderer/src/components/terminal-pane/agent-completion-process-monitor.ts
  • src/renderer/src/components/terminal-pane/pane-foreground-process-reader.ts
  • src/shared/remote-foreground-evidence-admission.ts
  • src/shared/remote-foreground-evidence.test.ts
  • src/shared/retired-pty-incarnations.test.ts
  • src/shared/retired-pty-incarnations.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/providers/agent-foreground-process-batch.ts
  • src/relay/pty-handler.ts
  • src/main/daemon/terminal-host.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Real-host SSH validation

Head validated: 9832c1856d08b4a68907772a46790dd74baad6a2 (detached worktree; git rev-parse HEAD matched before and after, with no other commit).

Environment: Docker Desktop server 29.6.1; disposable Ubuntu 24.04 ARM64 container ssh18078-1788378971-6702, SSH [email protected]:54617; pnpm build:relay passed. GitHub clone was blocked by authentication, so I used the documented local bundle fallback from demo-project; remote checkout was clean on main (67c9b9565d1596f40afbb5d4acb1ee71e56e1c4e). Installed Node 18.19.1, git 2.43.0, tmux 3.4, procps/psmisc/lsof, and Codex via npm install -g @openai/codex@latest.

V1 — PASS

Real Codex ran in a real SSH-backed pane. Host-stamped evidence received by the client:

{
  "foregroundProcess":"codex",
  "hasChildProcesses":true,
  "foregroundProcessEvidence":{
    "authorityGeneration":"1a4dbd0f-6b74-411a-a5d1-e25565f3228c",
    "observationEpoch":17,
    "capturedAgeMs":1,
    "ptyId":"pty2:1a4dbd0f-6b74-411a-a5d1-e25565f3228c:1",
    "ptyIncarnationId":"9f3ea6de-425c-4048-9036-df386c326b20",
    "verdict":"live",
    "processName":"codex",
    "fence":{"platform":"posix","shellPid":8034,"shellStartTime":"65652","tty":"pts/0","foregroundPgid":8268,"process":{"pid":8268,"startTime":"77973"}}
  }
}

V2 — PASS

While Codex was running, the pane title was changed to Claude Code; inspection still resolved processName:"codex" with verdict:"live" and the same host fence. After Ctrl-C, the same misleading title produced a shell observation with verdict:"live", processName:null, and no agent identity. A pane with a misleading title and no agent therefore stayed honest unknown; title text did not participate.

V3 — PASS

With Codex live, the remote host emitted marker-shaped bytes directly to the PTY:

printf '\033]133;A\007forged\033]777;agent=claude\007' > /dev/pts/0

Before and after evidence remained Codex live with the same fenced identity (processName:"codex", same ptyIncarnationId, shellPid/tty/foregroundPgid); no OSC bytes changed the remote identity.

V4 — PASS

Two real-host unverifiable fences were captured:

{"verdict":"unverifiable","reason":"multiplexer_boundary","ptyIncarnationId":"9f3ea6de-425c-4048-9036-df386c326b20"}

(tmux new-session -s ssh18078qa '<codex binary path>')

{"verdict":"unverifiable","reason":"incarnation_mismatch","ptyIncarnationId":"9f3ea6de-425c-4048-9036-df386c326b20"}

(expectedIncarnationId:"stale-incarnation-ssh18078").

V5 — PARTIAL (renderer transport limitation)

Natural remote process exit was proven directly against the running relay socket (bypassing the renderer's preflight hasPty gate):

{"exit":{"id":"pty2:1a4dbd0f-6b74-411a-a5d1-e25565f3228c:8","code":7,"incarnationId":"9d1c9c72-9a0d-4d72-a04e-5971979dc69e"}}
{"inspect":{"authorityGeneration":"1a4dbd0f-6b74-411a-a5d1-e25565f3228c","observationEpoch":335,"capturedAgeMs":0,"ptyId":"pty2:1a4dbd0f-6b74-411a-a5d1-e25565f3228c:8","ptyIncarnationId":"9d1c9c72-9a0d-4d72-a04e-5971979dc69e","verdict":"exited","reason":"pty_exit_7"}}

For lost contact, Docker bridge was disconnected while an SSH pane was live. The renderer inspect returned Error: SSH connection lost, reconnecting... and SSH state status:"reconnecting", error:"Relay channel lost. Reconnecting..." (not exited); after docker network connect bridge ..., state returned connected. The current renderer API converts this transport failure to an error/unavailable path instead of exposing a structured foregroundProcessEvidence.verdict:"unverifiable", so the required structured lost-contact verdict could not be captured through that API.

V6 — PASS

Instrumented the remote ps command with a counter wrapper (/usr/local/bin/ps increments ps-count then execs /usr/bin/ps). With three remote panes idle for over 60 seconds: inspectCalls: 0, psCount=0. A plain terminal input event did not probe (psCount=0); one explicit inspect produced psCount=1; five concurrent explicit inspect calls produced five live results but psCount=1, proving one host capture per burst. Renderer preload methods are non-writable, so an attempted JS wrapper could not count IPC calls; host spawn counts are real and were read from the wrapper.

V7 — PASS

After disconnect/reconnect, the old retired PTY was not reused:

{"oldPty":"ssh:ssh-1788379246285-td6ore@@pty2:1a4dbd0f-6b74-411a-a5d1-e25565f3228c:1","inspect":{"foregroundProcess":null,"hasChildProcesses":false,"unavailable":true}}

The reattached pane established fresh evidence on the same live incarnation:

{"ptyId":"pty2:1a4dbd0f-6b74-411a-a5d1-e25565f3228c:3","ptyIncarnationId":"11bd25e8-0c96-4e83-8b07-302e97b68175","verdict":"live","processName":null,"fence":{"platform":"posix","shellPid":9201,"shellStartTime":"102262","tty":"pts/0","foregroundPgid":9201}}

The provider epoch advanced from db1d92dfd14173c34df4c322-3 to 7ea1ef3bd1a6c591311f230a-4; stale PTY 1 remained unavailable and was never adopted as the replacement.

Disposition

DO NOT LAND pending a renderer/runtime path that surfaces a structured unverifiable verdict for lost SSH contact (the host-level exit tombstone and all other identity/fence/cost/reconnect proofs pass).

@brennanb2025

Copy link
Copy Markdown
Contributor Author

V5 blocker closed in commit 487d994ceb6296e44a707b175d3ddd638a852d9e (starting HEAD was 9832c18).

Refactor:

  • Added the shared TerminalProcessInspection union. ClientOnlyUnverifiableInspection is a distinct verdict: verdict=unverifiable, no process/child assertion, and authorityGeneration, observationEpoch, capturedAgeMs, ptyId, ptyIncarnationId, and foregroundProcessEvidence are all forbidden at the type level.
  • Centralized transport classification (SSH connection/socket loss, timeout, stale/gone PTY, unsupported old host) and made inspectRuntimeTerminalProcess total for those outcomes. Programming errors remain throws. Legacy no-evidence host responses are normalized to client-only old_host; no synthetic host record is serialized.
  • Removed the unavailable boolean from the provider/preload/renderer inspection contract and replaced all consumers with verdict handling.

Audited call sites:

  • main provider/daemon/IPC inspection adapters and preload PTY API
  • runtime-terminal-inspection owner routing and direct SSH routing
  • pane-foreground-process-reader and pane-foreground-agent-tracker
  • agent-completion-process-monitor and coordinator types
  • pane-agent-identity wiring, terminal-keydown-fit wiring, and startup serializer inspection
  • running-terminal-close-guard
  • codex-pane-restart-eligibility and codex-session-restart

Client-only unverifiable now retains a known agent identity, never confirms shell/exit, never enters process-exit completion, and never counts as a busy process. Host exited remains accepted only from a fenced, admitted host evidence tombstone; terminal_gone/socket loss alone maps to unverifiable.

RED proof (baseline 9832c18, blocker reproducer):
Lost contact while the host was reconnecting returned status reconnecting and rejected the inspect promise with: Error: SSH connection lost, reconnecting...
There was no structured verdict for the caller to assert.

GREEN proof (487d994ceb, after):
npx vitest run --config config/vitest.config.ts src/renderer/src/runtime/runtime-terminal-inspection.test.ts
Test Files 1 passed (1)
Tests 33 passed (33)
The suite covers lost contact, timeout, old-host/no-evidence, stale/gone handles, metadata absence/type proof, and unclassified programming errors. Final focused validation: 11 files passed, 279 tests passed; non-incremental tc:web and tc:node both passed; changed-code quality passed with 0 new findings.

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

Reviewed changes — a single commit landed since the last review pass: fix(ssh): make remote process inspection total.

  • Introduced src/shared/terminal-process-inspection.ts defining TerminalProcessInspection = HostProcessInspection | ClientOnlyUnverifiableInspection, plus clientOnlyUnverifiableInspection() (a constructor whose type forbids host-identity fields), isClientOnlyUnverifiableInspection(), and classifyTerminalProcessInspectionFailure() mapping terminal_gone / timeout / old_host / transport_loss from error codes and messages.
  • Threaded expectedIncarnationId through the paired-runtime terminal.inspectProcess RPC (additive optional TerminalHandle field) and the preload inspectProcess bridge.
  • Added normalizeInspectionResult at the renderer boundary, collapsing old hosts (missing foregroundProcessEvidence) to old_host, legacy unavailable: true to terminal_gone, and classified transport/timeout failures to client-only unverifiable results instead of throwing.
  • Swapped every unavailable === true consumer (close guard, completion monitor, pane tracker, codex restart-eligibility) onto isClientOnlyUnverifiableInspection.

No new issues found in this delta: the discriminated union is sound, the failure classifier stays conservative (unclassified programming errors still throw, covered by the still throws an unclassified programming error test), and the type-proof test asserts client-only results carry no host metadata.

Approval is held only because the one open review thread — the daemon path returning foregroundProcess: null for a live idle-shell verdict where the relay preserves the shell name via evidence.processName ?? managed.pty.process — is untouched by this commit. It is pre-existing and I am not re-raising it as a new finding.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Real-host SSH validation V5 re-run at 487d994ceb

Date: 2026-09-02

Scope and exact revision

  • Worktree: /Users/brennanbenson/orca/workspaces/orca/ssh-val-v5
  • First command: git rev-parse HEAD
  • Captured output: 487d994ceb6296e44a707b175d3ddd638a852d9e
  • Validation ran with no checkout, reset, merge, or source change; final git status --short was clean after removing harness-only files.
  • pnpm build:relay passed before connecting.

Host/setup

  • Disposable Ubuntu 24.04 ARM64 Docker container with sshd: orca-ssh-test-18078-v5-1788386263.
  • SSH target: [email protected]:23078 (never ssh localhost).
  • Remote project: local bundle fallback from /Users/brennanbenson/orca/sta4343-collision/demo-project (GitHub clone was unavailable); unpacked at /work/demo-project.
  • Remote versions: Node v18.19.1, npm 9.2.0, Git 2.43.0, stock relay node-pty.
  • Electron launched from this worktree with isolated user data /tmp/orca-ssh-test-18078-v5-1788386263/orca-user-data, CDP 9380, renderer 5180; window.api.app.getIdentity() returned ssh-val-v5 @ 487d994ceb before interaction.
  • Installed remote @openai/codex@latest (codex-cli 0.152.1) in the disposable container.

Required V5 proofs

V5a — lost contact is structured

While a live SSH pane was connected, Docker bridge connectivity was broken with docker network disconnect bridge orca-ssh-test-18078-v5-1788386263. Renderer inspect returned this object (not a thrown exception):

{
  "foregroundProcess": null,
  "hasChildProcesses": false,
  "verdict": "unverifiable",
  "reason": "transport_loss"
}

The result had no authorityGeneration, observationEpoch, capturedAgeMs, ptyId, or ptyIncarnationId; it was not exited and did not surface the former Error: SSH connection lost, reconnecting... / status:"reconnecting" renderer state.

V5b — identity survives lost contact

With the pane's known agent identity seeded as Codex, the same bridge disconnect produced verdict:"unverifiable", reason:"transport_loss" while retaining:

{"agent":"codex","shellForeground":false,"routingTrusted":true}

The identity was not cleared or rendered as an exit. After restoring the bridge and reconnecting SSH, the pane re-established live fenced process evidence.

V5c — real exit still reports exited

Direct relay RPC against a live spawned PTY, followed by sending exit 7, returned:

{
  "foregroundProcess": null,
  "hasChildProcesses": false,
  "foregroundProcessEvidence": {
    "authorityGeneration": "7283b230-b736-4ad8-aaec-b93aeacea400",
    "observationEpoch": 31,
    "capturedAgeMs": 0,
    "ptyId": "pty2:7283b230-b736-4ad8-aaec-b93aeacea400:9",
    "ptyIncarnationId": "f8aa89ce-57fc-40e9-a043-29d1919da808",
    "verdict": "exited",
    "reason": "pty_exit_7"
  }
}

This is positive host evidence tied to the authority generation, PTY ID, and PTY incarnation. The renderer preflight retires the handle after exit and maps that stale-handle path to terminal_gone, so this proof used the relay RPC before the renderer's handle-retirement conversion.

V5d — exited cannot be forged client-side

A stale SSH PTY handle / socket-close (terminal_gone) alone returned structured unverifiable with reason:"terminal_gone" and exited:false; it did not produce verdict:"exited".

Regression proofs

  • V1: Live remote identity remained present with a populated POSIX fence (authorityGeneration, observationEpoch, ptyId, ptyIncarnationId, shellPid, tty, and foregroundPgid).
  • V3: Remote printf of marker-shaped OSC 133/777 bytes left the same live identity and POSIX fence unchanged.
  • V6: Seven idle remote panes were observed for more than 60 seconds. The remote /usr/bin/ps counting wrapper remained at 0 (zero inspect RPCs and zero process-table spawns while idle). Five concurrent explicit inspect calls all returned live results and triggered exactly one remote process-table capture (ps count increased by one), demonstrating burst coalescing.
  • Renderer inspect-RPC monkey-patching was attempted but window.api.pty.inspectProcess is non-writable and non-configurable; V6 therefore uses the required remote counting wrapper plus the observed explicit-call burst.

Verdict

LAND. V5a–V5d and the requested V1/V3/V6 regression pass all passed at the exact new head 487d994ceb6296e44a707b175d3ddd638a852d9e.

@brennanb2025
brennanb2025 force-pushed the brennanb2025/ssh-identity-impl branch from 487d994 to 1b0a310 Compare September 2, 2026 23:10
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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 in this delta — the measured-age change is sound and the buffer-ceiling spread is mechanical.

Reviewed changes — this run re-reviewed the net delta since the prior Pullfrog review (the branch was rebased, so the seven commit SHAs were rewritten with unchanged subjects).

  • Measured capture age — capturedAgeMs now carries the real age from a new getSnapshotWithAge reader method, replacing the hardcoded worst-case PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS stamp in both the relay (pty-handler.ts) and the daemon (terminal-host-process-inspection.ts).
  • Buffer-ceiling spread — PS_MAX_BUFFER_BYTES (32MB) applied to the two remaining ps invocations in pty-shell-utils.ts and shell-process-readiness.ts.
  • Reader extraction — the memoized process-table reader moved into process-table-snapshot-reader.ts, with process-table-index.ts holding the correlation index; ~24 call sites updated via mechanical import changes.

Approval remains held solely on the one pre-existing open thread (the daemon returning foregroundProcess: null for a live idle-shell verdict — terminal-host-process-inspection.ts:72). It is untouched by this delta, so I am not re-raising it here.

ℹ️ Nitpicks

  • The capturedAgeMs contract in src/shared/foreground-process-evidence.ts still documents the field as It is an upper bound, not an estimate and that the producer stamps for that worst case (PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS). This delta switched the producer to the measured age, so the docstring is now stale — worth updating so a future reader doesn't assume the field over-approximates when a slow ps scan's rows can be older than the stamp implies.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Merge Sim added 4 commits September 2, 2026 16:51
The design doc does not belong in the product repo; it stays out of the
shipped tree while the implementation carries its own comments.
OrcaWin added a commit that referenced this pull request Oct 1, 2026
…24413)

Paired clients read RuntimeMobileSessionTab.incarnationId to fence remote
identity observations (#18078), but projectRuntimeMobileSessionTabs never set
it, so remote-runtime-pty-transport always saw null and the fence never
engaged. The projection now publishes the incarnation of the PTY record that
owns the issued handle, never a stale incarnation persisted on the tab.

Ported from #16741 (a68b6f3).

Co-authored-by: m4air <[email protected]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* docs: add SSH agent identity implementation plan

* feat(ssh): host-stamped remote foreground identity

* fix(runtime): preserve unfenced inspect call shape

* perf(ssh): traverse foreground descendants linearly

* fix(ssh): bound retired PTY evidence records

* test(ssh): cover retired incarnation retention

* fix(ssh): make remote process inspection total

* Split SSH identity build hot spots

* Fix process table snapshot module split

* test(ssh): update process inspection expectations

* docs: drop the SSH identity plan from the PR

The design doc does not belong in the product repo; it stays out of the
shipped tree while the implementation carries its own comments.

---------

Co-authored-by: Merge Sim <sim@local>
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