Skip to content

fix(notifications): a reconnect replay no longer re-fires task-complete notifications - #29410

Merged
nwparker merged 2 commits into
mainfrom
nwparker/agent-status-replay-flag
Oct 16, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/agent-status-replay-flag

Conversation

@nwparker

@nwparker nwparker commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​94 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​94
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6

ELI5

When the connection to a remote host drops and comes back, the host re-sends the last status of every agent so the app can catch up. The app was treating each re-sent "finished" status as a brand-new finish, so every reconnect fired another "Claude finished" notification for work that was already done. During a flaky connection that meant dozens of duplicate notifications in a few minutes.

What Changed

  • Before: every relay reconnect re-fired the task-complete OS notification for agents that had already finished.
  • After: a reconnect still updates the agent status in the sidebar and tabs, but it doesn't notify again. A turn that starts and finishes after the reconnect still notifies as usual.

Mechanism:

  • The hook server already marks re-sent rows with isReplay: true. The main process dropped that flag when it forwarded the row to the window over agentStatus:set. It now forwards it (src/main/startup/main-window-agent-status.ts). The new isReplay? field is optional on AgentStatusIpcPayload.
  • The renderer handles a flagged row the way it already handles the startup snapshot: the status is applied, a replayed working only seeds completion tracking, and a replayed done is not treated as a completion (agent-status-event-applicator.ts). Nothing else about replay handling changes, including pending-pane queueing and retirement acknowledgement.

Why

The startup snapshot path already solved this exact problem: cached rows seed completion tracking and never dispatch a notification. The live replay path skipped that rule only because the flag was lost on the way to the window. Reusing the snapshot rule keeps a single definition of "a replayed row does not notify".

Alternatives considered:

  • Deduping notifications by completion identity in the coordinator. This doesn't hold up, because a reconnect clears and restamps the cached rows, so the identity changes.
  • Not clearing statuses on teardown. That would leave stale rows showing on a disconnected host, which is worse.

Trade-off: an agent that finished while the connection was down shows as done after reconnect but doesn't notify, the same as the startup snapshot today.

Supersedes #12750 (same direction, written against a pre-split index.ts, now conflicting).

Linked Issue

Linear STA-3524

Visual Proof

N/A. This only changes whether a duplicate OS notification fires. Nothing in the UI renders differently.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated
    • src/renderer/src/hooks/ipc-events/agent-status-reconnect-replay-notification.test.ts: a replayed done updates status without being observed as a completion, and a replayed working seeds tracking so the next real done still notifies. Both tests fail without the fix.
    • src/main/startup/main-window-structured-status-filter.test.ts: the window fanout forwards isReplay only on replayed rows.

Review

Codex review (gpt-6.1-sol, high): no findings.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH/remote: this is the relay reconnect path. The field is main-to-renderer IPC within one app build, so there's no wire change between client and host.
  • Mobile and paired clients: pickParsedAgentStatusPayload doesn't copy the new field, so no published projection changes.
  • Cross-platform: no platform-specific code.

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)

…te notifications

Carry the host's isReplay flag through the agentStatus:set IPC payload so the
renderer seeds completion tracking from replayed rows, as it already does for
the startup snapshot, instead of treating each cached done as a new turn.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

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

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5695830f-fb1d-4025-b76e-7a1f2988edaf
📥 Commits

Reviewing files that changed from the base of the PR and between 92e12f1 and 7d7fa7c.

📒 Files selected for processing: 1
  • src/renderer/src/hooks/ipc-events/agent-status-reconnect-replay-notification.test.ts

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: 95da0a65-c607-4170-9992-aa038defbc65
📥 Commits

Reviewing files that changed from the base of the PR and between 9c863a6 and 92e12f1.

📒 Files selected for processing: 5
  • src/main/startup/main-window-agent-status.ts
  • src/main/startup/main-window-structured-status-filter.test.ts
  • src/renderer/src/hooks/ipc-events/agent-status-event-applicator.ts
  • src/renderer/src/hooks/ipc-events/agent-status-reconnect-replay-notification.test.ts
  • src/shared/agent-status-ipc-payload.ts

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

📝 Walkthrough

The main process now adds isReplay: true to replayed agent-status events. The renderer uses this field like its replay option when handling completion notifications. Replayed completion statuses are not observed, while replayed working notifications are handled as seed-only. Tests cover forwarded replay markers and renderer handling.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 92e12

Replayed statuses retain their marker through to notification handling. No merge-blocking issue was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing duplicate task-complete notifications after reconnect replay.
Description check Passed The description is detailed and mostly complete. It explains the user impact, mechanism, rationale, alternatives, testing, compatibility considerations, and visual-proof exception. The linked issue is…
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.
✨ 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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nwparker
nwparker merged commit 9b8a29c into main Oct 16, 2026
33 checks passed
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