Skip to content

fix(terminal): retire replaced remote terminal identity - #20135

Closed
mmarabel wants to merge 8 commits into
stablyai:mainfrom
mmarabel:fix/remote-terminal-durable-identity-18464
Closed

mmarabel wants to merge 8 commits into
stablyai:mainfrom
mmarabel:fix/remote-terminal-durable-identity-18464

Conversation

@mmarabel

Copy link
Copy Markdown
Contributor

ELI5

When a remote terminal gets replaced (daemon restart or upgrade, shell respawn), the pane should describe the new terminal and stop describing the one that is gone. Before this change the host kept publishing the old process's title, its agent identity and a completed "Pi" row stamped onto the new terminal's handle — which is what made a recovered pane look alive with stale state. This change attributes every observation to the session that produced it, accepts automatic state only for the terminal that actually won the replacement, and retires the previous terminal's automatic identity only when a replacement is positively proven.

What Changed

  • Carry the emitting session's incarnation on daemon stream data, data gaps and background facts as optional fields, preserved through coalescing, NDJSON splitting, keep-tail thinning and gaps.
  • Parse unadmitted automatic observations in source-scoped capsules and promote the winner inside the existing binding/registration commit — after binding persistence/CAS and final registration, before the mobile and graph publication tail. Rejected, superseded or overflowing candidates cannot reach the accepted surface.
  • Retire predecessor-owned durable identity on a proven known-old → known-new replacement: automatic surface label, leaf pane title, restore seeds and hook live claims, keeping the resume remnant.
  • Stop projecting a retained resume remnant onto the successor pane's status or published agent identity.
  • Restore the full identity regression in the paired Electron scenario and add host-side assertions, so the host — not just the client mirror — is checked.

Automatic clearing is no longer part of the pre-commit sequence reset, so a failed or cancelled spawn no longer wipes accepted state early. Raw output, query replies, model receipts and sequence accounting are unaffected while a candidate is unadmitted.

Why

Issue #18464's recording showed a recovered pane rendering blank; the follow-up diagnosis showed the host still publishing the predecessor's Pi title and a completed Pi row on the successor handle after a replacement. The cause spans three layers: the daemon stream and runtime parsers key by PTY id (so a successor's early bytes are indistinguishable from the predecessor's without source metadata); the runtime consumed automatic title/status before knowing which incarnation was finally admitted; and durable records (persisted tab label, leaf pane title, hook rows, restore seeds) were never retired because the exit path had already removed the very binding a naive "previous identity" lookup would read.

Each layer is fixed at its own boundary, which is also why the change is larger than a title-string clear: the alternative — comparing titles or clearing strings after the fact — cannot survive an identical successor title, and would either mask live state or delete a user's own rename.

Linked Issue

Fixes #18464

Stack 2/2. Built on top of #19925 (terminal recovery and replacement mouse state). Both PRs target main, and this branch currently contains that PR's two commits; it will be rebased onto main once PR 1 merges. Either PR merged alone fixes a real part of the issue; this one is the part that stops stale agent identity being published.

Visual Proof

Proven replacement in the isolated paired host/client scenario, after the replacement has settled. Before: the predecessor's Pi title, identity and completed agent row survive on the successor handle. After: the surface carries its stable label and the host publishes no predecessor identity or agent row.

Before After
Stale Pi title and completed row after replacement Stable label and no predecessor identity after replacement

Screenshots were captured through hidden CDP against disposable Linux fixtures; no native window was shown or focused.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Verification on this commit (all under a sanitized environment, disposable HOME, Xvfb, ORCA_BACKGROUND_LAUNCH=1, no global E2E setup):

  • Broad main/shared suite: 4,126 files / 41,896 tests passed, 0 failed.
  • Targeted suites for the touched subsystems (mobile status builder and projection, spawn admission, retirement, reaper ratchet, module-size and agent-identity ratchets): 1,365 passed.
  • Node and web TypeScript checks, changed-file formatting/lint, changed-code quality (0 new findings) and the cross-version terminal wire skew suite all pass.
  • Electron E2E build passes; the restored full-identity paired scenario passed three consecutive runs, with the warm restart control (same incarnation keeps its title) and the mouse/geometry controls still green.
  • Failing-then-passing controls are recorded for each fix: the geometry/mouse regressions (PR 1), the frozen post-promotion tracker, the dropped generation reset, the raw-sequence overcount in thinned query salvage, and the retired-remnant projection. Each control log shows the failure with the fix disabled and the pass with it enabled.
  • Two pre-existing flaky tests (orca-runtime-files-terminal-artifact-io, worktree-git-common-polling) were characterised by isolated re-runs; neither file is touched by this change and the final broad run is green.

No native macOS/Windows or real SSH rendered validation; mixed-version coverage is protocol-level. Full repository lint/test/build suites are not claimed.

AI Disclosure

AI-assisted implementation with separate independent review at each stage (multiple assistant models), plus supervisor inspection of diffs, tests and evidence artifacts.

Review

The work was split into three reviewed stages — daemon source provenance, runtime observation admission, and durable identity retirement — each independently reviewed, with the reviewer's findings reproduced as failing tests before being fixed and then re-verified by the same reviewer:

  • Promoted-parser tracker was inert after adoption, which would have frozen live title/status processing for the successor (found and fixed with a post-promotion live test).
  • A held-back generation reset was silently dropped on successful commits that register no worktree PTY.
  • Whole-span thinning could let a salvaged zero-weight query regain raw sequence weight (95 counted vs 91 actual).
  • A retained provider-session remnant could still be projected as a completed Pi row on the successor handle; the fix is instance-scoped and keeps the remnant for resume.
  • A previously unrun src/shared ratchet that this work had left red was found by the broad gate and fixed.

