ADE-103: Add long-lived Claude SDK wake/cron support for ADE chats - #721
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@copilot review but do not make fixes |
|
Warning Review limit reached
Next review available in: 1 minute Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between c63aa3e4bd4733896b5ab6955c9e475bd04a2ce1 and ef69918. ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (39)
📝 WalkthroughWalkthroughAdds scheduled/background work tracking ("scheduled_work_update") and transcript retraction events across shared types, desktop Claude runtime (idle reader, SDK bump to 0.3.202), renderer UI (Schedule sections, badges), ade-cli TUI (SCHEDULE block, auto-open predicate), and iOS models/views (Chat Info sheet), with accompanying tests. ChangesScheduled work and transcript retraction feature
Estimated code review effort: 4 (Complex) | ~75 minutes Possibly related issues
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/desktop/src/shared/types/chat.ts (1)
598-636: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winThread
parentAgentIdthrough the downstream event model.parentAgentIdis added inapps/desktop/src/shared/types/chat.ts:598-636, but the iOS mapping still drops it and no renderer reads it, so the nested subagent hierarchy never reaches the UI. If this field matters for grouping, add it to the mapped event shape and consume it where subagent trees are rendered.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/shared/types/chat.ts` around lines 598 - 636, The new parentAgentId field on subagent events is not being propagated through the UI event flow, so nested subagent hierarchy is lost. Update the downstream event mapping that builds the chat event model from chat.ts subagent_* types to include parentAgentId, then thread it through the renderer path that displays subagent trees so the UI can group child agents under their parent. Use the subagent_started, subagent_progress, and subagent_result shapes in chat.ts and the corresponding iOS mapping/renderer code to keep the field consistent end-to-end.Source: Path instructions
apps/ade-cli/src/tuiClient/app.tsx (1)
7395-7416: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winGuard the auto-open flag behind
rightOpen.rightPane.kind === "chat-info"can still exist while the pane is closed (for example after Esc, and the chat-info refresh effect keeps that kind without reopening). In this branch, addingenvelope.sessionIdtosubagentAutoOpenedSessionsRefwithoutsetRightOpen(true)lets the first subagent event consume the one-shot auto-open and suppress it for the rest of the session.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/ade-cli/src/tuiClient/app.tsx` around lines 7395 - 7416, The auto-open tracking in the chat info update path is being set even when the right pane is closed, which can consume the one-shot session flag without actually reopening the pane. Update the logic in app.tsx around shouldAutoOpenChatInfoForEvent and the setRightPane callback so subagentAutoOpenedSessionsRef.current.add(envelope.sessionId) only happens when rightOpen is being set true, including the prev.kind === "chat-info" case. Keep the existing chat-info refresh behavior, but gate the auto-open flag behind rightOpen so a closed chat-info pane does not suppress later auto-open attempts.
🧹 Nitpick comments (1)
apps/ios/ADE/Views/Work/WorkChatRichCardViews.swift (1)
2279-2313: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting the shared "active popup" capsule chrome.
WorkChatInfoActivePopupduplicates almost all ofWorkSubagentActivePopup's layout/styling (icon + label + count + chevron in a capsule with the same padding/background/overlay/min-height), and the same pattern is repeated again forWorkChatPrActivePopup. A small sharedWorkComposerBadgeCapsuleview taking icon/label/trailing-content would remove this triplication and keep future styling tweaks (padding, tint, min-height) in one place.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/ios/ADE/Views/Work/WorkChatRichCardViews.swift` around lines 2279 - 2313, Extract the repeated capsule badge chrome used by WorkChatInfoActivePopup, WorkSubagentActivePopup, and WorkChatPrActivePopup into a shared reusable view such as WorkComposerBadgeCapsule. Move the common HStack/padding/background/overlay/frame/contentShape/button styling there, and parameterize the icon, label, count/trailing content, and action so each popup only supplies its specific text and accessibility label while keeping the shared styling in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/desktop/src/main/services/chat/agentChatService.ts`:
- Around line 20259-20261: `resetClaudeQuerySession` clears the scheduled-work
lookup maps but leaves `runtime.scheduledWorkSignatures` behind, which causes
`emitClaudeScheduledWorkUpdate` to suppress valid re-emissions after a session
reset. Update the session-reset cleanup in `resetClaudeQuerySession` to clear
`scheduledWorkSignatures` together with `scheduledWorkKindById`,
`scheduledWorkIdByTaskId`, and `scheduledWorkIdByToolUseId` so deterministic ids
can emit again on a fresh query.
In `@apps/ios/ADE/Views/Work/WorkChatRichCardViews.swift`:
- Around line 2419-2424: Gate the `detail` text in `WorkChatRichCardViews` so
`item.error` is only used when the work status is failed or missed, since
`buildWorkScheduledWorkSnapshots` can retain an old error across later updates.
Update the `detail` computed property to check the current status first and only
pass `item.error` through `workScheduledWorkText` for `status == "failed" ||
status == "missed"`, then continue falling back to `item.summary`,
`item.reason`, and `item.prompt`.
In `@apps/ios/ADE/Views/Work/WorkTimelineHelpers.swift`:
- Around line 629-705: buildWorkScheduledWorkSnapshots currently folds the
transcript in raw order, so later stale envelopes can overwrite newer
scheduled-work fields. Update the loop in buildWorkScheduledWorkSnapshots to
iterate over sortedWorkChatEnvelopes(transcript) instead of transcript, matching
the other work timeline helpers and ensuring the latest event wins for each
WorkScheduledWorkSnapshot.
---
Outside diff comments:
In `@apps/ade-cli/src/tuiClient/app.tsx`:
- Around line 7395-7416: The auto-open tracking in the chat info update path is
being set even when the right pane is closed, which can consume the one-shot
session flag without actually reopening the pane. Update the logic in app.tsx
around shouldAutoOpenChatInfoForEvent and the setRightPane callback so
subagentAutoOpenedSessionsRef.current.add(envelope.sessionId) only happens when
rightOpen is being set true, including the prev.kind === "chat-info" case. Keep
the existing chat-info refresh behavior, but gate the auto-open flag behind
rightOpen so a closed chat-info pane does not suppress later auto-open attempts.
In `@apps/desktop/src/shared/types/chat.ts`:
- Around line 598-636: The new parentAgentId field on subagent events is not
being propagated through the UI event flow, so nested subagent hierarchy is
lost. Update the downstream event mapping that builds the chat event model from
chat.ts subagent_* types to include parentAgentId, then thread it through the
renderer path that displays subagent trees so the UI can group child agents
under their parent. Use the subagent_started, subagent_progress, and
subagent_result shapes in chat.ts and the corresponding iOS mapping/renderer
code to keep the field consistent end-to-end.
---
Nitpick comments:
In `@apps/ios/ADE/Views/Work/WorkChatRichCardViews.swift`:
- Around line 2279-2313: Extract the repeated capsule badge chrome used by
WorkChatInfoActivePopup, WorkSubagentActivePopup, and WorkChatPrActivePopup into
a shared reusable view such as WorkComposerBadgeCapsule. Move the common
HStack/padding/background/overlay/frame/contentShape/button styling there, and
parameterize the icon, label, count/trailing content, and action so each popup
only supplies its specific text and accessibility label while keeping the shared
styling in one place.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 62b3b9a5-d15f-4d89-8136-1fe04c21db40
📥 Commits
Reviewing files that changed from the base of the PR and between 3147479 and c63aa3e4bd4733896b5ab6955c9e475bd04a2ce1.
⛔ Files ignored due to path filters (8)
apps/ade-cli/package-lock.jsonis excluded by!**/package-lock.json,!**/package-lock.jsonapps/desktop/package-lock.jsonis excluded by!**/package-lock.json,!**/package-lock.jsondocs/ARCHITECTURE.mdis excluded by!docs/**docs/features/ade-code/README.mdis excluded by!docs/**docs/features/chat/README.mdis excluded by!docs/**docs/features/chat/composer-and-ui.mdis excluded by!docs/**docs/features/chat/transcript-and-turns.mdis excluded by!docs/**docs/features/sync-and-multi-device/ios-companion.mdis excluded by!docs/**
📒 Files selected for processing (37)
apps/ade-cli/package.jsonapps/ade-cli/src/tuiClient/__tests__/RightPane.test.tsxapps/ade-cli/src/tuiClient/__tests__/appInput.test.tsapps/ade-cli/src/tuiClient/__tests__/chatInfo.test.tsapps/ade-cli/src/tuiClient/__tests__/format.test.tsapps/ade-cli/src/tuiClient/__tests__/subagentPane.test.tsapps/ade-cli/src/tuiClient/app.tsxapps/ade-cli/src/tuiClient/chatInfo.tsapps/ade-cli/src/tuiClient/components/RightPane.tsxapps/ade-cli/src/tuiClient/format.tsapps/ade-cli/src/tuiClient/types.tsapps/desktop/package.jsonapps/desktop/src/main/services/adeActions/registry.test.tsapps/desktop/src/main/services/adeActions/registry.tsapps/desktop/src/main/services/chat/agentChatService.test.tsapps/desktop/src/main/services/chat/agentChatService.tsapps/desktop/src/renderer/components/chat/AgentChatPane.tsxapps/desktop/src/renderer/components/chat/ChatSubagentsPanel.tsxapps/desktop/src/renderer/components/chat/chatExecutionSummary.test.tsapps/desktop/src/renderer/components/chat/chatExecutionSummary.tsapps/desktop/src/renderer/components/chat/chatTranscriptRows.test.tsapps/desktop/src/renderer/components/chat/chatTranscriptRows.tsapps/desktop/src/shared/chatScheduledWork.tsapps/desktop/src/shared/types/chat.tsapps/ios/ADE/Models/RemoteModels.swiftapps/ios/ADE/Views/Work/WorkActivityIndicator.swiftapps/ios/ADE/Views/Work/WorkChatHeaderAndMessageViews.swiftapps/ios/ADE/Views/Work/WorkChatRichCardViews.swiftapps/ios/ADE/Views/Work/WorkChatSessionView.swiftapps/ios/ADE/Views/Work/WorkErrorAndMessageHelpers.swiftapps/ios/ADE/Views/Work/WorkEventMapping.swiftapps/ios/ADE/Views/Work/WorkModels.swiftapps/ios/ADE/Views/Work/WorkPreviews.swiftapps/ios/ADE/Views/Work/WorkSessionDestinationView.swiftapps/ios/ADE/Views/Work/WorkTimelineHelpers.swiftapps/ios/ADE/Views/Work/WorkTranscriptParser.swiftapps/ios/ADETests/ADETests.swift
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9f3ab6933
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 13367e5733
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22e3119f5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c06be96f3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
2a49c2b to
9490680
Compare
| if ( | ||
| managed.runtime !== runtime | ||
| || runtime.query !== sessionQuery | ||
| || runtime.idleReaderGeneration !== generation | ||
| ) { | ||
| return; |
There was a problem hiding this comment.
When a foreground turn starts while the idle reader is already awaiting sessionQuery.next(), that await can resolve with the first SDK message for the foreground turn. This branch returns on the stale generation check before the resolved next is handed back through pendingPostResultNext, so the foreground reader never sees that already-consumed message. The active turn can then miss its first assistant or result event and wait on the wrong SDK output.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/main/services/chat/agentChatService.ts
Line: 13133-13138
Comment:
**Idle Handoff Still Drops**
When a foreground turn starts while the idle reader is already awaiting `sessionQuery.next()`, that await can resolve with the first SDK message for the foreground turn. This branch returns on the stale generation check before the resolved `next` is handed back through `pendingPostResultNext`, so the foreground reader never sees that already-consumed message. The active turn can then miss its first assistant or result event and wait on the wrong SDK output.
How can I resolve this? If you propose a fix, please make it concise.
Fixes ADE-103
Summary
Describe the change.
What Changed
Key files and behaviors.
Validation
How you tested.
Risks
Anything to watch.
Linked Linear issues
Summary by CodeRabbit
New Features
Bug Fixes
Chores
Greptile Summary
This PR adds long-lived Claude SDK wake and cron support for ADE chats. The main changes are:
Confidence Score: 4/5
This is close, but the idle reader race should be fixed before merging.
apps/desktop/src/main/services/chat/agentChatService.ts
Important Files Changed
Prompt To Fix All With AI
Reviews (9): Last reviewed commit: "Refs ADE-103: Avoid cron task fallback a..." | Re-trigger Greptile