Repository navigation
Conversation
A CTO cron can now carry a check: a shell command ADE runs in the project folder before each fire. The CTO wakes only when the check's stdout hash differs from the last run's, or the first time it fails; a failing check stays quiet until it passes again. The hash, failing flag and last check time live on the scheduled-work row. scheduleWork exposes `check`, the routine rows on desktop, web and iOS show it, and the CTO's guidance tells it to prefer a check and the longest interval that serves the person. Only the CTO tool and the routine restore can set a check; the public chat.createScheduledWork (IPC, remote, ade) drops it. Also fixes an iOS build break on Xcode 26.5 in WorkChatSessionView (a local shadowing the method it calls). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou'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 55 minutes. View limit details
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. |
There was a problem hiding this comment.
Devin Review found 5 potential issues.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| const decision = decideScheduledWorkCheck(schedule, run); | ||
| // A check that wakes is stamped with the fire's own time, so a reader can | ||
| // tell it from a later quiet one. | ||
| schedule.lastCheckedAt = decision.wake ? currentTime : now(); | ||
| if (decision.checkHash) schedule.checkHash = decision.checkHash; | ||
| else delete schedule.checkHash; | ||
| if (decision.checkFailing) schedule.checkFailing = true; | ||
| else delete schedule.checkFailing; |
There was a problem hiding this comment.
🔴 Lost news after wake retry
When delivery asks for a retry, processDue has already saved the new check result. The retry restores the fire time, not the old baseline. An unchanged retry result suppresses the wake that was never sent.
Learn more
A check compares its result with the last stored passing hash and failure flag. For a wake-worthy result, the scheduler stores both before asking the chat to deliver the wake. The wake handler returns retry on a retryable refusal. The retry branch releases the claim and rearms the row without restoring the check fields. The next attempt sees the same result as already handled and advances the cron quietly.
Example: A PR check changes from pending to green. The first delivery returns retry, and the next probe is still green. The scheduler makes only one delivery attempt and never sends the green result.
Recommended fix: Keep the prior check state until delivery is accepted, or persist the qualifying result as a pending wake. On a definite pre-delivery refusal, retain the pending wake or restore the prior hash, failure flag, and check timestamp before persisting and rearming.
Was this helpful? React with 👍 or 👎 to provide feedback.
| function checkEnv(): NodeJS.ProcessEnv { | ||
| const env: NodeJS.ProcessEnv = { ...process.env }; | ||
| setPathEnvValue(env, augmentProcessPathWithShellAndKnownCliDirs({ env, includeInteractiveShell: true, preferShellOrder: true })); | ||
| return stripHostRuntimeEnv(env); |
There was a problem hiding this comment.
🔴 PR watches miss ADE GitHub credentials
With only ADE's GitHub sign-in configured, checkEnv leaves the recommended gh check unauthenticated. Chat launches receive the account's GitHub environment separately. The routine keeps failing instead of watching the PR.
Learn more
Project chats receive GitHub credentials or a credential shim through the project chat environment. The headless runtime wires this to the project GitHub service, which can use an account App connection or a carried GitHub CLI sign-in. Routine checks run as separate children of the brain and do not inherit those session settings. The scheduleWork example therefore depends on a separate local GitHub CLI credential that the rest of the feature does not require.
Example: On a fresh ADE Cloud computer with an ADE GitHub App connection but no local gh login, ask the CTO to watch a private PR. The ordinary chat can read it, but the routine's baseline and every later check fail authentication.
Recommended fix: Route PR watches through an authenticated, project-scoped GitHub read or use the existing scoped GitHub credential mechanism for supported check commands. Do not copy the chat's entire environment or expose raw account credentials to arbitrary check commands.
Was this helpful? React with 👍 or 👎 to provide feedback.
| if (schedule.kind === "cron" && schedule.check && options.runCheck) { | ||
| let run: ChatScheduledWorkCheckRun; | ||
| try { | ||
| run = await options.runCheck(cloneSchedule(schedule)); |
There was a problem hiding this comment.
🔴 Interrupted check strands its routine
If ADE exits during runCheck, the claim survives without a recorded result. On restart, followClaimOwner keeps waiting for the dead runtime. The routine stops checking until the eight-day claim expires.
Learn more
The scheduler uses a database claim to ensure only one brain handles each occurrence. claimFire records the claim before the check runs, and the occurrence still has its original scheduled time during that wait. If the brain exits before it can save or release the claim, startup reconciliation re-arms the unchanged row. The new brain cannot claim it and finds no result to follow. The new shell wait widens that gap from a scheduler write to as long as the command timeout.
Example: An hourly watch starts a 30-second check and its computer restarts before it finishes. After restart, the watch remains on that same occurrence and misses subsequent hourly checks until the original claim ages out.
Recommended fix: Give the pre-delivery check claim a recoverable lease or a verifiable owner. Keep a distinct durable state for claimed occurrences that have already entered wake delivery, so recovery does not resend a wake that reached the chat.
Was this helpful? React with 👍 or 👎 to provide feedback.
| ...(routine.reason ? { reason: routine.reason } : {}), | ||
| ...(routine.timeZone ? { timeZone: routine.timeZone } : {}), | ||
| }); | ||
| }, { check: routine.check ?? null }); |
There was a problem hiding this comment.
🟡 Paused checks run during moves
When a CTO moves homes, replaceCtoRoutines executes checks for routines that were off. createScheduledWork runs the baseline before restore reapplies the pause.
Learn more
The saved copy records whether each routine was paused. Restore creates the job before reapplying its pause. For checked jobs, creation runs the shell before inserting the row, so restoring an off routine still executes it. Restore also discards the baseline result it receives, so the run is not reported to the CTO.
Example: Turn off a staging health check, then move the CTO from a laptop to a cloud computer. The destination calls staging during the move even though the routine remains off in settings.
Recommended fix: Hydrate restored routines with their pause state in the initial write and do not run their checks during restore. Carry the previous hash and failure flag where available, so moving homes also preserves the last observed result rather than silently treating changed output as the new baseline.
Was this helpful? React with 👍 or 👎 to provide feedback.
| ...(delaySeconds != null ? { delaySeconds } : {}), | ||
| ...(recurring != null ? { recurring } : {}), | ||
| ...(reason?.trim() ? { reason: reason.trim() } : {}), | ||
| ...(check?.trim() ? { check: check.trim() } : {}), |
There was a problem hiding this comment.
🟥 Routine checks bypass CTO write restrictions
scheduleWork lets the CTO run unrestricted shell commands in the main checkout without approval. createScheduledWork executes the command immediately, outside the CTO’s repository-write controls.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 4 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c2ad4ca. Configure here.
| if (decision.checkHash) schedule.checkHash = decision.checkHash; | ||
| else delete schedule.checkHash; | ||
| if (decision.checkFailing) schedule.checkFailing = true; | ||
| else delete schedule.checkFailing; |
There was a problem hiding this comment.
Check state not rolled back on fire retry
High Severity
processDue mutates schedule.checkHash, schedule.checkFailing, and schedule.lastCheckedAt before persist() and options.fire(), and neither the persist() error handler nor the if (retry) branch restores them. When fire() returns { retry: true } (such as a retryable refusal or cross-machine move lock) or persist() throws, the deferred retry compares against the already-updated check state, treats the occurrence as quiet, advances fireAt, and permanently drops the wake.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit c2ad4ca. Configure here.
| let outcomeSummary: string | undefined; | ||
| try { | ||
| const result = await options.fire(cloneSchedule(schedule), { late }); | ||
| const result = await options.fire(cloneSchedule(schedule), { late, ...(checkWake ? { check: checkWake } : {}) }); |
There was a problem hiding this comment.
followClaimOwner leaves stale check state in memory
Medium Severity
When another brain claims and runs a checked cron, followClaimOwner copies status, fireAt, lastFiredAt, lateFlag, and terminalAt from the persisted record, but omits checkHash, checkFailing, and lastCheckedAt. This brain retains stale check state in memory, causing list() to report outdated check status and causing decideScheduledWorkCheck to compare against stale state if this brain wins a later claim.
Reviewed by Cursor Bugbot for commit c2ad4ca. Configure here.
| ...(routine.reason ? { reason: routine.reason } : {}), | ||
| ...(routine.timeZone ? { timeZone: routine.timeZone } : {}), | ||
| }); | ||
| }, { check: routine.check ?? null }); |
There was a problem hiding this comment.
Restored routines silence baseline failures and run while paused
Medium Severity
replaceCtoRoutines calls createScheduledWork with routine.check and discards the returned baseline check result. If a restored routine's check fails on the new machine, createScheduledWork sets checkFailing: true assuming the caller saw the failure, so the CTO is never notified and all future failures stay permanently quiet. Additionally, paused routines still execute their shell check command during restore.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit c2ad4ca. Configure here.
| : "(Run now: the person started this early. It will not run again.)"} | ||
|
|
||
| ${schedule.prompt}` | ||
| : schedule.prompt, |
There was a problem hiding this comment.
Tracked CLI wakes omit check verdict and output
Low Severity
createScheduledWork permits a check on any schedulable session, including tracked agent CLIs, and processDue passes context.check to options.fire(). In the tracked-CLI branch, ptyService.sendToSession sends only schedule.prompt, dropping the scheduledWorkCheckWakeText header and check output that chat sessions receive.
Reviewed by Cursor Bugbot for commit c2ad4ca. Configure here.
… the owner's verdict Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A tinted tile carries the state, one schedule line, one quiet note, and settings rows open in place to show the prompt and the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


What
A CTO routine (a recurring cron) can now take a check: a shell command ADE runs in the project folder before each fire. The CTO wakes only when there is news.
A quiet run spends the occurrence without a turn and moves the cron on. A wake puts the verdict and the end of the output above the routine's prompt. When the routine is made, the check runs once as the baseline, and that run goes back to the CTO in the tool result.
check,checkHash,checkFailingandlastCheckedAton the scheduled-work row (chatScheduledWorkScheduler.ts). The gate runs in the scheduler's fire path, after the busy-defer and the shared claim. A cancel, pause or replacement that lands while the check runs wins, and the claim is released.scheduledWorkCheck.tsruns/bin/sh -con macOS and Linux andcmd.exe /d /s /con Windows, throughrunReapedCommand(process-group reaping, 60 s limit, 1 MiB of output), with the login-shell PATH.runReapedCommandgainswindowsVerbatimArgumentsfor the cmd line.scheduleWorktakescheck(recurring cron only).listScheduledWorkshowscheckandcheckFailing.scheduleWorkrule in the CTO's guidance: when a routine watches for a change, give it a check, and pick the longest interval that still serves the person. This is deliberately outsideIMMUTABLE_CTO_DOCTRINE, so it doesn't collide with feat(cto): reply, react, or stay quiet, and delegate to background helpers #2492.CtoRoutineRows), and iOS (CtoProfileSheet), now share one row:-adePreviewScreen cto-settings-routinesfixture.GET /cloud/cto) show "on change".Security
A check is a shell command. The public
chat.createScheduledWork(IPC, remote devices,ade) takes args only and drops anycheck. Only the CTO'sscheduleWorktool and the routine restore pass one, through an in-process option. A test covers this.Remote and providers
Review fixes
An undelivered wake (a
retryfromfire, or a failed save before delivery) now puts the check state back, so the retry still wakes. Before, the next attempt treated the news as already reported.A brain that follows another brain's claim now adopts its check hash and failure state, so it doesn't report the same news again when it takes over.
Two scheduler tests cover these. Each one fails when its fix is removed.
Tests: touched files only, 177 pass, plus 45/45 in the scheduler file after the review fixes. New: the check state machine through the real scheduler (quiet / changed / failed / quiet / quiet-on-old-output / changed), cancel during the check, the real runner, and the IPC drop. Both scheduler tests were shown to fail when the rule is broken.
Live, real scheduler and real shell checks: the CTO is woken at exactly the expected occurrences, with the expected wake text.
Live runner:
ghis found through the login PATH.UI: before/after screenshots and two recordings (desktop renderer preview with mock rows; iOS simulator fixture) of toggle, Run now and a failing check passing again are in the task report.
Typecheck: clean in desktop source. The only errors are in
ade-cli, from missing deps in this worktree. Account-directory is clean apart from an unrelated missing@gravity-ai/api. The iOS build passes.Not covered
Also
WorkChatSessionView.swift:1967broke the iOS build on Xcode 26.5 (a localsponsoredInlineHostshadows the method its closure calls; from #2490). It now callsself.sponsoredInlineHost(for:).🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; both previous findings are addressed and no new actionable issues were found.Summary
Adds shell checks that wake CTO routines only for changed output or a newly failing check. Desktop, web, iOS, and saved account copies show the checks.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Cron becomes due] --> B[Check pause, busy state, and shared claim] B --> C[Run shell check] C --> D{News?} D -- No --> E[Save check result and advance cron] D -- Yes --> F[Save firing state and send wake] F --> G{Delivery asks to retry?} G -- Yes --> H[Restore previous check state and retry later] G -- No --> I[Advance cron]Reviews (2) · Last reviewed commit: "feat(cto): calmer routine rows on deskto..." · Reviewed by Greptile