Skip to content

fix(agent-status): keep the turn identity a disconnect clear removed (STA-3524) - #14635

Closed
brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/false-notifications-12747
Closed

brennanb2025 wants to merge 1 commit into
mainfrom
brennanb2025/false-notifications-12747

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When Orca loses an SSH connection it throws away everything it knew about the agents on that host. On reconnect the host re-sends ("replays") what it had. Orca had no memory of the turn it just threw away, so a job that finished an hour ago looked like it had just finished — and Orca announced it again. Every reconnect, another "Claude finished" notification. During a flapping connection, dozens in a few minutes.

This PR makes Orca remember the identity of the turn it cleared, just long enough for the replay to arrive, so it recognizes the re-sent status as the same turn instead of a new one.

What Changed

src/main/agent-hooks/server.ts:

  • clearStatusEntriesForConnection now stashes the turn identity of each row it deletes — connectionId, state, agentType, prompt, stateStartedAt.
  • attachStatusTiming consults that stash when there is no cached previous row. If the incoming event is a replay from the same connection carrying the same state / agentType / prompt, it reclaims the original stateStartedAt. Anything else keeps live timing.
  • The stash is one-shot: read-and-delete on the pane's next status, so a live event supersedes it. It is also dropped by both real teardown fan-outs (deleteStatusEntry without preserveAuthority, dropStatusEntriesByTabPrefix, clearPaneState), alongside the existing promptSentDedupeByPaneKey per-pane cache it now mirrors.

receivedAt is deliberately not restored — it must keep advancing past the disconnect's clear watermark, or the renderer's transientClearWatermark guard drops the replayed row as a resurrected pre-disconnect status.

No wire change, no IPC change, no renderer change.

Why

The renderer already has the right dedupe. agent-completion-coordinator.ts keys completion notifications on a turn identity:

function hookCompletionIdentity(payload) {
  return [payload.state, payload.agentType ?? '', String(Math.trunc(payload.stateStartedAt))].join(':')
}

and checks it twice — once against the live coordinator's lastCompletionIdentity, once against the module-scoped lastCompletionIdentityByPaneKey that outlives a coordinator remount. A repeated done for the same turn is supposed to be silent.

The defect is that the key gets re-minted, not that the dedupe is missing:

  1. ssh-relay-session.ts:1612 — connection_lost teardown calls agentHookServer.clearStatusEntriesForConnection(targetId), which deleteStatusEntrys every row that connection owned.
  2. Reconnect calls agent_hook.requestReplay; the host re-forwards its cache with isReplay: true.
  3. applyNormalizedStatus → attachStatusTiming finds no previous (step 1 deleted it), so it falls to stateStartedAt = now.
  4. done:claude:<old> becomes done:claude:<now>. Both dedupe checks miss. dispatchCompletion fires.

So the fix belongs where the identity is minted, not at a new bypass downstream.

Why not "skip notifications for replayed statuses"

That is what the two PRs below do — plumb isReplay into AgentStatusIpcPayload and add data.isReplay !== true to the notification guard in useIpcEvents.ts:3281. It suppresses the reported symptom, but that guard fences off the whole of observeAgentHookCompletionForNotification, not just the duplicate:

  • Attention is lost too. The same call drives dispatchAttention for waiting / permission states. A replay is exactly how a client re-learns that an agent is blocked on the user after a flap; skipping observation means no "Needs You" — the inverse failure tracked as [Bug] No Notification When Agent Requires User Input #14426.
  • dispatchHookLifecycle is skipped, which the notifications module explicitly wants to keep running independent of notification preferences ("accepted hooks must still release pane-owned cursor/cache effects after the quiet window").
  • Coordinator turn state desyncs. A skipped replayed working leaves workingStatusObserved false and never clears paneKeysRequiringFreshWorking, which can silently swallow the next real completion.
  • It leaves the re-minted stateStartedAt in place, so every other consumer of it stays wrong: WorktreeCardAgents.tsx:98 and useActivityUnreadCount.ts:71 (ackAt < entry.stateStartedAt) re-mark the row unread on each reconnect; dashboard-agent-status-patch.ts:49 re-stamps finishedAt; web-session-tabs-sync.ts:1211 lets a replayed done outrank a newer client working; isMirroredCommandCodeTurnBump reads it as a new Command Code turn.

Restoring the identity fixes all of those at once and reuses the dedupe that already exists.