Security, cross-platform, SSH/remote, mobile and backwards-compatibility review: retirement is main-process-only and process-local, writes no liveness verdict, invents no exit or completion, adds no new opcode or required field, preserves resume/history addressability, and is bounded and reaped.

Agent skill upstream boundary

  • Not applicable; no skill-installer material changed.

Notes

Known limitations, recorded deliberately rather than fixed here:

  • A renderer-owned pane/title cache can still replay a stale title in the renderer's own store; the host no longer carries it forward. Client-side masking is out of scope.
  • The known-predecessor record is process-local: a host restart inside the exit → successor window skips retirement (conservative — never a false retirement).
  • A successor that never titles itself keeps its stable label (Terminal), which is a visible change from the previous behaviour.
  • A successor hook event ingested before its own replacement proof is treated as predecessor-era evidence until its next event.
  • Legacy pane:N surfaces are outside the retirement, which applies to stable-pane surfaces.

Checklist

  • Scoped to the stale-identity repair and its regression coverage
  • Changes and rationale explained, including ELI5
  • Before/after screenshots attached
  • Self-reviewed and independently reviewed for correctness, security and performance
  • Cross-platform, SSH/remote, mobile ownership and backwards compatibility considered
  • Full pnpm lint, pnpm typecheck, pnpm test, and pnpm build run; targeted checks listed above

A remote terminal whose daemon session is replaced can keep publishing the
predecessor's automatic title, agent identity and completed status onto the
successor handle, because the daemon stream, runtime parsers and durable
records all key by PTY id while the replacement is only known after the spawn
reply. The same replacement also leaves predecessor mouse modes armed.

- carry the emitting session's incarnation on daemon stream data, gaps and
  background facts as optional fields, so observations keep their source
  through coalescing, NDJSON splitting, thinning and gaps
- parse unadmitted automatic observations in source-scoped capsules and
  promote the winner inside the existing binding/registration commit, before
  the mobile and graph publication tail, so a rejected or superseded candidate
  cannot reach the accepted surface
- retire predecessor-owned durable identity on a proven known-old to known-new
  replacement: automatic surface label, leaf pane title, hook live claims and
  restore seeds, keeping custom/generated/default labels, split siblings and
  resume identity
- stop projecting a retained resume remnant onto the successor pane's status
  or published agent identity

Preserves same-incarnation reattach, unknown or legacy panes, custom titles,
history and resume addressability, and mixed-version clients (optional fields
only, no new opcode).

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the complete diff — 100 files, ~5920 added lines — and validated the load-bearing paths against the surrounding sources.

  • Daemon source provenance — an optional incarnationId rides data / data-gap / transient-fact / background-marker events through coalescing, NDJSON splitting, keep-tail thinning and gap accounting, so a successor's early bytes are never parsed as the predecessor's (daemon-stream-data-entry.ts, daemon-stream-data-split.ts, daemon-stream-keep-tail-drop.ts, BackgroundTransientFactRelay).
  • Runtime observation admission — unadmitted known-source observations parse into source-scoped capsules and are promoted inside the binding/registration commit, after persistence/CAS and final registration and before the publication tail; rejected, superseded or overflowing candidates cannot reach the accepted surface (runtime-pty-observation-{capsule,admission,routing,promotion}.ts).
  • Durable identity retirement — a proven known-old → known-new replacement retires the predecessor-owned automatic surface label, leaf pane title, restore seeds and hook live claims while keeping the resume remnant (runtime-pty-replacement-durable-retirement.ts, runtime-retired-pane-evidence.ts).
  • Renderer rebind — remote-pty-incarnation-replacement.ts clears predecessor agent identity on a proved remote replacement; replay-drain and transport fence on the incarnation id.
  • Regression coverage — the paired Electron E2E is restored with host-side assertions, and the module-size / reaper / agent-identity ratchets are updated.

The central design is appropriately conservative: the retirement proof is a strict known-old → known-new incarnation transition, absence (untagged stream, registration without an incarnation, same-incarnation reattach, disconnect) is never treated as replacement, and all new wire fields are optional (no new opcode). The memory-reaping and token-lifecycle paths are audited by ratchet tests rather than trusted by name.

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

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b81296a5-96ef-4bc1-8964-db3227f17a06

📥 Commits

Reviewing files that changed from the base of the PR and between a98edfd and 45ccca6.

