fix(server): stop stale settlement notifications #9081
main fromrefs/pull/9081/head·opened View on GitHubProblem#
Automatic thread settlement refreshes a thread's general update time. Agent-awareness state for already completed or failed work then looks fresh again, so the server queues another mobile notification (and can replace the lock-screen card) for work that finished long ago. Reported in #9057 (old settled threads appeared newly settled after an update) and #11938.
Change#
projectThreadAwareness keeps the actual terminal time for terminal phases: for completed and failed awareness it prefers the provider session's terminal updatedAt (ready/idle for success, error for failure), then latestTurn.completedAt, then the session and thread times. Running and waiting phases still use the thread update time, so live activity freshness is unchanged.
Scope and approval#
Bug fix for #11938; a maintainer linked it to this PR as the same terminal updatedAt freshness fix, covering #9057: https://github.com/pingdotgg/t3code/issues/11938#issuecomment-5686456176. Maintainer verification of the precedence, with a request to rebase and re-run CI: https://github.com/pingdotgg/t3code/pull/9081#issuecomment-5547344216
Verification#
- Established the problem from the reports: settlement bumps
thread.updatedAt, and the relay treats a newer awarenessupdatedAton a completed/failed thread as a new event. - Rebased onto main at 0cf482b in this session (no conflicts) so CI runs on current main.
vp test run packages/shared/src/agentAwareness.test.ts: 6 passed. The tests separate a later settlement time from the terminal work time and assertupdatedAtfor an interrupted-but-completed turn, a ready session without a turn row, and a failed session.vp test run src/relay/AgentAwarenessRelay.test.ts(fromapps/server): 15 passed.- Shared
tsc --noEmit: exit 0.vp lintandvp fmt --checkon both changed files: clean. - Not checked: a real APNs delivery on a device. Server-only change, no UI.
Made with GPT-5.6 Sol in T3 Code through the Codex harness. Rebase and body update by Claude Opus 5.5 via Claude Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
2f9b1f9Macroscope's review found this PR approvable — This narrow fix changes only terminal awareness timestamps so settlement metadata cannot retrigger stale completion or failure notifications. Active-state behavior is unchanged, and focused tests cover the affected terminal scenarios.
Notes:
- Diff unchanged. Approvability was decided on eligibility alone.
Maintainer verification: the timestamp precedence reads correctly — completed/failed awareness pins terminalSessionAt, then latestTurn.completedAt, then session.updatedAt, so post-finish metadata edits no longer re-fire notifications or tombstone the lock-screen card, while live phases still track thread.updatedAt. Tests pin TERMINAL_AT against a later NOW. One ask: no Check/Test CI appears in this PR's rollup, so it needs a rebase and a CI re-run before merge.
juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Warning
Review limit reached#
Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.
Next included review available in 1 minute.
View limit details
Limit details: You’ve used all 10 included reviews currently available.
Review configuration:
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
61e798bc-0951-4cba-a097-2726b242569d📥 Commits
Reviewing files that changed from the base of the PR and between c57a04b722f2172e3be2c8f73c936d10b4582431 and 343968099a7e9dc89289db1371cc9ccc546f069f.
📒 Files selected for processing (2)
packages/shared/src/agentAwareness.test.tspackages/shared/src/agentAwareness.ts
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Autopilot is currently an internal CodeRabbit preview.
Comment `@coderabbitai help` to get the list of available commands.[claude-opus-5-5] Responding on behalf of Guille
@lnieuwenhuis Rebased onto current main as 343968099a (no conflicts), so CI should now run on this head. Focused shared and relay tests pass locally.
Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition.
This PR derives notification freshness from V1 session and latestTurn timestamps. V2 rewrites agent awareness around runtime/run state. A remaining duplicate notification needs a new V2 reproduction.
Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved.
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed