Skip to content

fix(native-chat): read SSH transcripts on their owning host - #15515

Closed
brennanb2025 wants to merge 13 commits into
mainfrom
brennanb2025/native-chat-transcript-reader-host-seam
Closed

brennanb2025 wants to merge 13 commits into
mainfrom
brennanb2025/native-chat-transcript-reader-host-seam

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 22 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1557 $\color{#cf222e}{\Huge{\mathbf{−}}}$​259 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1298
Prod 45 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1540 $\color{#cf222e}{\Huge{\mathbf{−}}}$​362 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1178

ELI5

Orca knew an agent terminal lived on an SSH machine, but native chat could still open the transcript path on the desktop. If the desktop happened to have a file at the same path, Orca could show the wrong conversation.

This PR makes the runtime ask its authenticated agent-hook records which host and path own the transcript. Local and WSL transcripts stay local; SSH transcripts are read through that exact SSH connection. If Orca cannot prove the owner, it reports the transcript as unverifiable instead of guessing.

What Changed

  • Native-chat read and subscribe requests carry the optional paneKey already known by desktop, web, and mobile clients.
  • Main/runtime resolves paneKey + agent + sessionId against the authenticated AgentHookServer row and uses that row's connectionId + transcriptPath as authority. Caller-supplied paths are not trusted for a matched pane.
  • Local and wsl:* owners retain the existing local/UNC path handling. SSH owners route through the registered SSH filesystem provider.
  • SSH snapshots and live appends use bounded positional reads (maximum 256 KiB per request) instead of whole-file polling.
  • Provider generation, device/inode, size, version, and old-EOF fingerprint checks prevent reconnects, replacement, shrinkage, or same-inode rewrites from publishing mixed transcript generations while allowing stable-prefix appends.
  • Watch retries survive provider loss, replacement, subscriber callback errors, and remote missing/unverifiable states without falling back to desktop reads.
  • Source keys include the pane identity so changing owners invalidates stale live-chat state.
  • Locator-free legacy calls retain their previous host-local behavior.

Why This Boundary

The authenticated hook server already owns both facts needed for routing: the pane/session association and the execution connection. Resolving there is smaller and safer than copying caller-asserted host metadata through generic provider-session, resume, persistence, renderer, preload, mobile, and RPC models.

The resulting authority chain is:

paneKey + sessionId → authenticated hook row → connectionId + transcriptPath → local/WSL/SSH reader

Reproduction

On main, an isolated Orca app connected to a throwaway Linux Docker SSH/relay target. The SSH host and desktop were given the same session id and exact transcript path but different bytes. Native chat rendered the desktop poison transcript for both an SSH Git worktree and an SSH folder workspace.

With this PR, the initial snapshot and a later remote-only append come from the SSH file, while the desktop lookalike remains present and is never rendered.

Linked Issue

Fixes #13663

Visual Proof

SSH Git worktree

Before — main selected the desktop lookalike:

02-wrong-local-transcript.png

After — the real remote snapshot rendered and a remote-only append appeared live:

05-final-git-worktree-live-tail.png

SSH folder workspace

Before — main selected the desktop lookalike:

03-folder-wrong-local-transcript.png

After — the real remote snapshot rendered and a remote-only append appeared live:

04-final-folder-live-tail.png

Testing

  • Broad affected root unit/integration suites: 51 files, 497 tests passed.
  • Registered ownership reliability slice: 23 files, 316 tests passed (overlaps the broad suite).
  • Focused mobile suites: 2 files, 30 tests passed.
  • tests/e2e/headless-native-chat-runtime-routing.spec.ts: 1 passed.
  • Root typecheck: passed.
  • Changed-code native/type-aware/React Doctor checks: no new findings.
  • Reliability manifest and max-lines ratchet: passed.
  • git diff --check: passed.
  • Earlier headed macOS + real Linux Docker SSH/relay validation covered both Git-worktree and folder-workspace snapshots and live appends.

Review and Tradeoffs

The branch is intentionally end-to-end because ownership must remain intact across desktop, paired web/mobile, runtime RPC, authenticated hook state, initial reads, live subscriptions, reconnects, and both worktree and folder workspaces. About half of the net diff is tests and reliability-gate registration.

The main downside is additional SSH-specific range-read and recovery code. It adds remote stat/range traffic and retry state, though reads are bounded and live appends advance a cursor rather than rereading the prefix. A stable-prefix append can complete the snapshot, while a rewrite racing it invalidates and retries; very large unread live backlogs switch to a bounded tail replacement instead of retaining the whole backlog in main-process memory.

A new client paired to an old runtime cannot make that old runtime execute this new authority lookup: the old schema strips paneKey and keeps its prior local behavior. This is a valid mixed-version P2 residual, not a regression introduced by this PR. Globally disabling native chat on old runtimes would also regress valid local sessions, so capability negotiation is left as a follow-up.

No physical Windows SSH journey was run. Windows packaging, WSL boundary tests, macOS/Linux SSH validation, and cross-version CI cover the implementation contract.

  • I manually tested these changes locally
  • Automated tests added/updated
  • This PR is focused on one execution-boundary bug
  • Cross-platform, SSH/remote, folder-workspace, and mixed-version behavior considered

AI Disclosure

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

@coderabbitai

coderabbitai Bot commented Aug 19, 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
📝 Walkthrough

Walkthrough

Adds provider-session ownership metadata and propagates it through native chat APIs, mobile sessions, renderer state, and runtime resume flows. Native chat transcript reads and subscriptions now resolve local, SSH, legacy, and unknown ownership. SSH transcripts use generation-pinned ranged filesystem access with bounded reads and stability checks. Unresolved and unverifiable transcript states remain advisory while polling continues. Tests cover routing, provider replacement, error precedence, callback failures, cleanup, and end-to-end ownership behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.48% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 83 functions across 58 files. (1 skipped: 1 unsupported.) Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation addresses issue #13663 by routing SSH transcript snapshots and live reads through the owning remote filesystem provider.
Out of Scope Changes check ✅ Passed The changes remain focused on host-aware transcript ownership, transport propagation, compatibility, reliability, and related regression coverage.
Title check ✅ Passed The title clearly and concisely summarizes the primary change: routing SSH native-chat transcript reads to their owning host.
Description check ✅ Passed The description covers the required sections, issue, testing, visual proof, compatibility, and review considerations with sufficient detail.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • 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: 2

🧹 Nitpick comments (1)
src/main/native-chat/transcript-watch.ts (1)

52-58: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Shorten the new rationale comments.

Keep the non-obvious reason, but reduce these comments to brief statements.

  • src/main/native-chat/transcript-watch.ts#L52-L58: Use one concise comment for the delayed advisory rationale.
  • src/main/native-chat/transcript-watch-unresolved-notice.test.ts#L47-L50: Use one concise comment for the non-terminal recovery rationale.

As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 34a00b18-eec4-460c-8a7f-613d11f01727

📥 Commits

Reviewing files that changed from the base of the PR and between 73f7767 and cb4325d.

📒 Files selected for processing (3)
  • src/main/native-chat/transcript-watch-contract.ts
  • src/main/native-chat/transcript-watch-unresolved-notice.test.ts
  • src/main/native-chat/transcript-watch.ts

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/main/native-chat/transcript-watch.ts (1)

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

Shorten the new explanatory comments.

Use one concise rationale sentence per comment block. The current comments restate control flow and implementation details.

As per coding guidelines, “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”

Also applies to: 93-115

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fcd0a76b-4c25-4806-95a0-6460a2d97fc0

📥 Commits

Reviewing files that changed from the base of the PR and between cb4325d and af48f0b.

📒 Files selected for processing (5)
  • src/main/native-chat/transcript-watch-resolve-poll.test.ts
  • src/main/native-chat/transcript-watch-unresolved-notice.test.ts
  • src/main/native-chat/transcript-watch.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.test.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.ts

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status

Scope check first: this PR does not fix #13663. An agent in an SSH worktree still cannot load
its transcript — the file is on the remote host and nothing here reads it. This only stops the
surface from lying while that work lands separately. Judge it on that, not as a fix.

Review loop — 3 independent rounds, converged

Round Result
1 7 defects found and fixed
2 1 further defect found and fixed
3 CLEAN, no changes needed

Defects found (all fixed, each with red-proof against the pre-fix source):

  1. The advisory erased already-rendered history. baseMessages is EMPTY_MESSAGES for any
    non-ready phase, so the error frame blanked content the seed read had already painted.
    Reachable when resolve succeeds but wslGatedStat keeps failing. Regression introduced by the
    first revision of this PR.
  2. A throwing subscriber permanently killed the poll loop — the emit ran outside the try/catch
    and before scheduleAttempt().
  3. …and the fix for (2) was partial. A later round found the sibling WSL-gate emit inside
    runAttempt's catch was left bare, and that one was strictly worse: it both leaked an unhandled
    rejection and skipped the reschedule. Both now route through one emitAdvisory helper.
  4. Two racing 60s deadlines. Modelled from the real backoff, the seed's terminal error lands at
    ~65s and this advisory at ~62.5s — so the generic copy was overwriting the new one. The
    renderer now defers to the stream, which owns recovery.
  5. A shared latch meant the generic notice could permanently suppress the actionable WSL-gate
    message. Split.
  6. The message asserted a cause the code never established (also covers a cold WSL distro or a
    slow first flush). Rewritten to claim only what the deadline proves.
  7. A self-contradictory comment — claimed 60s exceeded the [Bug]: Native chat "No transcript found" on a just-created session that is actually alive #8401 worst case, 8 lines below a
    comment saying that flush can take minutes.
  8. Test defects, including one vacuous assertion: the "exactly one advisory" check passed with
    the latch removed. Also a 2/12 concurrent flake (writeFile racing the poll with a zero-byte
    file) — now published via rename; 12/12 concurrent since.

Every guard was mutation-tested — 8 mutations, all red. No vacuous tests remain.

Correction to the original description

It claimed desktop "spins forever". It doesn't — desktop was already bounded at ~60s by the
seed's notFound window. The unbounded spinner is mobile/web/headless, which only subscribe.
On desktop this replaces vague copy with accurate copy and removes the race above. The body has
been corrected.

Readiness

Opening pass: READY WITH FIXES. Closing pass after review: READY TO MERGE. All opening findings
resolved except two accepted NITs — the deadline is wall-clock so a >60s laptop sleep fires the
advisory immediately on wake (self-heals), and nothing logs when it fires.

CI: 46 checks, all green.

Manual validation

Validated over a real SSH relay (throwaway Docker target, real relay, real claude in a real SSH
worktree, remote transcript present, desktop slug absent):

build nativeChat.subscribe on the SSH session
main 0 frames in 45s, silent
this PR 1 frame at 64.7s — snapshot, 0 messages, advisory error

Local control on the same build: real snapshot, 4 messages, 1.0s, no error.

⚠️ That run was against cb4325d598, the first commit. Head is now af48f0b900 after two
rounds of fixes; those are covered by unit + mutation testing but the end-to-end SSH proof has not
been re-run against current head. A re-run is in progress and I will post the screenshot here.

Follow-ups (not blocking)

  • A third sibling of the same bare-emit defect exists at transcript-watch-engine.ts:267-277
    (drain()'s inner catch, with scheduleRotationRetry() after it). Pre-existing, in neither diff,
    degrades rather than wedges — but worth a ticket given this area's history of sibling call sites.
  • Mobile never calls setError(undefined) on recovery, so a stale error string lingers behind
    status:'ready'. Pre-existing.
  • The advisory renders under a red destructive "Could not load conversation" card, which is heavy
    for a state the code deliberately treats as non-terminal.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Manual QA: real SSH relay (issue #13663 / PR #15515)

Isolated Orca dev instance (ORCA_DEV_INSTANCE_KEY=grokqa, CDP 9377) on worktree brennanb2025/grokqa-15515. Identity:

devBranch: brennanb2025/grokqa-15515
devRepoRoot: /Users/brennanbenson/orca/workspaces/orca/grokqa-15515
isDev: true

Throwaway Linux Docker SSH target (127.0.0.1:2455, linux relay). Claude ran in remote worktree /work/demo-project-grokqawt and answered in the TUI (Hi there, friend!). Native chat was opened from the real Show chat view control.

UI proof

After the ~60s unresolved-notice deadline the transcript area showed an honest advisory instead of an endless spinner:

ssh-native-chat-advisory.png

Visible copy:

  • Could not load conversation
  • No transcript found for this session on this machine. If the agent runs on a remote host its transcript lives there; otherwise it may not have been written yet.

SSH arm — window.api.nativeChat.subscribe

subscriptionId: grokqa-ssh-1
agent: claude
sessionId: a57cc132-bd76-4330-b8e1-3836b543e2f8
transcriptPath: /root/.claude/projects/-work-demo-project-grokqawt/a57cc132-bd76-4330-b8e1-3836b543e2f8.jsonl

First frame: 60749 ms

{
  "type": "snapshot",
  "error": "No transcript found for this session on this machine. If the agent runs on a remote host its transcript lives there; otherwise it may not have been written yet.",
  "messageCount": 0,
  "hasMore": false
}

One non-terminal advisory snapshot. Not an endless hang.

Local control arm

Same subscribe API against a desktop session under ~/.claude/projects/-Users-brennanbenson-orca-demo-project:

sessionId: 928d1fa1-0f53-4a07-8d5f-3cb7c1871096
transcriptPath: /Users/brennanbenson/.claude/projects/-Users-brennanbenson-orca-demo-project/928d1fa1-0f53-4a07-8d5f-3cb7c1871096.jsonl

First frame: 46 ms

{
  "type": "snapshot",
  "error": null,
  "messageCount": 4,
  "hasMore": false
}

Healthy local sessions are unaffected.

Transcript host split

Host Path / slug Result
Remote container /root/.claude/projects/-work-demo-project-grokqawt/a57cc132-bd76-4330-b8e1-3836b543e2f8.jsonl present
Desktop ~/.claude/projects/-work-demo-project-grokqawt absent

This is the #13663 split: the agent wrote on the remote host, the desktop resolved nothing, and the subscribe path now emits one advisory instead of spinning forever.

@brennanb2025
brennanb2025 force-pushed the brennanb2025/native-chat-transcript-reader-host-seam branch from af48f0b to f9e9a9b Compare August 20, 2026 07:10
@Jinwoo-H
Jinwoo-H force-pushed the brennanb2025/native-chat-transcript-reader-host-seam branch from f9e9a9b to b757d18 Compare August 21, 2026 08:58
@coderabbitai

coderabbitai Bot commented Aug 21, 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.

@Jinwoo-H Jinwoo-H changed the title fix(native-chat): say when a transcript is unreadable on this host instead of spinning fix(native-chat): read SSH transcripts on their owning host Aug 21, 2026

@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

🧹 Nitpick comments (2)
src/main/providers/ssh-filesystem-dispatch.test.ts (1)

73-99: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Move test cleanup into a finally block.

The states declaration appears once. If an assertion fails, unsubscribe() and unregisterSshFilesystemProvider('generation-conn') do not run, leaving the module-global listener registered for later tests.

src/renderer/src/components/native-chat/use-native-chat-live-session.ts (1)

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

Shorten the added comments.

These comments explain local control flow across multiple lines. Replace each with one concise reason.

As per coding guidelines: “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”

Proposed change
-    // Why: this hook's notFound window and the main-side unresolved notice both
-    // expire at ~60s on the same transcript; the stream owns recovery, so its
-    // message wins regardless of which lands last.
+    // Prefer the stream error over concurrent seed-read errors.
...
-            // Why: nor may it trade already-read history for an error card (mobile
-            // keeps its retained transcript for the same reason).
+            // Retain existing transcript history after a stream error.

Also applies to: 217-218

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6e7516b8-c7b5-4e9c-bbb2-79669f99e618

📥 Commits

Reviewing files that changed from the base of the PR and between 59892a2 and b757d18.

📒 Files selected for processing (62)
  • config/reliability-gates.jsonc
  • mobile/src/session/mobile-native-chat-eligibility.test.ts
  • mobile/src/session/mobile-native-chat-eligibility.ts
  • mobile/src/session/use-mobile-native-chat-controller.ts
  • mobile/src/session/use-mobile-native-chat-session.test.ts
  • mobile/src/session/use-mobile-native-chat-session.ts
  • src/main/agent-hooks/server-hook-http-ingest.test.ts
  • src/main/agent-hooks/server-ingest-terminal-status.test.ts
  • src/main/agent-hooks/server-last-status-hydrate-validation.test.ts
  • src/main/agent-hooks/server.ts
  • src/main/ipc/native-chat.test.ts
  • src/main/ipc/native-chat.ts
  • src/main/native-chat/native-chat-transcript-owner.ts
  • src/main/native-chat/session-file-resolver.ts
  • src/main/native-chat/ssh-transcript-host-routing.test.ts
  • src/main/native-chat/ssh-transcript-range-fs.ts
  • src/main/native-chat/ssh-transcript-read.ts
  • src/main/native-chat/ssh-transcript-subscription.ts
  • src/main/native-chat/transcript-file-version.ts
  • src/main/native-chat/transcript-host-verdict.ts
  • src/main/native-chat/transcript-incremental-reader.ts
  • src/main/native-chat/transcript-native-watcher.ts
  • src/main/native-chat/transcript-range-fs.ts
  • src/main/native-chat/transcript-tail-boundary.ts
  • src/main/native-chat/transcript-tail-reader.ts
  • src/main/native-chat/transcript-watch-contract.ts
  • src/main/native-chat/transcript-watch-engine.ts
  • src/main/native-chat/transcript-watch-read.ts
  • src/main/native-chat/transcript-watch-resolve-poll.test.ts
  • src/main/native-chat/transcript-watch-unresolved-notice.test.ts
  • src/main/native-chat/transcript-watch-wsl-exact-path.test.ts
  • src/main/native-chat/transcript-watch.ts
  • src/main/providers/ssh-filesystem-dispatch.test.ts
  • src/main/providers/ssh-filesystem-dispatch.ts
  • src/main/runtime/rpc/methods/native-chat-rpc-schema.ts
  • src/main/runtime/rpc/methods/native-chat.test.ts
  • src/main/runtime/rpc/methods/native-chat.ts
  • src/preload/api/native-chat-api.ts
  • src/preload/index.ts
  • src/renderer/src/components/native-chat/NativeChatSessionGate.tsx
  • src/renderer/src/components/native-chat/NativeChatView.tsx
  • src/renderer/src/components/native-chat/native-chat-live-session-types.ts
  • src/renderer/src/components/native-chat/native-chat-live-source-key.ts
  • src/renderer/src/components/native-chat/native-chat-pane-resolution.test.ts
  • src/renderer/src/components/native-chat/native-chat-pane-resolution.ts
  • src/renderer/src/components/native-chat/native-chat-runtime-contract.ts
  • src/renderer/src/components/native-chat/native-chat-session-transport.test.ts
  • src/renderer/src/components/native-chat/native-chat-session-transport.ts
  • src/renderer/src/components/native-chat/native-chat-subscription-identity.ts
  • src/renderer/src/components/native-chat/native-chat-view-types.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.test.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.ts
  • src/renderer/src/components/native-chat/use-native-chat-provider-session-locator.ts
  • src/renderer/src/components/native-chat/use-native-chat-retained-session.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-host-session-launch.test.ts
  • src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.ts
  • src/renderer/src/runtime/web-runtime-session-terminal-host-authority.test.ts
  • src/renderer/src/runtime/web-runtime-session.ts
  • src/shared/agent-session-resume.test.ts
  • src/shared/agent-session-resume.ts
  • src/shared/workspace-session-sleeping-agents.ts
  • tests/e2e/headless-native-chat-runtime-routing.spec.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/native-chat/transcript-watch-resolve-poll.test.ts
  • src/main/native-chat/transcript-watch-unresolved-notice.test.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.test.ts

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

Comment thread config/reliability-gates.jsonc Resolved
Comment thread config/reliability-gates.jsonc Resolved
Comment thread src/preload/index.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b57253a-d82f-4493-9b88-71734fe67003

📥 Commits

Reviewing files that changed from the base of the PR and between d417c17 and 2a8c0e4.

📒 Files selected for processing (14)
  • config/reliability-gates.jsonc
  • src/main/agent-hooks/server-ingest-remote.test.ts
  • src/main/agent-hooks/server-last-status-hydrate-validation.test.ts
  • src/main/agent-hooks/server.ts
  • src/main/agent-hooks/wsl-hook-relay-live.integration.test.ts
  • src/main/native-chat/ssh-transcript-host-routing.test.ts
  • src/main/native-chat/ssh-transcript-read.ts
  • src/main/native-chat/transcript-watch-engine.ts
  • src/main/native-chat/transcript-watch-error.test.ts
  • src/main/providers/ssh-filesystem-dispatch.test.ts
  • src/preload/index.ts
  • src/renderer/src/components/native-chat/NativeChatSessionGate.tsx
  • src/renderer/src/components/native-chat/use-native-chat-live-session.ts
  • tests/e2e/headless-native-chat-runtime-routing.spec.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/preload/index.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.ts
  • src/renderer/src/components/native-chat/NativeChatSessionGate.tsx

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

@Jinwoo-H
Jinwoo-H force-pushed the brennanb2025/native-chat-transcript-reader-host-seam branch from a9d77ca to 6e2129d Compare August 21, 2026 20:33
brennanb2025 and others added 13 commits August 23, 2026 06:09
…stead of spinning

An agent running in an SSH worktree writes its transcript on the remote
machine, so the desktop resolves nothing and subscribeNativeChatTranscript
re-polls forever with no frame. The client's loading state only clears on a
stream frame, so the chat view spins indefinitely with no error (#13663).

Emit one advisory snapshot once an unresolved transcript passes a deadline.
It is deliberately non-terminal: the resolve poll keeps running and a later
real snapshot replaces it, so a session that is merely slow to flush its
first JSONL line still loads (#8401). The deadline is generous for the same
reason -- a late message costs less than a false one on a healthy session.

This lands in the shared subscribe path, so desktop, mobile, web and headless
all get it without a wire change; clients already render an error carried on
the snapshot frame.
…non-destructive

Review follow-ups on the #13663 notice:

- Split the advisory latch from the WSL gate latch. They shared one boolean, so
  a distro that stalled after the deadline had its actionable retry message
  silenced by the generic notice.
- Never trade already-read history for an error card: an error frame carries no
  transcript, so the desktop keeps a non-empty ready list (mobile already
  retains its transcript for the same reason).
- Let the stream's error outrank the seed's notFound miss. Both deadlines expire
  at ~60s on the same transcript, so one failure was showing two messages
  depending on which resolved last.
- Schedule the next poll before notifying, and contain a throwing subscriber, so
  an emit on a dying connection can't kill the loop as an unhandled rejection.
- Say only what the deadline establishes: a remote host, a cold WSL distro and a
  slow first flush all land on it. Drops a comment that claimed the deadline
  exceeded the documented worst-case first flush when #8401 says minutes.
- Tests: assert the recovered transcript's content (the old assertion could pass
  on an empty frame), pin the once-only latch across ~10 further ticks, and
  publish test transcripts by rename so a zero-byte file can't race the poll.
…bscriber can't kill the poll

The unresolved-transcript notice was already contained, but its sibling emit in
runAttempt's catch was not: a throw there escaped `void runAttempt()` as an
unhandled rejection and skipped the reschedule below it, stranding the poll for
good. Route both through one emitAdvisory helper.
@Jinwoo-H
Jinwoo-H force-pushed the brennanb2025/native-chat-transcript-reader-host-seam branch from 4ded91c to fa6bf3d Compare August 23, 2026 10:27
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Superseded by #15672, which now carries the server-authoritative routing fix plus restart-durable transcript-owner evidence and mixed-version capability gating.

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]: Native chat never loads for an agent in an SSH worktree (transcript resolved on the desktop, written on the remote host)

2 participants