Relationship to #14610 (STA-4144)

Complementary, non-overlapping, and this PR closes the gap #14610 documented as out of scope.

They touch neighbouring lines of the same two functions but different branches: #14610 acts when previous exists, this acts when it does not. #14610 argued the gap needed "a new optional wire field"; a client-side tombstone closes it with no wire change. Either can merge first; whichever lands second will need a trivial textual rebase in attachStatusTiming/applyNormalizedStatus, no logic conflict.

Re-verified against both PRs as they stand today rather than asserted from memory: #14610 is still OPEN and CONFLICTING / DIRTY against main, and touches src/main/agent-hooks/server.ts (+10/−1) plus one new test. Its hunk sits in applyNormalizedStatus at ~line 1276, passing replayPreservedReceivedAt ?? now into attachStatusTiming; this PR's nearest hunk ends inside attachStatusTiming at ~line 1102 — about 174 lines apart, no textual overlap. The branches are mutually exclusive: #14610 requires previous to exist, this PR's reclaim requires !previous, in which case previous?.receivedAt is undefined and receivedAt stays live. Either can merge first.

Supersedes

Both correctly identified where the notification fires. This PR fixes why the row looked new instead of gating the observation.

Linked Issue

Fixes #12747

Linear STA-3524.

Visual Proof

No UI change, and the user-visible difference is the absence of a duplicate OS notification — which a single screenshot cannot show. So the proof is a count across repeated relay drops against a live SSH host, run in both directions.

Live rig

