Skip to content

fix(server): settling a finished thread removes it from the Live Activity - #18604

Open
alcpereira wants to merge 2 commits into
pingdotgg:mainfrom
alcpereira:fix/settled-thread-leaves-live-activity
Open

alcpereira wants to merge 2 commits into
pingdotgg:mainfrom
alcpereira:fix/settled-thread-leaves-live-activity

Conversation

@alcpereira

@alcpereira alcpereira commented Oct 12, 2026 •

Copy link
Copy Markdown

Settling a finished thread left it on the iOS Live Activity (and the Android activity aggregate) showing Done. Settle events never reached the awareness relay, and the projection ignored settlement. Archive already clears the row; settle didn't.

Fix

  • projectThreadAwarenessV2 returns null when settledOverride === "settled" and the phase is completed or failed. The relay then publishes a tombstone the same way archive does, which ends the activity when it was the last row.
  • thread.settled now triggers a publish. Live or waiting work stays on the card after settle, including a completed run held open by a monitor or subagent. Starting a new turn clears settledOverride, so a thread that runs again comes back normally.
  • thread.unsettled deliberately does not publish, so pulling a thread back to Active does not re-alert Done.
  • Auto-settle takes the same path.

Fixes #16229. Replaces #16506, which was closed for not stating the model and harness. This is the same change rebased onto current main and re-reviewed.

Out of scope

Test plan

  • vp test run packages/shared/src/agentAwareness.test.ts apps/server/src/relay/AgentAwarenessRelay.test.ts (41 passed)
  • On a phone with Live Activity Updates on: run a turn to Done, settle it, and confirm the row leaves (or the activity ends if it was the only row)
  • Settle a thread with a live monitor: the row stays as working until the monitor ends, then leaves quietly
  • Unsettle a finished settled thread: no immediate Done alert

First drafted in Cursor, then rebased and re-reviewed with Claude Opus 5.5 (claude-opus-5-5) in Claude Code, running inside T3 Code.

alcpereira and others added 2 commits October 12, 2026 10:37
Also clarify that skipping thread.unsettled only blocks the immediate
re-alert; pingdotgg#11938 still covers later metadata republishes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 12, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 6311df2

Macroscope's review found this PR approvable — This is a focused Live Activity bug fix: settled completed or failed threads now emit a tombstone, while live and waiting work remains visible. The production impact is isolated and covered by targeted relay and projection tests.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 12, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 12, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 12, 2026 09:43

Dismissing prior approval to re-evaluate 6311df2

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 35016c38-b31e-4889-b66b-bca51bfeceec

📥 Commits

Reviewing files that changed from the base of the PR and between 58d2532 and 6311df2.


📒 Files selected for processing (4)
  • apps/server/src/relay/AgentAwarenessRelay.test.ts
  • apps/server/src/relay/AgentAwarenessRelay.ts
  • packages/shared/src/agentAwareness.test.ts
  • packages/shared/src/agentAwareness.ts

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



📝 Walkthrough
📝 Walkthrough

Walkthrough

Settled completed and failed threads are removed from the awareness projection. Settlement events now trigger relay publishing, while running and pending-action phases remain visible.

Changes

Thread Awareness

Layer / File(s) Summary
Settled thread projection
packages/shared/src/agentAwareness.ts, packages/shared/src/agentAwareness.test.ts
The projection reads settledOverride and returns null for settled completed or failed threads. Tests cover running, user-input, and monitor-task phases.
Settlement event publishing
apps/server/src/relay/AgentAwarenessRelay.ts, apps/server/src/relay/AgentAwarenessRelay.test.ts
The relay publishes on thread.settled events. Tests cover a tombstone for a settled completed thread and continued publishing of a running thread.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: juliusmarminge


Merge Risk: ⚪ Minimal · up to 6311d

Settling a finished thread now removes it from the Live Activity, while running or waiting work stays visible. No merge-blocking risk is evident. The phone-based checks in the test plan remain unchecked.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 6311d

The change preserves visibility for active work and pending requests while removing settled, finished activity. No new privilege or access expansion was identified. Risk remains bounded by uncertainty about duplicate removal delivery and end-to-end mobile behavior.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The new event path changes activity state for the selected thread in the configured server environment. It can affect the associated activity aggregate, but the reviewed patch does not expand credential authority or recipient selection. Remote recipient fan-out and authorization enforcement were not available for verification.

Trust Boundaries and Controls

  • observed — The newly publishable settlement event passes through existing enablement and credential gates. The publisher uses an environment bearer credential and signs a short-lived proof containing the environment, thread, and exact state. It reads the authoritative shell instead of forwarding event-supplied activity content; receiver-side validation remains outside the available source.

Resilience and Maintainability Implications

  • inferred — Repeated settlement can enqueue another tombstone because settlement still emits an event and successful null publication deletes local deduplication state. This uses a pre-existing tombstone mechanism, not a demonstrated security failure. Its remote idempotency and effect on aggregate delivery remain unverified.

Pre-merge checks | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Issue #16229 requires a settled completed or failed thread to leave the Live Activity, while live or user-waiting work remains visible. projectThreadAwarenessV2 now returns null for settled `compl…
Out of Scope Changes check Passed The changes stay within issue #16229. The projection change implements settled-thread tombstones. The relay change publishes settlement events. The tests verify the required terminal and live-work beh…
Title check Passed The title clearly and concisely describes the primary change: settling a finished thread removes it from the Live Activity. It also follows the conventional commit format.
Description check Passed The description explains the problem, implementation, scope, linked issue, automated test command, and unchecked manual verification items. It does not use all template headings or provide explicit ma…

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Settling a finished thread doesn't remove it from the iOS Live Activity

2 participants