feat: add OS notifications for completed/failed tasks#976
feat: add OS notifications for completed/failed tasks#976yehyal wants to merge 19 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
| const previous = lastSessionByThreadRef.current.get(thread.id); | ||
|
|
||
| // A completed/failed turn transitions from running with an activeTurnId | ||
| // to a session with no active turn and status ready/error. |
There was a problem hiding this comment.
should also notify on input/approval requested?
also maybe have the setting be more configurable than a boolean flag so users can set more granular levels of when they wanna be notified
There was a problem hiding this comment.
I wanted to push out a mvp first for just task status notification, but I can definitely work on adding it for input/approval
can you give me a bit more info regarding fine tuning the notifications? some example scenarios / levels that you want to add
There was a problem hiding this comment.
I will proceed with the first style, to match the current option styling like with the theme
|
@juliusmarminge, I also want this feature in T3code. Very useful. I believe all the requested changes have been made by @yehyal. If anything else is needed, let me know and I’ll update it. I really want this feature in T3code! Cc: @yehyal |
|
Was using a similar but minimal version on my local, this seems like a good extended version of the same to have. I would love to have this in as well. |
|
I'd love to see this merged! |
|
I will get this in. Just have more important stuff right now. But i have not forgotten about it! |
|
I'll work on resolving conflicts in mean time |
|
Hey, is there any way I could help to bring this forward? I really want this feature in t3code |
ApprovabilityVerdict: Needs human review 2 blocking correctness issues found. New feature adding OS notifications with ~1200 lines of new code introducing notification infrastructure, settings UI, and orchestration event handling. Multiple critical unresolved review comments identify bugs: undefined functions ( You can customize Macroscope's approvability policy. Learn more. |
| const events = await api.orchestration.replayEvents(recovery.getState().latestSequence); | ||
| if (!disposed) { | ||
| applyEventBatch(events); | ||
| } |
There was a problem hiding this comment.
🔴 Critical routes/__root.tsx:560
fallbackToSnapshotRecovery() is called at line 563 but is never defined in scope, so replay recovery failures throw a ReferenceError instead of falling back to snapshot recovery. Consider defining the function or replacing the call with runSnapshotRecovery("replay-failed").
Also found in 1 other location(s)
apps/web/src/hooks/useSettings.ts:298
OLD_SETTINGS_KEYis referenced on line 298 and 326 but is not defined anywhere in the visible file. This will cause aReferenceErrorwhenmigrateLocalSettingsToServer()is called.
🤖 Copy this AI Prompt to have your agent fix this:
In file apps/web/src/routes/__root.tsx around line 560:
`fallbackToSnapshotRecovery()` is called at line 563 but is never defined in scope, so replay recovery failures throw a `ReferenceError` instead of falling back to snapshot recovery. Consider defining the function or replacing the call with `runSnapshotRecovery("replay-failed")`.
Evidence trail:
apps/web/src/routes/__root.tsx lines 551-572 (viewed at REVIEWED_COMMIT): `recoverFromSequenceGap` catch block at line 563 calls `void fallbackToSnapshotRecovery()`. `runSnapshotRecovery` is defined at line 572 with parameter `reason: "bootstrap" | "replay-failed"`. git_grep for `fallbackToSnapshotRecovery` in apps/web/src/routes/__root.tsx returns only the single call at line 563 — no definition exists.
Also found in 1 other location(s):
- apps/web/src/hooks/useSettings.ts:298 -- `OLD_SETTINGS_KEY` is referenced on line 298 and 326 but is not defined anywhere in the visible file. This will cause a `ReferenceError` when `migrateLocalSettingsToServer()` is called.
| const reconcileSnapshotDerivedState = () => { | ||
| const threads = useStore.getState().threads; | ||
| const projects = useStore.getState().projects; | ||
| syncProjects(projects.map((project) => ({ id: project.id, cwd: project.cwd }))); |
There was a problem hiding this comment.
🟠 High routes/__root.tsx:447
syncProjects is called with { id, cwd } objects, but syncProjects in apps/web/src/uiStateStore.ts reads project.key and project.logicalKey. Since id and key are different property names, project.key is always undefined, which corrupts the currentProjectCwdById map and breaks project ordering logic that depends on stable keys.
| syncProjects(projects.map((project) => ({ id: project.id, cwd: project.cwd }))); | |
| syncProjects(projects.map((project) => ({ key: project.id, cwd: project.cwd }))); |
🤖 Copy this AI Prompt to have your agent fix this:
In file apps/web/src/routes/__root.tsx around line 447:
`syncProjects` is called with `{ id, cwd }` objects, but `syncProjects` in `apps/web/src/uiStateStore.ts` reads `project.key` and `project.logicalKey`. Since `id` and `key` are different property names, `project.key` is always `undefined`, which corrupts the `currentProjectCwdById` map and breaks project ordering logic that depends on stable keys.
Evidence trail:
apps/web/src/routes/__root.tsx:447 — syncProjects called with `{ id: project.id, cwd: project.cwd }`
apps/web/src/routes/__root.tsx:506 — same pattern
apps/web/src/uiStateStore.ts:37-43 — `SyncProjectInput` interface requires `key`, `logicalKey`, `cwd`
apps/web/src/uiStateStore.ts:240-242 — `syncProjects` reads `project.key` and `project.logicalKey`
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 004aa02. Configure here.
|
@yehyal is attempting to deploy a commit to the Ping Labs Team on Vercel. A member of the Team first needs to authorize it. |




Summary
Adds OS notifications when a task completes or fails, with a user-facing toggle and a settings test button.
Why
Addresses issue
Notifications are important for backgrounded work. This keeps users in the loop without requiring the app to stay focused.
What Changed
off,important,normal,verbose) to control when OS alerts fire.task.started,task.progress)Levels are easy to extend by adding new activity kinds or mapping logic in
nativeNotifications.ts.Screenshots / Video
t3code-preview-notification.mp4
Notes
Note
Add OS notifications for completed and failed tasks
NotificationLevelsetting (Off,Important,Normal,Verbose) to client settings, configurable in the General settings panel with permission request and test notification support.migrateLocalSettingsToServer.Macroscope summarized 25bcce0.
Note
Medium Risk
Adds new background notification behavior triggered from the orchestration event loop and introduces a new persisted client setting plus a one-shot settings migration; mistakes could cause noisy/duplicate notifications or missed alerts.
Overview
Adds OS/native notifications for orchestration events when the app is backgrounded, driven by a new
notificationLevelclient setting (off/important/normal/verbose) that gates which task completions, failures, and activity updates generate alerts.Introduces
nativeNotificationshelpers (permission checks, background detection, notification payload resolution + de-dupe) with comprehensive unit tests, wires dispatch into__root.tsxevent batching/snapshot recovery, and extends the General settings panel to manage permission and send a test notification. Also adds a one-time migration to move legacy localStorage settings into the new server/client settings stores on welcome.Reviewed by Cursor Bugbot for commit 25bcce0. Bugbot is set up for automated code reviews on this repo. Configure here.