Throwaway ubuntu:22.04 Docker container as the SSH target (linux-arm64, key-only root login, node 22.14.0, build-essential + python3 — required or node-pty will not compile on the host and remote PTYs never come up — a real git repo at /work/demo-project, and claude 2.1.233 on PATH so Orca's remote hook detector fires). The client was this worktree running as an isolated Electron dev instance (own ORCA_DEV_USER_DATA_PATH, own CDP port, getIdentity() re-verified before every interaction batch, repos: [] on first attach confirming a genuinely fresh profile), connected through the real ssh.connect path. Orca installed its real managed hook on the remote — /root/.orca/agent-hooks/claude-hook.sh plus SessionStart / UserPromptSubmit / Stop entries in /root/.claude/settings.json.

The relay drop is the exact connection_lost path this PR is about: kill only the relay's --connect bridge inside the container by resolved numeric PID, leaving the detached relay daemon (which owns the cache that gets replayed) alive. That gives mux transport close → teardownProviders('connection_lost') → clearStatusEntriesForConnection → auto-reconnect → agent_hook.requestReplay → host re-forwards with isReplay: true.

Result

Before the fix (src/main/agent-hooks/server.ts reverted to its pre-PR state; the running main bundle verified to contain zero occurrences of clearedStatusTimingByPaneKey):

1 real completion         → 1 notification
12 relay-drop cycles      → 12 more, exactly one per reconnect
TOTAL = 13

stateStartedAt was re-minted on every replay — 1786947531919 → 1786947619673 → … → 1786947736801 — which is precisely the re-minted identity this PR describes.

After the fix (same rig, same container, single pane, fresh profile):

1 real completion         → 1 notification
12 relay-drop cycles      → 0
TOTAL = 1

Every cycle asserted (a) the client answered CDP before and after and (b) the remote relay logged a fresh Socket client accepted, so no cycle is vacuous — the relay logged 13 accepts total (1 initial + 12 reconnects). This mirrors the 12-cycle unit test at the real wire.

receivedAt still advances

Final row after the 12 drops:

stateStartedAt: 1786950695833   ← unchanged across all 12 replays
receivedAt:     1786950857498   ← +161,665 ms, past every disconnect clear watermark

Identity reclaimed, receivedAt deliberately not restored. Visible in the UI too: the sidebar agent row still reads 3m old instead of resetting to "just now" on each reconnect.

Two honest caveats

The agent binary was substituted. The container has claude installed but no credentials. So the turn was driven by invoking Orca's own installed managed hook script from inside the real remote pane with a real Claude UserPromptSubmit then Stop payload on stdin — the same call the agent process makes. Everything downstream of that script is production code: hook script → relay hook server on 127.0.0.1:$ORCA_AGENT_HOOK_PORT → agent.hook notification over the relay → SshRelaySession.ingestRemote → applyNormalizedStatus / attachStatusTiming → renderer completion coordinator → notifications:dispatch. The pane's genuinely injected env confirms the wiring (ORCA_AGENT_HOOK_PORT / _TOKEN / _ENV / _VERSION, ORCA_PANE_KEY, ORCA_TAB_ID, ORCA_WORKTREE_ID, ORCA_TERMINAL_HANDLE). Only the process that would have invoked the hook was simulated.

That substitution was subsequently shown to be immaterial. UserPromptSubmit / Stop payloads were captured from a real authenticated Claude 2.1.233 — the same version the container had — and differentiated against the payloads this rig actually injected, both arms driven through production normalizeHookPayload (the relay's own /hook/claude call) and the real AgentHookServer clear/replay, with the prompt text held identical so the arms differed only in payload shape:

  • The three fields replayReclaimsClearedTurn compares — state, prompt, agentType — are byte-identical.
  • The two that differ, lastAssistantMessage and providerSession, appear in neither the tombstone predicate nor the completion identity state:agentType:stateStartedAt.
  • The real binary's Stop carries no prompt field at all. resolvePrompt recovers it from the per-pane lastPromptByPaneKey cache seeded by UserPromptSubmit, so the done row still carries the true prompt — asserted as equal to the actual text on both arms, not merely equal to each other, since empty-on-both would satisfy the predicate vacuously.
  • Driving the real payload through 12 replay cycles reproduces both arms offline: 13 distinct completion identities without isReplay (stateStartedAt re-minted to equal receivedAt, advance 0 ms) and 1 with (advance 715,999 ms) — the same 13-vs-1 and the same shape as the live +161,665 ms.

This differential is offline and single-process: it does not cross the relay wire and it is not the notifications:dispatch measurement. It does not replace the live run above, and it is not a claim that the binary was un-substituted — it establishes that the payloads the live run injected were not a fiction.

Why the substitution was not simply removed. Re-running with a genuinely authenticated Claude was attempted and is blocked on this machine: every claude here authenticates through ANTHROPIC_AUTH_TOKEN + ANTHROPIC_BASE_URL set in the env block of ~/.claude/settings.json, so the OAuth file credentials rot unused — ~/.claude/.credentials.json has both its access and refresh tokens past expiry, and it answers 401 OAuth access token has been revoked. Confirmed from inside a throwaway container with both credential files copied in and no ANTHROPIC_* in its environment: Failed to authenticate: OAuth session expired and could not be refreshed. Worth knowing before rebuilding this rig.

Counting happens at the notifications:dispatch IPC handler, not at the OS banner. macOS refuses banners for an isolated dev bundle — the authorization read returns denied, so deliverNativeNotification() is never reached in either arm. notifications:dispatch is the call that becomes the banner; the only gates past it are the 5 s per-worktree cooldown, focus suppression (disabled for the run), and authorization — all worktree-global and identical in both arms, and the cycles were spaced well beyond the cooldown. So the 13-vs-1 comparison is unaffected.

One result that looks like a miss and is not

An earlier post-fix arm carried a stale pane over from a previous app run and produced one extra notification on that pane's first replay. That is the intended a completion first seen on the replay still notifies path (cases 2 and 4 below), not a leaked duplicate: at cold start the pane was not live yet so observation was skipped, and the first live replay was the coordinator's first sight of that turn. Its stateStartedAt was not re-minted (1786947736801 preserved), and the remaining 11 cycles were silent. The 12/12 figures quoted above come from a clean single-pane profile so the number is unambiguous.

Testing

New — src/main/agent-hooks/reconnect-clear-replay-turn-identity.test.ts (7 cases). Drives the real AgentHookServer through ingestRemote / clearStatusEntriesForConnection and asserts on the real getStatusSnapshot() row, using the same state:agentType:stateStartedAt key the renderer dedupes on.

Red/green oracle — with the fix reverted (git stash push -- src/main/agent-hooks/server.ts):

AssertionError: expected 'done:claude:1700000061000' to be 'done:claude:1700000005000'
Tests  1 failed | 6 passed (7)

The other six pass without the fix — they are guards on behavior that must NOT change:

  1. replay reclaims the cleared turn identity; receivedAt still advances (fails without the fix)
  2. a done first seen on the replay mints a new identity — the missed-completion path still notifies
  3. a replay with a different prompt does not reclaim
  4. a replay from a different host does not reclaim
  5. a live (non-replay) event does not reclaim
  6. a live turn after the clear does not inherit the stale timing
  7. a real pane teardown drops the tombstone

New — src/renderer/src/components/terminal-pane/agent-completion-reconnect-replay.test.ts (5 cases). Drives the real createAgentCompletionCoordinator and counts dispatchCompletion calls, pinning why the identity matters:

  • a re-minted stateStartedAt fires a second notification (the pre-fix behavior, asserted explicitly)
  • a preserved one stays silent
  • 12 consecutive replay cycles still yield exactly 1 notification (the reported flap)
  • a completion first seen on the replay still notifies
  • a genuinely new turn afterwards still notifies

Both guard directions verified load-bearing by deleting the connectionId comparison from the predicate and confirming case 4 fails.

Scoped checks (full typecheck skipped per instruction — OOM risk):

  • vitest src/main/agent-hooks/ src/relay/agent-hook-server.test.ts src/main/ssh/ssh-relay-session-agent-hooks.integration.test.ts → 42 files, 644 passed, 4 skipped
  • vitest src/renderer/src/components/terminal-pane/agent-completion* src/renderer/src/hooks/agent-hook-completion-notifications.test.ts src/renderer/src/hooks/useIpcEvents.test.ts src/renderer/src/runtime/web-session-tabs-sync* → 11 files, 359 passed
  • tsc --noEmit -p config/tsconfig.node.json --composite false → clean
  • tsc --noEmit -p config/tsconfig.web.json --composite false → clean
  • check-changed-code-quality.mjs -- origin/main → 0 findings across 3 changed files (all three scans)
  • oxlint + oxfmt --check on changed files → clean

Platforms: no platform branch. The path it fixes is the SSH relay reconnect, covered by the integration suites above and exercised live — macOS client → Linux SSH remote — under Visual Proof.

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

Review

  • Security — none. No new input, no trust-boundary change; the retained fields are already-normalized values from a row this process cached.
  • Cross-platform — no platform branch; shared ingest path.
  • Remote SSH — this is the remote path, and it was exercised live against a Linux SSH host through the real relay (see Visual Proof). No wire change and no new field on either side, so mixed client/host versions are unaffected: the fix is entirely client-side over isReplay, which already crosses the wire.
  • Mobile / paired clients — read the same rows. A replayed done now carries its true stateStartedAt, so it stops re-marking rows unread (useActivityUnreadCount.ts:71) and stops outranking newer client state in web-session-tabs-sync.ts.
  • Backwards compatibility — no persisted-format change. The tombstone is in-memory only and never serialized to last-status.json.
  • Performance — one map read/delete per ingested event; at most one entry per pane, dropped on the pane's next status or its teardown.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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
  • Scoped lint / typecheck / tests pass locally (full typecheck skipped per instruction — OOM risk)

Author

  • X / Twitter: @BrennanKB5

…(STA-3524)

An SSH teardown calls clearStatusEntriesForConnection, deleting every row the
connection owned. The reconnect replay then re-ingests each cached status with
no `previous` entry, so attachStatusTiming mints a fresh stateStartedAt. That
timestamp is the completion-notification dedupe key, so the finished turn looks
brand new and the task-complete notification fires again on every flap.

Keep the deleted row's turn identity until the pane's next status. A replay that
re-delivers the same connection/state/agentType/prompt reclaims its
stateStartedAt; anything else -- a live event, another host, or a completion that
landed while disconnected -- keeps live timing. receivedAt still advances so the
row sorts after the clear watermark.

Fixes #12747
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@brennanb2025, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 seconds

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 104670f7-aa16-4486-a491-fe5754092cc5

📥 Commits

Reviewing files that changed from the base of the PR and between 500b72d and d0f000f.

📒 Files selected for processing (3)
  • src/main/agent-hooks/reconnect-clear-replay-turn-identity.test.ts
  • src/main/agent-hooks/server.ts
  • src/renderer/src/components/terminal-pane/agent-completion-reconnect-replay.test.ts

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.

@innocarpe

Copy link
Copy Markdown
Contributor

Acknowledged — #12998 is now closed in favor of this PR.

Keeping the turn identity across the disconnect clear is the right layer. The renderer isReplay skip would have dropped attention and hook-lifecycle observation on reconnect.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status

State: MERGEABLE / CLEAN against main. CI green — 44 successful checks, 1 skipped, 0 failing. 3 files, +390/-1. Branch is 1 ahead / 177 behind main.

What the review loop established. The renderer already has the right dedupe — agent-completion-coordinator.ts keys completion notifications on state:agentType:stateStartedAt and checks it twice, once against the live coordinator and once against a module-scoped map that outlives a remount. The defect is that the key gets re-minted, not that the dedupe is missing: connection_lost teardown calls clearStatusEntriesForConnection, which deletes every row that connection owned; reconnect calls agent_hook.requestReplay; attachStatusTiming then finds no previous and falls to stateStartedAt = now, turning done:claude:<old> into done:claude:<now>. Both dedupe checks miss and dispatchCompletion fires. So the fix goes where the identity is minted rather than at a new bypass downstream.

The loop also rejected the obvious alternative with reasons, not preference. Gating on isReplay in the renderer fences off the whole of observeAgentHookCompletionForNotification, not just the duplicate: attention (dispatchAttention for waiting/permission) is lost, which is exactly how a client re-learns an agent is blocked after a flap; dispatchHookLifecycle is skipped, which the notifications module explicitly wants running independent of notification preferences; coordinator turn state desyncs, since a skipped replayed working leaves workingStatusObserved false and can silently swallow the next real completion; and it leaves the re-minted stateStartedAt in place, so every other consumer of it stays wrong (unread re-marking at useActivityUnreadCount.ts:71 and WorktreeCardAgents.tsx:98, finishedAt re-stamping, and a replayed done outranking a newer client working in web-session-tabs-sync.ts).

I confirmed the implementation shape in the diff: a clearedStatusTimingByPaneKey tombstone stashed on clear, consumed read-and-delete on the pane's next status, and dropped by the real teardown fan-outs. receivedAt is deliberately not restored — it must keep advancing past the disconnect's clear watermark or the renderer's transientClearWatermark guard drops the replayed row as a resurrected pre-disconnect status.

Validation — this one is genuinely strong, with two caveats that belong here

Live rig: a throwaway ubuntu:22.04 Docker container as a real SSH target (linux-arm64, key-only root login, node 22.14.0, build toolchain — required or node-pty will not compile and remote PTYs never come up — a real git repo, and claude 2.1.233 on PATH so Orca's remote hook detector fires), driven from an isolated Electron dev instance on this worktree through the real ssh.connect path. Orca installed its real managed hook on the remote (/root/.orca/agent-hooks/claude-hook.sh plus SessionStart/UserPromptSubmit/Stop entries in /root/.claude/settings.json). The drop is the exact connection_lost path at issue: kill only the relay's --connect bridge by resolved numeric PID, leaving the detached daemon that owns the replayed cache alive.

Result — 12 induced relay drops, both arms:

pre-fix post-fix
real completion 1 notification 1 notification
12 relay-drop cycles 12 more, one per reconnect 0
total dispatches 13 1

Pre-fix, stateStartedAt was re-minted on every replay (1786947531919 → 1786947619673 → … → 1786947736801). Post-fix the final row shows stateStartedAt unchanged across all 12 replays while receivedAt advanced +161,665 ms, past every disconnect clear watermark — so the sidebar agent row still reads 3m old instead of resetting to "just now" on each reconnect. No cycle is vacuous: each asserted that the client answered CDP before and after and that the remote relay logged a fresh Socket client accepted (13 accepts total — 1 initial + 12 reconnects). The pre-fix arm was verified to be running the pre-fix bundle (zero occurrences of clearedStatusTimingByPaneKey).

Caveat 1 — the agent binary was substituted. The container has claude installed but no credentials, and putting real auth on a throwaway box was not on the table. The turn was driven by invoking Orca's own installed managed hook script from inside the real remote pane with a real Claude UserPromptSubmit then Stop payload on stdin — the same call the agent process makes. Everything downstream is production code: hook script → relay hook server → agent.hook over the relay → SshRelaySession.ingestRemote → applyNormalizedStatus/attachStatusTiming → renderer completion coordinator → notifications:dispatch. The pane's genuinely injected env confirms the wiring. Only the process that would have invoked the hook was simulated.

Caveat 2 — counting happens at the notifications:dispatch IPC handler, not at the OS banner. macOS refuses banners for an isolated dev bundle (authorization reads denied), so deliverNativeNotification() is never reached in either arm. notifications:dispatch is the call that becomes the banner; the remaining gates past it — the 5 s per-worktree cooldown, focus suppression (disabled for the run), and authorization — are worktree-global and identical in both arms, and cycles were spaced well beyond the cooldown. The 13-vs-1 comparison is unaffected, but nobody actually saw a banner.

One result that reads like a miss and is not: an earlier arm carried a stale pane over from a previous app run and fired one notification on that pane's first replay. That is the intended "a completion first seen on the replay still notifies" path, not a leaked duplicate — the pane was not live at cold start so observation was skipped, and the first live replay was the coordinator's first sight of that turn. Its stateStartedAt was preserved (1786947736801), and the remaining 11 cycles were silent. The 12/12 figures above come from a clean single-pane profile.

Automated: two new suites. The main-side one drives the real AgentHookServer through ingestRemote/clearStatusEntriesForConnection and asserts on the real getStatusSnapshot() row using the renderer's own dedupe key; its red/green oracle is recorded concretely (expected 'done:claude:1700000061000' to be 'done:claude:1700000005000', 1 failed / 6 passed with the fix reverted). The other six are explicitly guards on behaviour that must not change and pass either way. The renderer-side suite drives the real coordinator and counts dispatchCompletion, pinning that a re-minted stateStartedAt fires a second notification, that 12 consecutive replay cycles yield exactly 1, and that a genuinely new turn afterwards still notifies. Both guard directions were verified load-bearing by deleting the connectionId comparison and confirming the different-host case fails. Scoped runs: 644 passed across 42 files, 359 across 11, both tsc --noEmit projects clean, changed-code quality gates 0 findings across all 3 files.

Not done: full pnpm typecheck skipped (OOM risk). No Windows or WSL hardware — there is no platform branch, and the WSL relay reconnect path is covered by unit/integration suites only.

#14610 has been CLOSED since this body was written — the coordination note is stale

The body states #14610 is "still OPEN and CONFLICTING/DIRTY" and works through which merges first. That is no longer accurate: #14610 was closed unmerged on 2026-08-17, so there is nothing to sequence. Its closing comment addresses this PR directly and, notably, checked the interaction by cherry-pick rather than by reading bodies — concluding that #14635 rebases cleanly onto main, that cherry-picking #14610 onto rebased #14635 produces a conflict hunk byte-identical to the one against main alone, and therefore "There is no collision, so closing this neither helps nor harms #14635. That PR stands on its own ticket and its own mechanism." The mutually-exclusive-branches reasoning in the body (#14610 acting when previous exists, this PR when it does not) is consistent with that, but the sequencing question is now moot. STA-4144 remains open and is being re-homed onto STA-4119 / STA-4612.

Supersedes

  • fix(agent-status): suppress replayed completion notifications #12998 (@innocarpe) — now CLOSED, so the claim holds. It plumbed isReplay through the IPC payload and skipped the renderer notification; it also added isReplay to toAgentStatusIpcPayload, leaking the flag into getStatusSnapshot() and the persisted last-status cache, so a pane whose last row happened to arrive as a replay would stay marked replayed indefinitely. @innocarpe commented here on 2026-08-15 acknowledging the closure and agreeing on the layer: "Keeping the turn identity across the disconnect clear is the right layer. The renderer isReplay skip would have dropped attention and hook-lifecycle observation on reconnect." That matches this PR's own analysis — no divergence to reconcile.
  • fix(notifications): do not re-fire task-complete notifications for replayed agent statuses #12750 (@robertnisipeanu) — same renderer skip with narrower plumbing. Also already CLOSED (the body describes it as the second superseded PR without stating its state; it is closed as of this comment).

Both correctly identified where the notification fires. This PR fixes why the row looked new, rather than gating the observation.

Wire / compat: no wire change, no IPC change, no renderer change in the fix itself. The tombstone is in-memory only and never serialized to last-status.json. isReplay already crosses the wire, so mixed client/host versions are unaffected. #12747 is still open.

Given the branch is 177 commits behind main, a rebase before merge is worth doing.

@OrcaWin

OrcaWin commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Thank you @brennanb2025. The client-side clear-on-disconnect this patched is no longer called: agent status is now owned by the execution host's store and readers subscribe to it, so a reconnect no longer replays a cleared turn as new. Closing as no longer applicable; please reopen if duplicate completion notifications still appear after reconnects.

@OrcaWin OrcaWin closed this Oct 11, 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.

Reconnect replays of cached agent statuses re-fire task-complete notifications

3 participants