Skip to content

fix(native-chat): name a chat write by its target, not the owner generation - #22812

Merged
brennanb2025 merged 24 commits into
mainfrom
brennanb2025/chat-writes-by-target
Sep 26, 2026
Merged

brennanb2025 merged 24 commits into
mainfrom
brennanb2025/chat-writes-by-target

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​123 $\color{#cf222e}{\Huge{\mathbf{−}}}$​81 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33 $\color{#cf222e}{\Huge{\mathbf{−}}}$​81 $\color{#cf222e}{\Huge{\mathbf{−}}}$​48

Scope: which chat this affects

  • Structured chat only. This PR changes the experimental structured native chat, which runs the agent through its SDK. It is behind the experimentalStructuredNativeChat setting, which is off by default (src/shared/default-global-settings.ts:137).
  • Default chat view: no change. The default chat view, backed by a terminal and reading the agent's transcript, does not use this code, and nothing about it changes.
  • Terminals: no change. Plain terminals and terminal-backed chats behave exactly as before.

Follows #22783 (merged); this PR targets main.

ELI5

Every chat request carries a note saying which copy of the agent the app last saw. The host refused the request if that copy had since been replaced, even when the request didn't depend on which copy was running. After the agent went idle and came back, a send or a Stop could fail with "Expected runtime fence 1; the session is at 3." The host now ignores that note, because every request already says exactly what it acts on.

What Changed

Before

  • An idle release and the restart after it each moved the session's fence. The release published nothing, so an open chat kept the old number.
  • The next send was refused agent_session_checkpoint_stale with "Expected runtime fence 1; the session is at 3."
  • A Stop queued behind a cold start was refused the same way. That happened even when the pane had seen the release, because only sends were rebased onto the new fence, and only across a single restart.

After

  • Sends, Stops, prompt answers, option changes, thread-goal changes, rewinds and conversation commands are admitted no matter which fence the client sends.
  • The writer-lease check is unchanged: a session with no live owner, one still reconciling, or one mid-start still refuses as before.

The mechanism

  • admitAgentSessionMutation (src/shared/agent-session-mutation-envelope.ts) no longer compares expectedRuntimeFence with the lease. It still checks the fingerprint, then the ledger, then the writer lease.

  • The rebase that covered one restart is deleted:

    • admitAtResumedFence in send preparation;
    • resumedFromFence on the host session and its computation in the attach.

    Session preparation now answers only "refused or not", and no longer returns a rewritten envelope.

  • Kept, deliberately:

    • The attach and reserve compare-and-swap (evaluateAgentSessionAcquisition). It is host-internal, and it is what makes two concurrent attaches safe. agentSession.ensure at an old fence is still refused agent_session_checkpoint_stale with the live fence attached.
    • The terminal PTY write admission was already removed by refactor(native-chat): remove the unused terminal handoff #22783, so nothing of it is left here.
    • What frames carry. Each pane still gets its own fence on every frame, exactly as before.

Why

The fence has no remaining job as a write check. It came with the terminal handoff, to stop a native write landing on a session a terminal had taken over. #22783 removed that handoff. Every write now names its own target, which is what actually protects it:

Write What it targets What protects it
Send Its conversation Its operation id in the ledger
Cancel A turn id Claude checks it against the journal's live turn before interrupting; for Codex, the provider refuses an interrupt for a turn that is not active
Prompt answer An item revision validatePendingPrompt
Rewind An epoch expectedEpoch
Option, thread goal — Last writer wins

Why not rebase more cases instead? admitAtResumedFence was a guard beside the check. It covered a send after exactly one clean restart, and it never covered Stop. Extending it to more hops and more methods would add rules to a check that no longer protects anything, so the check goes instead.

Why frames keep each pane's own fence. This is on purpose. A pane that learned every fence move would treat a failed restart as a reason to resend. A restart refused before it spawns anything still moves the fence and leaves no recorded answer, so each resend tries again and moves the fence again, forever. A start that fails after spawning does not loop, because the ledger replays its answer. The lasting fix belongs with the later accept-then-deliver change: record a failed restart as a rejected message, and stop the client retrying on a fence change.

Differences from the common pattern

  • Writes are admitted by their target, with no owner generation from the client. This matches the usual design, where a command names its thread plus a turn or request id, and admission checks only that the thread exists and can accept the command.
  • Deviation: Orca keeps a durable lease with a fence and a reserve compare-and-swap, and still checks that a live writer owns the lease. The usual design has neither and binds a session only after it starts. That lease is Orca's crash and cross-process safety. This PR does not change it.
  • Known gap, not changed here: a Codex Stop stops the turn's child processes at the same time as it asks the provider to interrupt, so the turn id is checked only after those processes are gone. That predates this PR and belongs with the later Stop rework.

Linked Issue

Part of the native-chat "a chat never gets stuck" series. Follows #22783 (merged); no separate issue.

Visual Proof

Live desktop app, structured Claude chat, idle release forced with a shortened release window. Before = base 713b126feb, after = 31444bf876 (later commits change comments only).

Before After
Send after an idle release before after
Stop after an idle release before after
Restart that fails after an idle release before after

Testing

New tests, in structured-agent-session-send-preparation.test.ts against the real host and store:

  • Delivers a send fenced to the owner an idle release retired. The chat is released, and a send arrives with fence 1 while the session is at 3. The send restarts the agent and is delivered, with one acquire and one dispatch.
  • Admits a Stop and a send queued behind the cold start that replaced their owner. The first send's start is held open. A Stop at the released fence and a second send at the pre-release fence queue behind it. Both are admitted once the start lands, with one acquire and two dispatches.
  • Keeps the pane's fence on the row a failed restart publishes. A pane subscribes at fence 1, the chat is released, and a send's restart is refused before anything spawns. The record moves to fence 4, and every frame the pane gets still carries 1. This pins the trigger of a resend loop that live QA found on an earlier revision of this PR, where frames carried the live fence.

Ablations. Each was run on the committed head and then restored from it.

Arm What was put back Result
The fence check only The base check, without the rebase Both write tests go red with the reported refusal: Expected runtime fence 1; the session is at 3. (the idle-release send), Expected runtime fence 2; the session is at 3. (the first send and the Stop), Expected runtime fence 1; the session is at 3. (the send typed during the start). The existing restart tests go red too, which shows the rebase existed only to cover the check.
Frames stamped with the live fence The earlier revision's subscriber code The failed-restart test goes red: the pane is handed fence: 4, expected 1
The fence check, cross-version suite The check The rewritten cross-version test goes red with agent_session_checkpoint_stale

Rewritten on purpose (each pinned the removed refusal):

  • the envelope unit test, which now admits any fence, including null;
  • two send tests, now one: a stale-fenced send is delivered, and its retry at the refreshed fence replays with one dispatch;
  • the rewind test, which keeps the concurrent-rewind check by epoch;
  • the conversation-command test, where a compact at a stale fence runs;
  • the refusal-oracle test, where checkpoint_stale is now unreachable for send and setOption, and a stale fence is admitted;
  • the cross-version test refuses a write still fenced to the host generation that died, now delivers a write still fenced to the host generation that died. Its reattach helper still pins the attach refusal.
  • docs/reference/remote-wire-compatibility.md: the line describing that cross-version case is updated to match.

Runs

  • src/main/native-chat/agent-session-wire, src/shared/agent-session*, src/shared/structured-agent-session*, src/main/runtime/agent-session*, src/main/runtime/rpc/methods/structured-agent-session*, src/main/runtime/orchestration/structured*, src/renderer/src/components/native-chat and tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts: 374 files, 3663 of 3663 pass.
    • Earlier full runs under heavy machine load (load average about 20) saw three timeouts: the refusal oracle, the lease renewer and one restart-ownership test. Each passes when its file runs on its own.
  • Typecheck: tsc -p config/tsconfig.node.json and pnpm tc:web are clean.
  • Lint: oxlint on the changed files and pnpm run check:code-quality:changed pass.

Manual (live desktop app, structured Claude chat, forced idle release, before 713b126feb vs after 31444bf876):

  • Send after an idle release, chat open: before, "Message was not sent." with "Expected runtime fence 1; the session is at 3."; after, the agent restarts and the message is answered once, with no error.

  • Stop after an idle release: before, the message is refused, so there is nothing to stop; after, Stop clears the turn in about 260 ms and the next message is answered.

  • Restart that fails after an idle release: both builds make one attempt, then show "Message was not sent." with Retry, and the fence stops moving. An earlier revision of this PR that sent the live fence on every frame turned this into an endless resend; that half was removed and this lane re-run.

  • Ordinary chat (send, send, Stop mid-turn, send): identical on both builds.

  • Not run: mobile, paired web and SSH by hand. The host change is the same code on every host, and no client code changed.

  • I manually tested these changes locally

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

AI Disclosure

Built with Claude (Opus 5.5).

Review

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.

Notes

Mixed versions. Clients and hosts update independently, so each pairing was checked:

Client Host What happens
Old New The client still sends a fence, and the envelope schema still requires the field. The host ignores it. checkpoint_stale is no longer returned for a write, so the client's retry-on-stale path never runs. Frames are unchanged: each pane still gets its own fence, so a client's retry-on-fence-change logic sees nothing new.
New Old No client code changed. New clients keep sending the fence from their last frame and keep handling checkpoint_stale, so an old host behaves exactly as today.
  • Remote and SSH: records live in each execution host's own store, and admission runs on that host. Nothing here assumes a local host.
  • Folder workspaces: not affected.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Author X handle: @BrennanKB5

brennanb2025 and others added 17 commits September 24, 2026 23:36
No client ever called agentSession.requestHandoff or mounted the handoff
chrome. Delete the handoff coordinator, the terminal-owner runtime, the
proof write path and the unmounted UI. Keep agentSession.handoffStatus,
which released desktop clients read for worktree activation, and let
records an older build left mid handoff reconcile through the ordinary
restart and recovery paths.
Eviction now drains delivered events before quit's resume-offer snapshot. An
unbounded wait there sits ahead of the provider stop, so a sink whose journal
write stalls kept the child running until the step deadline aborted the
eviction. The offer is advisory: bound the drain and stop the child regardless.

Co-Authored-By: Claude <[email protected]>
`claudeAuthEnvCarriedForward`, `isPathWithinDirectory` and
`queryWindowsProcessRowsFresh` lost their last caller with the handoff. The
fresh-scan tests now go through `queryWindowsProcessDescendants({ fresh: true })`,
the teardown path that still depends on that contract.

Co-Authored-By: Claude <[email protected]>
Six comments still named the handoff coordinator, a handoff suspend, or a
terminal-owned session as live participants in the flows they describe.

Co-Authored-By: Claude <[email protected]>
…ement

The removed restart handoff test pinned this branch; nothing else did.

Co-Authored-By: Claude <[email protected]>
The handoff removal dropped the per-session queue from `handoffStatus`, so a
read landing mid-start reported the reservation (no owner) instead of the
settled chat owner, and shipped desktop clients blocked worktree activation on
it. The read is queued again, as it was before the removal.

Co-Authored-By: Claude <[email protected]>
The gate only refused a write when a PTY had been bound to a chat session, and the
only code that ever bound one was the terminal handoff this branch removes. With it
gone, every admit/readmit returned "admitted" unconditionally, so the checks on the
renderer write path, the runtime controller backstop, terminal.send, agent prompts,
preview input and orchestration pointers, the refusal fields on terminal.send and
worker-start receipts, the plugin and CLI refusal copy, and the adopted-pane
orchestration routing could no longer run. Ordinary writes take the same path in
the same order as before.

Co-Authored-By: Claude <[email protected]>
…alled

appendLegacyTranscriptMessages fed the terminal transcript catch-up and
proveClaudeTranscriptBranch backed the terminal owner's exit proof. Both lost
their last caller with the handoff. Their tests now go through the live entry
points instead: the roster bounds through the legacy import, the pinned-read and
growth tests through the ancestry replay the history window uses, and the marker
rules through the string proof in their own file rather than the session-file
resolver's.

Co-Authored-By: Claude <[email protected]>
A send refused because the chat's owner is not settled showed "The session is
mid-handoff (<stage>)." in the composer. With the handoff gone, the stages that
reach it are a chat that is still starting, or one whose previous agent process
has not yet been confirmed stopped. The message now says which of the two it is.
The refusal code is unchanged.

Co-Authored-By: Claude <[email protected]>
With the terminal handoff gone, the module named codex-tui-rollout-proof holds
only the pinned rollout lookup that structured Codex launches use to resume a
thread, so the name described code that no longer exists. Rename the module and
its options type. Also drop a mobile allowlist assertion that pinned the
removed agentSession.requestHandoff method, which no longer exists to allow.
The handoffStatus reply type still listed the terminal handoff's fields and
states (terminal placement, host label, proof retry, queued and waiting phases,
the to-terminal direction). No host writes them any more and the only client
reader parses the reply as unknown, so they described nothing. The reply on the
wire is unchanged.
…t decode

Nothing in this build writes a terminal owner (`runtimeKind: 'tui'`) or the
handoff's `preparing` / `old-owner-stopped` stages, but the in-memory types
still admitted them, so readers across the host kept branches for values no
path produces and the compiler could not point at them.

The store now validates the on-disk shape, which still accepts those values so
an older record is not quarantined, and maps them once while parsing:

- `preparing` and `old-owner-stopped` become `recovering`
- a `tui` lease becomes `native`; when it records a process it also becomes
  `conflicted`, the claim every build probes but never stops. A plain native
  owner would be stopped by restart recovery, here and in older builds.

Revisions are taken over the normalized state on both sides of every compare,
and the mapped record reaches disk with the store's first transaction, the
same way the tab-id backfill does.

The in-memory types narrow to what this build writes, and the branches that
existed only for the removed values go. Structured-worker identity keeps its
verdict for a former terminal owner by refusing a conflicted claim rather
than a non-native kind.
…ation

A reservation only ever names a native owner now, so the request no longer
carries a kind and the reserved lease records `native` directly. The attach
params keep `runtimeKind`: agentSession.ensure and create accept it, and the
operation fingerprint stored in the ledger covers it.
…at changes nothing else

Hiding a tab also committed the visibility index, so the no-op transaction
wrote the file even when its open-time revision was wrong. Committing the index
first leaves the pending rewrite as the only reason to write.
…ration

A write carried the fence of the last frame the pane read, and the host refused it
unless that fence was still current. An idle release and the restart after it each
move the fence, and the release publishes nothing, so a send after a release was
refused "Expected runtime fence 1; the session is at 3", and a Stop queued behind a
cold start was refused as stale.

Every write already names what it acts on: a send its conversation, a cancel its
turn, a prompt answer its item revision, a rewind its epoch; an option is
last-writer-wins. So admission stops comparing the client's fence, and the rebase
that papered over one restart (admitAtResumedFence, resumedFromFence) goes with it.
The writer-lease check stays, and so does the attach's compare-and-swap.

Frames now stamp the fence read when each frame is sent instead of a copy each
subscriber kept, which went stale on the same release.

@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

This PR leaves an existing test in the suite broken. tests/e2e/structured-agent-session-read-owner.unit.test.ts was not updated for the required readFence hook on AgentSessionSubscribers, and 2 of its 3 tests fail on this branch (they pass on the base). Details and evidence below.

Reviewed changes

  • Drop the write-time fence check. admitAgentSessionMutation no longer compares expectedRuntimeFence with the lease; writes are admitted by their own target and still require a live writer lease. isAgentSessionFenceCurrent survives only in the attach acquisition compare-and-swap.
  • Delete the one-restart rebase. admitAtResumedFence and resumedFromFence (host session + attach computation) are removed; send preparation now answers refused-or-not and no longer rewrites the envelope.
  • Frames carry the live fence. AgentSessionSubscribers drops the per-subscriber fence and takes a required readFence(sessionId) hook, read at send time and stamped on every frame; open/snapshot/reset/backgroundTasks lose their fence argument.
  • Tests and docs rewritten to pin the new behavior rather than the removed refusal, plus the cross-version wire test and remote-wire-compatibility.md.

⚠️ A missed AgentSessionSubscribers call site breaks an existing test

AgentSessionSubscribers now requires a readFence hook, and open() no longer accepts a fence. Every call site was updated except tests/e2e/structured-agent-session-read-owner.unit.test.ts: it constructs the class at line 144 with only onJournalPublished, and still passes fence: 1 to open() at line 173. Because readFence is invoked on every emitted frame, the subscribe edge throws and the read owner never catches up.

On the committed head, structured-agent-session-read-owner.unit.test.ts fails 2/3 (cursor stalls at 100 instead of 140/501). I checked out the base and the same file passes 3/3, then added readFence: () => 1 locally on the head and the suite went green again — so the regression is caused by this PR. This file matches the vitest include glob tests/e2e/**/*.unit.test.ts, so pnpm test (and CI) will fail; config/tsconfig.e2e.json is explicitly not enforced, so typecheck did not surface it. Worth grepping once more for new AgentSessionSubscribers before merging, in case any other out-of-tree spec has the same shape.

Technical details
# AgentSessionSubscribers call site missing the required readFence hook

## Affected sites
- `tests/e2e/structured-agent-session-read-owner.unit.test.ts:144` — constructs
  `new AgentSessionSubscribers({ onJournalPublished })` without the required
  `readFence` hook.
- `tests/e2e/structured-agent-session-read-owner.unit.test.ts:173` — `subscribers.open({...})`
  still passes `fence: 1`, which the method no longer accepts.
- `src/main/native-chat/agent-session-wire/structured-agent-session-subscribers.ts:47`
  — `readFence` is a required member, read at
  `structured-agent-session-subscribers.ts:87` and `:212`.

## Required outcome
- The spec constructs the subscribers with a `readFence` hook and stops passing `fence`
  to `open`, so the two currently-failing tests pass on the head.

## Suggested approach (optional)
- Add `readFence: () => 1` to the hooks object at line 144 (the journal rows in this
  fixture are all fenced at 1) and delete `fence: 1` from the `open()` call at line 173.
- Re-run `pnpm vitest run --config config/vitest.config.ts tests/e2e/structured-agent-session-read-owner.unit.test.ts`
  and confirm 3/3.

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

@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

The delta since the prior pullfrog review is two docs/wording commits and one behavioral fix that settles the frames-versus-fence question.

  • Restored the per-subscriber fence on frames. AgentSessionSubscribers drops the live readFence hook and returns to the base shape: open takes a fence, reset/snapshot/backgroundTasks take one, and every frame carries the pane's own fence, advanced only by a replay or a background-task publication. Call sites pass session.fence (host.publishFence, background-task publish) or the store lease fence on subscribe.
  • Added a regression test for the resend loop. structured-agent-session-send-preparation.test.ts now pins that a failed restart's published frames keep the pane's original fence, even though the lease moved — the trigger that made a refused send resend forever.
  • Removed the obsolete live-fence test (stamps a fence that moved without a replay) and the matching readFence wiring in the affected specs.
  • Cleared the prior blocking finding. With open({ fence }) restored and the constructor hooks optional, tests/e2e/structured-agent-session-read-owner.unit.test.ts passes again (3/3; 40/40 with subscribers and send-preparation). Verified locally.

The write-time fence removal itself is unchanged from the previously reviewed revision; this commit only realigns frame publication with it.

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

…box comments

Three places still gave the removed fence check as a reason: the launch replay said admission puts the ledger ahead of the fence, the launch surface said a send must name the lease it was admitted against, and the direct-mailbox path said the lease fence decides whether delivery is safe. Admission now checks only the writer lease.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready for review at 6c16f353c6

Verdict: the fix works, the one regression found in review is fixed, and six review rounds ended clean. Nothing else found is caused by this PR.

What changed during review

  • 31444bf876 removes the part of the original change that sent every chat frame the host's current fence. Live testing showed that it turned a failed restart into an endless resend. The desktop resent the same message every ~7.5 s, and each attempt moved the fence by 2 (3 → 89 in 5 minutes), with no Retry shown. Frames now carry each pane's own fence, as on the base branch. A new test pins this. Writes are still admitted whatever fence they carry, so the user's issue stays fixed.
  • fa9b76a48a, 5435973e4d, 494d8c7ac1, 0e74529dff and 6c16f353c6 change comments only. They remove text that still described the deleted fence check or the one-restart rebase.
  • PR body: corrected the Cancel row (only Claude checks the turn before acting), disclosed the existing Codex Stop ordering gap, added the scope section, and added the live test results.

Live desktop testing (structured Claude chat, idle release forced, before 713b126feb vs after 31444bf876)

  • Send after an idle release: before, it is refused ("Expected runtime fence 1; the session is at 3."). After, it is answered once, with no error.
  • Stop after an idle release: before, the message is refused, so there is nothing to stop. After, Stop clears the turn in about 260 ms.
  • Restart that fails after an idle release: both builds make one attempt, then show "Message was not sent." with Retry, and the fence stops moving.
  • Ordinary chat: identical on both builds.
  • The QA seat was Claude Opus, because the planned Grok seat was out of quota.

Checks run on the head

  • 375 test files, 3697 of 3697 pass, including the cross-version wire suite. Node and web typechecks, oxlint and the changed-code quality gate are clean.
  • Ablation: putting back the removed fence check turns 15 tests red, including the idle-release send, the Stop behind a cold start and the cross-version write.
  • The start and end readiness checks pass. An independent architecture review concluded the design should be kept, and that this change is safe to land before the later accept-then-deliver change.
  • CI is still running on this head.

Not caused by this PR (known, tracked elsewhere)

  • A real Claude chat usually cannot restart after an idle release ("provider close unproven"), on the base branch too. A separate PR in this series fixes it. After a reload, the same state shows "Could not load conversation" with "[object Object]".
  • The desktop outbox resends whenever its fence changes, and a failed restart before admission leaves no recorded answer. The later accept-then-deliver change owns the lasting fix. Until then, frames keep each pane's own fence on purpose.
  • During a Claude cold start, Stop withdraws every held send. A Codex Stop stops the turn's child processes before the provider checks the turn id. Both belong with the later Stop rework.

Not tested by hand: mobile, paired web and SSH. No client code changed, and every host runs the same host code.

…tes-by-target

# Conflicts:
#	src/main/native-chat/agent-session-wire/structured-agent-session-host-types.ts
#	src/main/runtime/agent-session-record-store-legacy-handoff-lease.test.ts
#	src/renderer/src/lib/worktree-agent-activation-gate.test.ts
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/remove-tui-handoff to main September 25, 2026 18:22
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 2164be2f-c1f7-47bb-8df4-ffa6d8686d13

📥 Commits

Reviewing files that changed from the base of the PR and between 8009939 and 25fa38a.

📒 Files selected for processing (23)
  • docs/reference/remote-wire-compatibility.md
  • src/main/agent-launch/agent-launch-executor.test.ts
  • src/main/agent-launch/agent-launch-surface-factories.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-attach-orchestration.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-types.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-mutation-admission.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-refusal-retry.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-restart-continuation.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-rewind.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-send-preparation.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-send-preparation.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-send-restarts-failed-start.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-send.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-turns.ts
  • src/main/native-chat/agent-session-wire/structured-conversation-command.test.ts
  • src/main/runtime/agent-session-operation-admission.ts
  • src/main/runtime/agent-session-surface-release-transition.ts
  • src/main/runtime/orca-runtime-get-pty-record-for-pane-key.ts
  • src/main/runtime/orchestration/structured-worker-direct-mailbox-target.test.ts
  • src/main/runtime/rpc/methods/agent-launch-replay.ts
  • src/shared/agent-session-mutation-envelope.test.ts
  • src/shared/agent-session-mutation-envelope.ts
  • tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts
💤 Files with no reviewable changes (1)
  • src/main/native-chat/agent-session-wire/structured-agent-session-host-types.ts

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


📝 Walkthrough

Walkthrough

Mutation admission no longer rejects writes based on expectedRuntimeFence; it retains operation-ledger and writer-lease checks. Session send preparation no longer rewrites the envelope to a resumed fence. Tests and documentation now cover writes carrying a fence from another generation.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 25fa3

The changed structured-chat write behavior has no identified merge-blocking issue; normal checks can proceed.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 25fa3

Older chat writes can now proceed after an agent restart, but the reviewed path still requires a valid writer and preserves operation identity. No introduced security finding was established. Some mutation-specific behavior remains unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed admission behavior applies to mutations reaching this shared structured-chat path. The reviewed evidence does not establish a change to terminal-backed chat or a broader service boundary.

Trust Boundaries and Controls

  • observed — A supplied envelope does not select its own execution fence: the host validates its fingerprint against the received operation, admits it against the record for its session ID, and uses the admitted record's lease and fence. The caller-key provenance upstream of this path was not established.

Hardening Proposals

  • proposed — Consider explicitly documenting or narrowing generation-spanning, session-wide background-task cancellation: its target task ID is optional, so its intended effect on tasks started after a delayed request deserves a target-specific check.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 21 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 identifies the main change: chat writes are keyed by their target instead of the owner generation.
Description check ✅ Passed The description is detailed and covers the scope, user impact, mechanism, rationale, testing, compatibility, visual proof, and AI disclosure. It references #22783 as the related work, documents that m…
Full details: Docstring Coverage

Explanation

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

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

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.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Ready to merge. This is my view as coordinator of the native-chat redesign PRs.

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