📒 Files selected for processing (51)
  • src/main/daemon/daemon-pty-adapter-session-adoption.test.ts
  • src/main/daemon/daemon-pty-adapter-source-incarnation.test.ts
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/daemon-server.ts
  • src/main/daemon/daemon-stream-data-batcher.ts
  • src/main/daemon/daemon-stream-data-entry.ts
  • src/main/daemon/daemon-stream-data-split.ts
  • src/main/daemon/daemon-stream-droppability-lifecycle.test.ts
  • src/main/daemon/daemon-stream-keep-tail-drop.ts
  • src/main/daemon/daemon-stream-source-incarnation.test.ts
  • src/main/daemon/daemon-terminal-admission.ts
  • src/main/daemon/session.ts
  • src/main/daemon/terminal-host-agent-session.test.ts
  • src/main/daemon/terminal-host-create-contract.ts
  • src/main/daemon/terminal-host.ts
  • src/main/ipc/pty-controller-spawn-admission.test.ts
  • src/main/ipc/pty-runtime-kill-and-exit.test.ts
  • src/main/ipc/pty/ipc/spawn-run.ts
  • src/main/ipc/pty/provider/bind-listeners.ts
  • src/main/ipc/pty/runtime/spawn-commit-adopted-owner.test.ts
  • src/main/ipc/pty/runtime/spawn-commit.ts
  • src/main/ipc/pty/runtime/spawn-execute.ts
  • src/main/ipc/pty/runtime/spawn-state.ts
  • src/main/ipc/pty/runtime/spawn.ts
  • src/main/runtime/orca-runtime-apply-tracked-pty-title.ts
  • src/main/runtime/orca-runtime-build-pty-terminal-summary.ts
  • src/main/runtime/orca-runtime-get-unpersisted-tracked-title-for-pty.ts
  • src/main/runtime/orca-runtime-maybe-hydrate-headless-from-renderer.ts
  • src/main/runtime/orca-runtime-on-pty-data.ts
  • src/main/runtime/orca-runtime-on-pty-exit.ts
  • src/main/runtime/orca-runtime-preserved-branch-cleanup.ts
  • src/main/runtime/orca-runtime-prune-mobile-session-tab-group-layout.ts
  • src/main/runtime/orca-runtime-register-pty.ts
  • src/main/runtime/orca-runtime-state-fields.ts
  • src/main/runtime/orca-runtime-tests/pty-observation-admission.spec.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/pty-exit-per-pty-map-reaper-ratchet.test.ts
  • src/main/runtime/runtime-pty-observation-capsule.ts
  • src/main/runtime/runtime-pty-replacement-identity-retirement.test.ts
  • src/main/runtime/runtime-pty-replacement-retired-evidence.test.ts
  • src/main/startup/main-process-runtime-service.ts
  • src/renderer/src/components/terminal-pane/pty-connection-remote-snapshot-source-grid.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.ts
  • src/renderer/src/components/terminal-pane/pty-connection/reattach-grid-push.ts
  • src/renderer/src/components/terminal-pane/pty-connection/remote-pty-incarnation-replacement.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/renderer/src/lib/pane-manager/pane-fit-unknown-owner-size.test.ts
  • src/shared/pane-agent-identity-inventory.test.ts
  • tests/e2e/paired-remote-terminal-replacement-state.spec.ts
Files not reviewed due to moderation or processing errors (9)
  • src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.ts
  • src/renderer/src/components/terminal-pane/pty-connection/reattach-grid-push.ts
  • src/renderer/src/components/terminal-pane/pty-connection/remote-pty-incarnation-replacement.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/renderer/src/components/terminal-pane/pty-connection-remote-snapshot-source-grid.test.ts
  • src/renderer/src/lib/pane-manager/pane-fit-unknown-owner-size.test.ts
  • tests/e2e/paired-remote-terminal-replacement-state.spec.ts
  • src/shared/pane-agent-identity-inventory.test.ts

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


📝 Walkthrough

Walkthrough

The change adds PTY incarnation metadata to daemon events and remote terminal updates. Runtime spawn flows now manage observation admissions and promote source-scoped parser state. Replacement handling records predecessor evidence and retires inherited identity and title state. Renderer rebind and replay paths check incarnation identity. The change also updates stream thinning, fit-override validation, and tests, including a paired remote-terminal replacement test.

Fixed issue severity: Medium

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 45ccc

Replacing a remote terminal is safer with this change, but two edge cases remain. A successor terminal's early title or status can still be lost during a cold replacement, and concurrent spawns may interfere with each other's admission state. Resolve or explicitly accept these before merging.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to 45ccc

The replacement safeguards appear to prevent an uncommitted terminal from taking over a pane’s identity. The change nevertheless affects several identity and recovery paths, and incomplete coverage leaves some failure and compatibility behavior uncertain.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The relevant exposure is incorrect attribution of terminal-controlled titles, status, or transient facts to a pane and its downstream identity projections, rather than a demonstrated expansion of daemon or operating-system privilege.

Trust Boundaries and Controls

  • observed — A known, differing source is routed to a private observation capsule; refused sources cannot apply transient facts, and overflow blocks candidate preparation. Missing source metadata instead follows the compatibility live route.

Resilience and Maintainability Implications

  • observed — Stale admissions do not promote a capsule, and failure handling discards pending candidates rather than clearing the previously accepted identity before commit.

Hardening Proposals

  • proposed — Where a daemon version guarantees incarnation metadata, distinguish an unexpectedly untagged observation from intentional legacy traffic before allowing it to update live automatic identity.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ❓ Inconclusive Docstring coverage is 25.24% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 103 functions across 89 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 identifies the main change: retiring stale identity when a remote terminal is replaced.
Description check ✅ Passed The description covers the required sections, explains the user-facing change and rationale, links issue #18464, includes visual proof, and reports testing and known limitations. It also clearly state…
Linked Issues check ✅ Passed Issue [#18464] requires reliable remote attachment and rendering of existing terminal contents. The PR carries PTY incarnation provenance through daemon streams, replay, and remote rebinds. It retires…
Out of Scope Changes check ✅ Passed The changes address remote terminal attachment, replay, replacement identity, geometry recovery, and their regression tests. These changes support reliable rendering and state recovery for the long-li…
Full details: Docstring Coverage

Explanation

Docstring coverage is 25.24% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 103 functions across 89 files. (1 skipped: 1 over the file limit.)

Warning

Review coverage is incomplete: 9 files could not be fully reviewed. Findings from completed review steps are included; see review info for details.


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

Caution

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

⚠️ Outside diff range comments (1)
src/main/daemon/daemon-terminal-admission.ts (1)

148-148: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Include the incarnation ID in the reattach background marker.

Line 148 emits a source-less sessionBackgroundMarker when a client attaches to an already backgrounded session. result.incarnationId is available at this point. Without it, consumers cannot apply winner-only source admission to this marker.

Proposed fix
       payload: {
-        background: true
+        background: true,
+        incarnationId: result.incarnationId
       }

This preserves the source-provenance contract described in the PR objective.

🧹 Nitpick comments (2)
src/renderer/src/components/terminal-pane/pty-connection-remote-snapshot-source-grid.test.ts (1)

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

The ordering assertion can pass without proving order.

writes.indexOf('SUCCESSOR_FRAME') requires an element that equals the frame exactly. If the successor frame is ever coalesced with adjacent bytes into one write, indexOf returns -1, and toBeGreaterThan(-1) then succeeds for any LIVE_ACK index. The ordering guarantee is the point of this regression test, so assert that the successor frame index was found.

Use findIndex with an inclusion check and require a non-negative index.

💚 Proposed assertion change
-      expect(writes.findIndex((data) => data.includes('LIVE_ACK'))).toBeGreaterThan(
-        writes.indexOf('SUCCESSOR_FRAME')
-      )
+      const successorIndex = writes.findIndex((data) => data.includes('SUCCESSOR_FRAME'))
+      expect(successorIndex).toBeGreaterThanOrEqual(0)
+      expect(writes.findIndex((data) => data.includes('LIVE_ACK'))).toBeGreaterThan(successorIndex)
src/renderer/src/components/terminal-pane/pane-foreground-agent-tracker.ts (1)

263-268: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Release the retained capability in resetForPtyReplacement. The method cancels the read without scheduling a successor. Its only production caller clears the sample flags but does not run onVisibleForegroundSettled, which also revokes pending routing confirmation. Capture hasPendingRead() before cancellation and release the capability when a read is abandoned.

♻️ Proposed change
     resetForPtyReplacement() {
+      const hadReadAtReset = hasPendingRead()
       cancelPendingRead()
+      releaseRetainedCapability(hadReadAtReset)
       hasForegroundAgentEvidence = false
       hasKnownAgentEvidence = false
       hasAgentExpectation = false
     },

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6bacb9ba-c81f-4038-83fe-b4a3fd438fd7

📥 Commits

Reviewing files that changed from the base of the PR and between 9a56797 and c908516.

📒 Files selected for processing (100)
  • src/main/daemon/daemon-background-transient-facts.test.ts
  • src/main/daemon/daemon-background-transient-facts.ts
  • src/main/daemon/daemon-pty-adapter-session-adoption.test.ts
  • src/main/daemon/daemon-pty-adapter-source-incarnation.test.ts
  • src/main/daemon/daemon-pty-adapter.test.ts
  • src/main/daemon/daemon-pty-adapter.ts
  • src/main/daemon/daemon-pty-event-subscriptions.ts
  • src/main/daemon/daemon-pty-router-events.ts
  • src/main/daemon/daemon-pty-runtime-state.ts
  • src/main/daemon/daemon-server.ts
  • src/main/daemon/daemon-session-background-routing.ts
  • src/main/daemon/daemon-stream-data-batcher.ts
  • src/main/daemon/daemon-stream-data-entry.ts
  • src/main/daemon/daemon-stream-data-split.ts
  • src/main/daemon/daemon-stream-droppability-lifecycle.test.ts
  • src/main/daemon/daemon-stream-events.ts
  • src/main/daemon/daemon-stream-keep-tail-drop.ts
  • src/main/daemon/daemon-stream-source-incarnation.test.ts
  • src/main/daemon/daemon-terminal-admission.ts
  • src/main/daemon/session-live-stream-scan-state.test.ts
  • src/main/daemon/session-output-plane.ts
  • src/main/daemon/session.test.ts
  • src/main/daemon/session.ts
  • src/main/daemon/terminal-host-agent-session.test.ts
  • src/main/daemon/terminal-host-create-contract.ts
  • src/main/daemon/terminal-host-pty-owner-backend.test.ts
  • src/main/daemon/terminal-host-session-inspection-operations.ts
  • src/main/daemon/terminal-host.ts
  • src/main/ipc/pty-buffer-snapshot-dispatch.test.ts
  • src/main/ipc/pty-controller-spawn-admission.test.ts
  • src/main/ipc/pty-daemon-spawn-wsl-runtime.test.ts
  • src/main/ipc/pty-hidden-at-spawn-mark.test.ts
  • src/main/ipc/pty-ipc-hidden-delivery-gate.test.ts
  • src/main/ipc/pty-runtime-kill-and-exit.test.ts
  • src/main/ipc/pty-spawn-runtime-handle-binding.test.ts
  • src/main/ipc/pty/ipc/spawn-commit.ts
  • src/main/ipc/pty/ipc/spawn-execute.ts
  • src/main/ipc/pty/ipc/spawn-run.ts
  • src/main/ipc/pty/ipc/spawn-state.ts
  • src/main/ipc/pty/pane/spawn-observation-admission.ts
  • src/main/ipc/pty/provider/bind-listeners.ts
  • src/main/ipc/pty/runtime/spawn-commit-adopted-owner.test.ts
  • src/main/ipc/pty/runtime/spawn-commit-adopted-owner.ts
  • src/main/ipc/pty/runtime/spawn-commit.ts
  • src/main/ipc/pty/runtime/spawn-execute.ts
  • src/main/ipc/pty/runtime/spawn-state.ts
  • src/main/ipc/pty/runtime/spawn.ts
  • src/main/providers/pty-provider-events.ts
  • src/main/runtime/orca-runtime-build-pty-terminal-summary.ts
  • src/main/runtime/orca-runtime-emit-daemon-pty-transient-fact.ts
  • src/main/runtime/orca-runtime-get-unpersisted-tracked-title-for-pty.ts
  • src/main/runtime/orca-runtime-maybe-hydrate-headless-from-renderer.ts
  • src/main/runtime/orca-runtime-module-size.test.ts
  • src/main/runtime/orca-runtime-on-pty-data.ts
  • src/main/runtime/orca-runtime-on-pty-exit.ts
  • src/main/runtime/orca-runtime-preserved-branch-cleanup.ts
  • src/main/runtime/orca-runtime-prune-mobile-session-tab-group-layout.ts
  • src/main/runtime/orca-runtime-pty-observation-admission.ts
  • src/main/runtime/orca-runtime-pty-observation-routing.ts
  • src/main/runtime/orca-runtime-record-agent-prompt-lifecycle-state.ts
  • src/main/runtime/orca-runtime-register-pty.ts
  • src/main/runtime/orca-runtime-schedule-wait-blocked-check.ts
  • src/main/runtime/orca-runtime-state-fields.ts
  • src/main/runtime/orca-runtime-tests/pty-observation-admission.spec.ts
  • src/main/runtime/orca-runtime-write-orchestration-pointer-pty.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/pty-exit-per-pty-map-reaper-ratchet.test.ts
  • src/main/runtime/runtime-mobile-agent-status-builder.ts
  • src/main/runtime/runtime-mobile-session-projection-contract.ts
  • src/main/runtime/runtime-mobile-session-projection.ts
  • src/main/runtime/runtime-pty-observation-admission.test.ts
  • src/main/runtime/runtime-pty-observation-admission.ts
  • src/main/runtime/runtime-pty-observation-capsule.ts
  • src/main/runtime/runtime-pty-observation-promotion.ts
  • src/main/runtime/runtime-pty-replacement-durable-retirement.ts
  • src/main/runtime/runtime-pty-replacement-identity-retirement.test.ts
  • src/main/runtime/runtime-pty-replacement-identity-retirement.ts
  • src/main/runtime/runtime-pty-replacement-retired-evidence.test.ts
  • src/main/runtime/runtime-retired-pane-evidence.ts
  • src/main/startup/main-process-runtime-service.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/pty-connection-daemon-snapshot-replay.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-remote-snapshot-source-grid.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-replay-payload-handling.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pane-pty-visibility-bind.ts
  • src/renderer/src/components/terminal-pane/pty-connection/pty-input-forward.ts
  • src/renderer/src/components/terminal-pane/pty-connection/remote-pty-incarnation-replacement.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection/remote-pty-incarnation-replacement.ts
  • src/renderer/src/components/terminal-pane/pty-connection/replay-data-drain.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-incarnation-recovery.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/renderer/src/lib/pane-manager/pane-fit-unknown-owner-size.test.ts
  • src/renderer/src/lib/pane-manager/pane-fit.ts
  • src/renderer/src/runtime/web-session-terminal-handle-events.test.ts
  • src/renderer/src/runtime/web-session-terminal-handle-events.ts
  • src/shared/pane-agent-identity-inventory.test.ts
  • tests/e2e/helpers/remote-terminal-geometry-probe.ts
  • tests/e2e/paired-remote-terminal-replacement-state.spec.ts
  • tests/playwright.remote-replacement.config.ts

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

Review of the replacement-identity stack surfaced eight defects and one
test-only weakness; each was reproduced before being fixed.

- keep the observed source recorded as an explicit value so a delayed exit
  naming a superseded incarnation cannot dispose the successor's tracker
- preserve the restore-seed fence, and the retired-evidence fence, through an
  unconfirmed SSH exit: loss of contact is not evidence of death, and the
  retained predecessor row must not be re-seeded or re-projected onto the
  successor while its liveness is unverifiable
- make observation refusal explicit instead of sharing the live path's null
  result, so a capacity-refused source cannot mutate accepted state
- release the pane-keyed retired-evidence record on the disconnect/prune path
  as well as on the certified exit
- match a retired row by its own observation revision when both rows carry
  one, so a successor row reusing the same provider session, agent type and
  millisecond can no longer be filtered out and lose its live status
- re-check the captured incarnation after each asynchronous replay write
- stamp the reattach background marker with its emitting incarnation
- make the replay-ordering assertion non-vacuous when frames coalesce

The one remaining review item is rebutted in the thread: the foreground
tracker's retained capability is released by its only caller.
@greptile-apps

greptile-apps Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Too many files changed for review (107 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@mmarabel

Copy link
Copy Markdown
Contributor Author

Addressed in a1d8a1c. All six inline threads are replied to and resolved; the outside-diff finding and both nitpicks are handled too.

  • Outside-diff daemon-terminal-admission.ts:148: the reattach background marker now carries its emitting incarnation on the existing optional field, matching the sibling handoff path, so a successor's handoff cannot toggle the accepted source's scanners.
  • Nitpick pty-connection-remote-snapshot-source-grid.test.ts: both compared positions now come from findIndex, with the successor index asserted non-negative, so the ordering check can no longer pass vacuously when frames coalesce.
  • Nitpick pane-foreground-agent-tracker.ts:263-268: no change, with the reasoning in the thread - resetForPtyReplacement has a single caller that synchronously deletes the pane entry holding the retained capability 24 lines later, and an existing test pins that a replacement deliberately does not settle the predecessor read.
  • One further consistency fix was folded in: the unconfirmed SSH exit branch now also preserves the pane-keyed retired-evidence fence, matching the restore-seed fence next to it, so a recoverable relay loss cannot re-project the replaced process's retained row onto a successor whose liveness is unverifiable.

Verification on the pushed commit: broad src/main src/shared green (4126 files, 41907 passed) with only pre-existing flakes, each reproduced at an unmodified-HEAD control; targeted runtime/daemon/ipc/shared plus renderer suites green; node and web types, format, lint, changed-code quality (0 new findings), wire-skew and a fresh e2e build pass; the restored full-identity paired E2E passes twice. Every fix has a control log showing the regression failing without it.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the delta since the prior review (c908516 → a1d8a1c), which addresses the reviewer findings on the replaced-terminal identity fix.

  • Observed id-less source tracking — BackgroundTransientFactRelay.sourceIncarnations is now Map<string, string | undefined> with a has()-guarded stale-exit check, so a delayed predecessor exit can no longer dispose an id-less successor's tracker (daemon-background-transient-facts.ts).
  • Refusal as a first-class route — resolvePtyObservationRoute returns live / capsule / refused, and all four call sites (emitDaemonPtyTransientFact, notePtyDataGap, setPtyTransientFactDelegation, onPtyData) now drop a capacity-rejected source's evidence source-locally instead of folding it into accepted state (orca-runtime-pty-observation-routing.ts).
  • Fence preservation across relay loss — disposePtyObservationState honours preserveRestoreSeedFence / preserveRetiredPaneEvidence, and the unconfirmed-SSH-exit branch keeps both fences through the reconnect grace (orca-runtime-pty-observation-admission.ts, orca-runtime-on-pty-exit.ts).
  • Observation-keyed retired rows — RetiredPaneEvidence matches on the row's own authorityId + revision (the per-authority monotonic counter), with the timestamp composite kept only as the fallback for rows main never stamped (runtime-retired-pane-evidence.ts).
  • Prune releases retired evidence — dropDisconnectedPtyRecord now runs the same disposal, releasing the pane-keyed retired-evidence record instead of accumulating it (runtime-pty-replacement-durable-retirement.ts).
  • Reattach marker provenance + replay fence — the reattach sessionBackgroundMarker carries incarnationId, and isCurrentPayload re-checks remotePtyIncarnationId after every awaited write so a mid-write rebind can't paint the predecessor's remaining bytes onto the successor (daemon-terminal-admission.ts, replay-data-drain.ts).

The refactors are behaviour-preserving outside the addressed defects; each is pinned by a red-without-the-fix regression (delayed exit, refused fact/marker/gap, SSH-exit fence survival, same-millisecond successor row, prune release, mid-write rebind).

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

Conflict resolution keeps both sides in the mobile session projection contract
and the prune host, and adapts the replacement path to the single hook-row
store:

- `resetTrackedTerminalStateForProviderGeneration` now owns the pane's hook-row
  reconcile (upstream's replacement for the deleted retained row store), and
  takes `preserveResumeIdentity` so a proven replacement keeps the retired row's
  resume remnant; the admission branches that prove the replacement pass it.
- `retireReplacedPtyDurableIdentity` no longer reconciles a second time; it
  records the fenced evidence the remnant left, as the projection expects.
- upstream's new `runtime-mobile-agent-status-builder.test.ts` host gains the
  required `getRetiredPaneEvidence`.

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 07547f82-4b4a-4c02-ba59-735e4a1b61b1

📥 Commits

Reviewing files that changed from the base of the PR and between a1d8a1c and a98edfd.

📒 Files selected for processing (18)
  • src/main/runtime/orca-runtime-apply-tracked-pty-title.ts
  • src/main/runtime/orca-runtime-build-pty-terminal-summary.ts
  • src/main/runtime/orca-runtime-on-pty-data.ts
  • src/main/runtime/orca-runtime-on-pty-exit.ts
  • src/main/runtime/orca-runtime-prune-mobile-session-tab-group-layout.ts
  • src/main/runtime/orca-runtime-pty-observation-admission.ts
  • src/main/runtime/orca-runtime-refresh-floating-workspace-pty-liveness.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/relay/relay-control-client-options.ts
  • src/main/runtime/relay/relay-control-protocol.ts
  • src/main/runtime/relay/relay-origin-pool.ts
  • src/main/runtime/runtime-mobile-agent-status-builder.test.ts
  • src/main/runtime/runtime-mobile-agent-status-builder.ts
  • src/main/runtime/runtime-mobile-session-projection-contract.ts
  • src/main/runtime/runtime-mobile-session-projection.ts
  • src/main/runtime/runtime-pty-replacement-durable-retirement.ts
  • src/main/startup/main-process-runtime-service.ts
  • tests/e2e/relay-region-compatibility.unit.test.ts

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

Comment on lines +39 to +40
const observationRoute = this.resolvePtyObservationRoute(ptyId, incarnationId)
if (observationRoute.kind !== 'live') {

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 | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C6 \
  'admittedPtyObservationSourceByPtyId\.(set|delete)|noteAdmittedPtyObservationSource|persistedIncarnationId|readKnownPredecessorPaneIncarnationForPty' \
  src/main/runtime

rg -n -C8 \
  'cold|restore|early.*title|persisted.*incarnation|observation.*admission' \
  src/main/runtime/orca-runtime-tests/pty-observation-admission.spec.ts

Repository: stablyai/orca

Length of output: 36460


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- on-pty-data ---'
cat -n src/main/runtime/orca-runtime-on-pty-data.ts | sed -n '1,120p'

printf '%s\n' '--- observation admission ---'
cat -n src/main/runtime/orca-runtime-pty-observation-admission.ts | sed -n '1,225p'

printf '%s\n' '--- relevant tests ---'
cat -n src/main/runtime/orca-runtime-tests/pty-observation-admission.spec.ts | sed -n '80,220p'
cat -n src/main/runtime/orca-runtime-tests/pty-observation-admission.spec.ts | sed -n '480,535p'
cat -n src/main/runtime/orca-runtime-tests/pty-observation-admission.spec.ts | sed -n '595,705p'

Repository: stablyai/orca

Length of output: 33268


🤖 get_repo_knowledge executed:

get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings

Length of output: 17443


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- route and candidate bindings ---'
rg -n -C12 \
  'resolvePtyObservationRoute|canSeedAdmittedPtyObservationSource|ptyObservationCapsulesByPtyId|observePtyAutomaticData|pendingPtyObservationAdmission' \
  src/main/runtime/orca-runtime-pty-observation-admission.ts \
  src/main/runtime/orca-runtime-on-pty-data.ts \
  src/main/runtime/runtime-pty-observation-capsule.ts \
  src/main/runtime/runtime-pty-observation-state.ts \
  src/main/runtime

printf '%s\n' '--- cold replacement and early observation tests ---'
rg -n -C12 \
  'cold|relaunch|successor|persistedIncarnationId|early.*(title|status|cwd)|CWD|cwd' \
  src/main/runtime/orca-runtime-tests/pty-observation-admission.spec.ts

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- observation routing ---'
cat -n src/main/runtime/orca-runtime-pty-observation-routing.ts | sed -n '52,190p'

printf '%s\n' '--- capsule observation helpers ---'
cat -n src/main/runtime/orca-runtime-pty-observation-routing.ts | sed -n '190,330p'

printf '%s\n' '--- cold and successor tests ---'
rg -n -C8 \
  'cold|relaunch|successor|early.*(title|status|cwd)|persistedIncarnationId' \
  src/main/runtime/orca-runtime-tests/pty-observation-admission.spec.ts | head -n 240

Repository: stablyai/orca

Length of output: 13070


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- admission reset path ---'
cat -n src/main/runtime/orca-runtime-pty-observation-admission.ts | sed -n '223,278p'

printf '%s\n' '--- reset implementation and state fields ---'
rg -n -C18 \
  'resetTrackedTerminalStateForProviderGeneration|recordOsc7MetadataForPty|processAgentStatusOscForPty|lastOscTitle|lastAgentStatus|cwd' \
  src/main/runtime/orca-runtime-*.ts src/main/runtime/runtime-*.ts | head -n 320

Repository: stablyai/orca

Length of output: 31766


🏁 Script executed:

#!/bin/bash
set -euo pipefail

match=$(rg -l 'resetTrackedTerminalStateForProviderGeneration' src/main/runtime --glob '*.ts' | head -n 1)
printf '--- definition file: %s ---\n' "$match"
rg -n -C20 'resetTrackedTerminalStateForProviderGeneration' "$match"

Repository: stablyai/orca

Length of output: 288


🏁 Script executed:

#!/bin/bash
set -euo pipefail

match=$(rg -l 'resetTrackedTerminalStateForProviderGeneration' src/main/runtime --glob '*.ts' | head -n 1)
echo "--- definition file: $match ---"
rg -n -C20 'resetTrackedTerminalStateForProviderGeneration' "$match"

Repository: stablyai/orca

Length of output: 3217


🏁 Script executed:

#!/bin/bash
set -euo pipefail

while IFS= read -r match; do
  case "$match" in
    *.test.ts|*.spec.ts) continue ;;
  esac
  echo "--- definition file: $match ---"
  rg -n -C24 'resetTrackedTerminalStateForProviderGeneration' "$match"
  break
done < <(rg -l 'resetTrackedTerminalStateForProviderGeneration' src/main/runtime --glob '*.ts')

Repository: stablyai/orca

Length of output: 250


Preserve early successor observations during cold replacement.

When no source exists in admittedPtyObservationSourceByPtyId, resolvePtyObservationRoute returns live for the tagged successor. The successor then updates live title, status, and CWD state. Later, acceptPtyObservationAdmission detects the persisted predecessor, resets that state, and has no capsule to restore. Seed the predecessor before stream ingestion, or route tagged data into a capsule until admission resolves.

Comment on lines +21 to +24
const existingToken = this.pendingPtyObservationAdmissionTokensByPtyId.get(ptyId)
if (existingToken) {
// Concurrent spawns for one pane share the audited candidate budget rather than doubling it.
return existingToken

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 | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline src/main/runtime/orca-runtime-pty-observation-admission.ts \
  --match 'beginPtyObservationAdmission|transferPtyObservationAdmission|cancelPtyObservationAdmission|acceptPtyObservationAdmission' \
  --view expanded

rg -n -C8 \
  '\b(begin|transfer|cancel|prepare|accept)PtyObservationAdmission\s*\(' \
  src/main

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- admission implementation ---'
sed -n '15,180p' src/main/runtime/orca-runtime-pty-observation-admission.ts

printf '%s\n' '--- production callers, excluding tests ---'
rg -n -g '!*.test.ts' -g '!*.spec.ts' -C6 \
  '\b(beginPtyObservationAdmission|transferPtyObservationAdmission|cancelPtyObservationAdmission|preparePtyObservationAdmission|acceptPtyObservationAdmission)\s*\(' \
  src/main

Repository: stablyai/orca

Length of output: 15728


🤖 get_repo_knowledge executed:

get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings

Length of output: 41093


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- admission token references outside tests ---'
rg -n -g '!*.test.ts' -g '!*.spec.ts' -C5 \
  'observationAdmissionToken|commitRuntimePtySpawn|beginPtyObservationAdmission|cancelPtyObservationAdmission|preparePtyObservationAdmission|transferPtyObservationAdmission' \
  src/main

printf '%s\n' '--- spawn wrapper candidates ---'
rg -n -g '!*.test.ts' -g '!*.spec.ts' -C4 \
  'spawn.*pty|pty.*spawn|spawnRuntime|commit.*Spawn|registration lifetime|non-destructive cancellation' \
  src/main/ipc src/main/runtime

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- pane spawn reservation implementation ---'
sed -n '1,240p' src/main/ipc/pty/pane/spawn-reservation.ts

printf '%s\n' '--- runtime spawn orchestration ---'
sed -n '1,135p' src/main/ipc/pty/runtime/spawn.ts
sed -n '1,125p' src/main/ipc/pty/ipc/spawn-run.ts

printf '%s\n' '--- reservation call sites ---'
rg -n -g '!*.test.ts' -g '!*.spec.ts' -C7 \
  'reservePaneSpawn|resolvePaneSpawnReservation|paneSpawnReservation|releaseWorktreeSpawn' \
  src/main/ipc/pty

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- runtime execution admission timing ---'
sed -n '1,115p' src/main/ipc/pty/runtime/spawn-execute.ts
sed -n '175,255p' src/main/ipc/pty/runtime/spawn-options.ts

printf '%s\n' '--- IPC execution admission timing ---'
sed -n '1,125p' src/main/ipc/pty/ipc/spawn-begin.ts
sed -n '1,115p' src/main/ipc/pty/ipc/spawn-execute.ts

printf '%s\n' '--- runtime spawn identity inputs ---'
sed -n '40,125p' src/main/ipc/pty/runtime/spawn-state.ts

Repository: stablyai/orca

Length of output: 21242


Give each spawn lifetime independent admission ownership.

When IPC spawns omit a valid pane key, they skip pane reservation but still derive the same effective PTY ID and call beginPtyObservationAdmission. The shared token lets one failed spawn cancel the admission and candidate capsules needed by another spawn. The surviving spawn then prepares no admission, so acceptPtyObservationAdmission skips replacement retirement and promotion.

Use caller leases or reference-count the shared token. Otherwise serialize all spawn paths before admission.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Re-reviewed the delta since the prior Pullfrog review — commit a98edfd, a merge of upstream main into the branch. The conflict resolutions adapt the terminal-identity work to upstream's deleted retained-row store without changing the PR's semantics.

  • Hook-row reconcile moves onto the generation reset — resetTrackedTerminalStateForProviderGeneration now takes preserveResumeIdentity and forwards it to reconcileAgentStatusForEndedProcess. Both replacement branches (acceptPtyObservationAdmission, admitRegisteredPtyObservationSource) pass true; the non-replacement path keeps upstream's exact call.
  • Retirement no longer reconciles twice — retireReplacedPtyDurableIdentity drops its own reconcile and only records the fenced evidence. That still reads the predecessor remnant because promotion writes no hook-store row (emitTerminalAgentStatusEvents fans out renderer events and records prompt lifecycle only).
  • Mobile projection adaptation — upstream's extraction of runtime-mobile-agent-status-builder.ts and its new getStatusSnapshot/getLiveBrowserTabs contract keep the PR's getRetiredPaneEvidence + excludeRetiredPaneEvidenceRows filter in both the projection's getHookRowsForPane and the builder.
  • Coverage updated — the upstream runtime-mobile-agent-status-builder.test.ts host gains getRetiredPaneEvidence; no other test changes were needed. Remaining range-diff entries (relay-control files, relay-region-compat test) are upstream formatting only.

The two invariants the PR established are intact: reconciliation with preserveResumeIdentity on a proven replacement, and retired evidence fenced by row instance. Targeted suites pass locally (62 tests across replacement identity, retired evidence, observation admission, hook projection, pty-exit reconciliation and the mobile builder).

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

Main now rejects unannotated `as` casts on changed lines. Give the
replaced-identity code's test doubles and two-phase placeholders a
SAFETY rationale, and drop the casts that bracket access or a
discriminated flatMap make unnecessary.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Re-reviewed the delta since the prior pullfrog review (a98edfd → 45ccca6): two merge integrations plus a test-only lint commit. The identity work survives the re-base intact.

  • Re-based onto a much newer upstream main (via PR 1's advanced branch) — the branch now sits on upstream's stream-queue accounting (accountDaemonStreamEntry / releaseDaemonStreamEntry, the per-session metadata budget) and on the moved DaemonPtyRouterDataEvent type. Source-scoped coalescing still keys on last.incarnationId === options.incarnationId, the dataGap merge still keys on payload.incarnationId, every encodeStreamDataEvent / writeStreamDataEvents path still threads the optional incarnationId, and daemon-server.ts keeps entry.incarnationId on flush.
  • Listener payload types relocated — the optional incarnationId that used to be added on daemon-pty-event-subscriptions.ts and daemon-pty-runtime-state.ts now lives on the shared DaemonPtyRouterDataEvent in daemon-pty-router-events.ts; both consumers reference it.
  • Test-double and placeholder casts annotated — 45ccca6 adds SAFETY: rationales to the replaced-identity test doubles, drops the casts that bracket access or a discriminated flatMap make unnecessary, and leaves the two-phase capsule/entry placeholders with a justification comment. Source files received comments only.

Verification: 49 targeted tests pass (daemon stream source incarnation, adapter source incarnation, replacement identity retirement, retired evidence, observation admission, pane-keyed reaper ratchet) and pnpm tc:node is clean. Durable identity retirement, retired-row evidence matching and the renderer replacement path are unchanged.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker

nwparker commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded — the linked issue (#18464) has been resolved on main by #26308 (f616b7d97a), #29261 (38ac75b9c1). Thanks for the contribution!

@nwparker nwparker closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Blank terminal pane in a remote Orca client

2 participants