← Back to Pull requests

Pricing v3 batch 3: sleep race, delete retry, moved chats, ads notice #2721

Merged
arul28 merged 109 files (5018 lines) on Nov 29, 2026 05:17 UTC
View on GitHub
arul28 arul28 commented on Nov 29, 2026 04:46 UTC
Author

Why

PR #2702 brought Pricing v3 and the DAEX Cloud Mac to main with both server switches off. Validation kept going on that tree and found more problems. Each was fixed on its own branch, reviewed and accepted. This PR joins those fixes, plus the ads notice that #2702 held back, on top of main.

The switches pricing_v3 and mac_computers stay off. Nothing here turns them on.

What changed

Server

  • Idle sleep and queued messages: a message queued while an idle sleep goes through wakes the computer again, once (ade/idle-sleep-rewakes-for-queued).

  • Power log for deletes: every delete by the server writes a power log row. A refused try writes one too. A delete the provider asks to retry logs one waiting row, not one a minute (ade/server-deletes-write-power-log).

  • Daily reconcile: the day's correction charges only awake minutes that nothing explains, never the provider's rounding. Free time the provider never billed gives back at most the day's meter (ade/reconcile-does-not-charge-rounding).

  • A refused cancel delete: when the provider refuses a cancel's delete, the delete is owed. The server retries it every minute, takes turns between owed deletes, and charges nothing from the cancel. A launch's delete touches only its own computer. A Retry never takes back a computer whose delete waits (ade/cancel-delete-retries).

  • The ads notice: where ads start on, ads are on from the first message, and the first reply delivers a notice that says so and that the person can turn ads off. Where there are no ads, the out-of-credits refusal names only the paid ways (ade/ads-notice-shown, migration 0084_ad_notice_shown.sql).
  • Brain, CLI and desktop

  • The idle sleep's freeze: after its save, an idle sleep looks once more, closes the relay link and freezes. A person's write during the freeze waits, then goes out once. Refused work is not counted as use, a clock step is not a wake, and the freeze always lifts. A wake asked for by a queued send ends the asleep backoff, and the sent bubble stays until the chat shows it (ade/idle-sleep-freezes-first).

  • Moved chats: a chat continued on a new computer opens where it lives now. An open chat follows its continue launch to the new computer and reads its transcript again. A failed open keeps its window. One repository has one DAEX Cloud tab, and two account projects with one origin keep their own tabs. Activity names a computer whose chats moved as replaced, not offline (ade/moved-chat-opens-where-it-lives).

  • Desktop ads notice: the first reply delivers the ads notice where ads start on (ade/desktop-fixes-stack, notice commit).
  • Phone (ade/phone-zero-credits-small)

  • A launch restore reopens a chat only on its own machine.

  • A send or launch refused while a computer goes to sleep still lands. A launch waits up to five minutes for a sleeping computer, then offers Retry. A Delete during that wait never lets the launch run.

  • A project whose computers were deleted opens from the Hub.

  • A cancel whose delete is owed says DAEX Cloud deletes it soon.

  • The first reply delivers the ads notice.
  • Tests

  • The terminal dispose test answers each scan by the fake clock. It no longer depends on machine speed (ade/pty-dispose-test-machine-independent).
  • Database migration. One add-only file: 0084_ad_notice_shown.sql. It comes after 0085_ad_proof_target_at.sql in history, because 0085 went out with #2702. The migration rehearsal applied 0084 and 0085 in both orders. Each order applies cleanly, and a second apply finds nothing.

    Evidence

  • Merge: four conflicts, each resolved by keeping both sides. The owning lane read and confirmed each one:

  • - routes.ts imports;
    - the reconcile query in cron.ts;
    - CloudQueuedMessages.tsx;
    - useCloudQueuedBubbles.ts.
  • Mac, on this tree's code:

  • - account-directory typecheck passed, and 1158/1158 tests;
    - desktop typecheck passed, and the full desktop suite;
    - CLI typecheck passed.
  • Windows (validation lane):

  • - the account server, desktop, CLI and web typechecks and builds pass;
    - the account server's full suite passes, 1158/1158;
    - the desktop and CLI tests that cover the changed files pass;
    - the terminal dispose test passed 5 runs in a row.
    - Outside iOS, this tree is the same as the one they checked.
  • Phone: one build, then the iOS test classes this PR touches, on an iPhone 18 Pro simulator (iOS 27.0). ChatLaunchTests 36, CloudAccountRequestTests 10, HubProjectPresentationTests 17, and SyncProjectRouteRestoreTests 11 (it holds the launch-restore test): 74 tests, 0 failures.

  • Dev server: deploy 14 runs this tree's server code. 0084 was already applied on dev.

  • Live proofs on dev, by lane:

  • - the idle-sleep freeze on a DAEX Cloud Mac, with the runtime built from this branch;
    - the cancel keep and delete rows;
    - the moved-chat and Activity rows on desktop;
    - the phone's launch and notice rows.
    - The idle-sleep Mac row ran on a dev-only brain with a 60-second delay added before the idle-sleep ask, so its timings are not the shipped timing.
  • CI: this PR's run is the gate.
  • Not checked

  • A provider refusal of a cancel's delete was not forced live: there is no safe way to make the provider refuse one dev computer's delete. The account server's tests cover the owed path, the retry turns and the no-charge window.

  • Two old test failures that happen only on Windows (the terminal "Pi resume" pair, and one Droid case) are fixed on their own branch. They are not in this PR.

  • Production: nothing changes until this merges. The switches stay off.
  • 🤖 Generated with Claude Code

    <!-- greptile_comment -->

    <!-- greptile_summary -->

    <h2><ruby><rp>Confidence Score: 2/5 · Fix the wrong-computer resend, unseen ads notice, and slow-sleep recovery before merging.</rp></ruby><a href="https://app.greptile.com/api/retrigger?id=122969411&amp;sig=a74be0e2cdae65a0b1c2c5c2a5c26696ce278fa8690c0943746d79d134208998"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=versic&amp;next=%2Farul28%2Fdaex%2Fpull%2F2721&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 2/5</h2>

    <!-- greptile-risk -->

    Fix the wrong-computer resend, unseen ads notice, and slow-sleep recovery before merging.

    <h2><ruby><rp>Findings</rp></ruby><a href="https://app.greptile.com/ide/claude-code?prompt=%23%23%23%20Issue%201%0Aapps%2Fios%2FADE%2FServices%2FSyncService%2BChatLaunch.swift%3A719%0AThe%20wake%20loop%20reuses%20a%20send%20with%20a%20plain%20project%20id.%20If%20the%20person%20switches%20computers%20during%20the%20five-minute%20wait%2C%20%60performCommandRequest%60%20sends%20the%20next%20attempt%20through%20the%20newly%20focused%20connection.%20The%20launch%20fails%20on%20the%20wrong%20computer%20or%20starts%20there%20if%20that%20project%20exists.%20Keep%20the%20original%20machine%20in%20the%20scope%20used%20by%20both%20the%20resend%20and%20its%20cancel.%0A%0A%23%23%23%20Issue%202%0Aapps%2Fdesktop%2Fsrc%2Frenderer%2Fcomponents%2Fchat%2Fsponsored%2FSponsoredReplySlot.tsx%3A353-357%0AWith%20%60above_prompt%60%2C%20the%20request%20uses%20the%20dock's%20%60seen%60%20value%2C%20but%20the%20notice%20still%20requires%20the%20below-reply%20region's%20%60onScreen%60%20value.%20If%20the%20person%20is%20scrolled%20up%20when%20a%20reply%20finishes%2C%20the%20server%20marks%20the%20notice%20delivered%20without%20showing%20it.%20Starting%20the%20next%20turn%20removes%20the%20only%20turn%20allowed%20to%20show%20that%20notice%2C%20so%20later%20ads%20can%20appear%20without%20it.%20Wait%20until%20the%20notice's%20own%20region%20is%20visible%20before%20sending%20its%20delivery%20request.%0A%0A%23%23%23%20Issue%203%0Aapps%2Faccount-directory%2Fsrc%2Fcloud%2Froutes.ts%3A1418-1421%0AIf%20an%20accepted%20sleep%20takes%20longer%20than%20roughly%20fourteen%20seconds%20to%20appear%20at%20the%20provider%2C%20this%20function%20returns%20without%20waking%20the%20computer.%20The%20message's%20%60idle_sleep_rewoken%60%20row%20has%20already%20been%20written.%20If%20the%20computer%20sleeps%20just%20afterward%2C%20its%20brain%20cannot%20lift%20the%20freeze%20or%20drain%20the%20message%2C%20and%20no%20later%20attempt%20retries%20this%20wake.%20The%20message%20stays%20queued%20until%20another%20action%20wakes%20the%20computer.%20Keep%20the%20wake%20pending%20until%20the%20sleep%20finishes%20or%20is%20confirmed%20refused.%0A%0A%23%23%23%20Issue%204%0Aapps%2Fdesktop%2Fsrc%2Frenderer%2Fstate%2FaccountCloudLaunches.ts%3A633-636%0AThe%20account-change%20handler%20clears%20the%20launches%20and%20stops%20their%20poller%2C%20but%20leaves%20%60deleteOwed%60%20and%20its%20timers%20intact.%20Those%20timers%20later%20call%20%60cancelAccountCloudLaunch%60%20through%20the%20current%20account's%20bridge.%20The%20previous%20account's%20persistent%20notice%20also%20stays%20visible.%20Clear%20the%20retry%20entries%20and%20notices%20on%20account%20change%2C%20and%20guard%20in-flight%20answers%20with%20%60accountEpoch%60.%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=arul28%2Fdaex&pr=2721&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaudeDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=7"><img alt="Fix All in Claude Code" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=7" align="right"></picture></a>Findings</h2>

    1. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;Launch reaches the wrong computer <a href="https://github.com/arul28/DAEX/pull/2721#discussion_r4730076229">▶</a>
    2. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;Ads skip the visible notice <a href="https://github.com/arul28/DAEX/pull/2721#discussion_r4730076233">▶</a>
    3. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;Slow sleeps lose queued wakes <a href="https://github.com/arul28/DAEX/pull/2721#discussion_r4730076238">▶</a>
    4. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;Old retries survive account changes <a href="https://github.com/arul28/DAEX/pull/2721#discussion_r4730076242">▶</a>

    <details><summary>Fix with agent prompt</summary>

    `

    ### Issue 1
    apps/ios/ADE/Services/SyncService+ChatLaunch.swift:719
    The wake loop reuses a send with a plain project id. If the person switches computers during the five-minute wait, `performCommandRequest` sends the next attempt through the newly focused connection. The launch fails on the wrong computer or starts there if that project exists. Keep the original machine in the scope used by both the resend and its cancel.
    
    ### Issue 2
    apps/desktop/src/renderer/components/chat/sponsored/SponsoredReplySlot.tsx:353-357
    With `above_prompt`, the request uses the dock's `seen` value, but the notice still requires the below-reply region's `onScreen` value. If the person is scrolled up when a reply finishes, the server marks the notice delivered without showing it. Starting the next turn removes the only turn allowed to show that notice, so later ads can appear without it. Wait until the notice's own region is visible before sending its delivery request.
    
    ### Issue 3
    apps/account-directory/src/cloud/routes.ts:1418-1421
    If an accepted sleep takes longer than roughly fourteen seconds to appear at the provider, this function returns without waking the computer. The message's `idle_sleep_rewoken` row has already been written. If the computer sleeps just afterward, its brain cannot lift the freeze or drain the message, and no later attempt retries this wake. The message stays queued until another action wakes the computer. Keep the wake pending until the sleep finishes or is confirmed refused.
    
    ### Issue 4
    apps/desktop/src/renderer/state/accountCloudLaunches.ts:633-636
    The account-change handler clears the launches and stops their poller, but leaves `deleteOwed` and its timers intact. Those timers later call `cancelAccountCloudLaunch` through the current account's bridge. The previous account's persistent notice also stays visible. Clear the retry entries and notices on account change, and guard in-flight answers with `accountEpoch`.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    

    </details>

    <h3>Summary</h3>

    This PR joins fixes for cloud sleep races, refused deletes, daily billing corrections, moved chats, and the first-reply ads notice. It also adds phone wake waits and the add-only ads-notice migration.

  • Cloud computers freeze writes before sleep and wake for queued chats.

  • Canceled launches keep retrying deletes the provider refuses.

  • The first applicable reply delivers an ads notice before ads show.

  • Moved chats open from their current computer or account project.

  • The terminal dispose test uses elapsed time instead of scan counts.
  • Acknowledged limits: arul28 documented that a provider refusal of a cancel's delete was not forced live because there was no safe way to force it on one dev computer; server tests cover that path. arul28` also documented that the unrelated Windows-only failures are fixed on a separate branch and are not included here.

    <h3>Diagram</h3>

    sequenceDiagram
      participant App
      participant Brain
      participant Account
      participant Provider
      Brain->>Brain: Save, freeze writes, pause relay
      Brain->>Account: Ask for idle sleep
      Account->>Provider: Sleep computer
      App->>Account: Queue message during sleep
      Account->>Provider: Wait briefly for sleep
      alt Sleep observed
        Account->>Provider: Wake computer
        Brain->>Account: Drain queued messages
      else Provider still reports running
        Account-->>Account: Return without a pending wake
      end
    

    <!-- greptile_confidence_score:2 -->

    <sub>Reviews (1) · Last reviewed commit: "Merge ade/phone-zero-credits-small (7dd8..." · Reviewed by Greptile</sub>

    <!-- /greptile_comment -->

    Diff: 5018 lines (+4565 / -453) across 109 files Reviewer: greptile-apps[bot] Review duration: 31m
    All Vouch review confidence checks passed
    Residual risk 0.43 = Change Risk (0.72) × (1 − Review Confidence (0.40)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.72 · 5018 lines diff across 109 files
    0.72
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.40 · 5 substantive comment(s)
    0.40
    Model 3 · Review Timing & Attention
    Session adequacy: 25% · Reviewer familiarity: 50%
    39%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    9 items
    coderabbitai[bot] coderabbitai[bot] commented on Nov 29, 2026 04:46 UTC
    Bot

    <!-- coderabbit-ai-generated:v1 -->

    <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
    <!-- This is an auto-generated comment: rate limited by coderabbit.ai -->

    [!IMPORTANT]

    ## Review skipped

    > Too many files!

    > This PR contains 108 files, which is 8 over the limit of 100.

    > To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

    > Upgrade to a paid plan to raise the limit.

    > This organization's CodeRabbit subscription is cancelled. Resubscribe in Billing to continue reviews beyond the free-tier limit.

    > <details>

    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary>

    <dl>

    <dd>

    <br>

    > - Source mode: Auto

    - Repository: [arul28/DAEX](<https://github.com/arul28/DAEX>)

    - Branch: [ade/pricing-v3-batch3](<https://github.com/arul28/DAEX/tree/ade%2Fpricing-v3-batch3>)

    - File: [.coderabbit.yaml](<https://github.com/arul28/DAEX/blob/46d710e7a6efc9a79d84c2fc9712663401743a39/.coderabbit.yaml>)

    - Commit: [46d710e](<https://github.com/arul28/DAEX/commit/46d710e7a6efc9a79d84c2fc9712663401743a39>)

    - Layers: Repository YAML

    - Review profile: CHILL

    - Plan: Advanced

    - Run ID: fe847764-5098-4883-aea6-033f3588ea0b

    > </dd>

    </dl>

    </details>

    > <details>

    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary>

    <dl>

    <dd>

    <br>

    > Reviewing files that changed from the base of the PR and between 03fec378641a49ada75d17643818574d7b564aed and 46d710e7a6efc9a79d84c2fc9712663401743a39.

    > </dd>

    </dl>

    </details>

    > <details>

    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-minus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-minus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files ignored due to path filters: 1</strong></summary>

    <dl>

    <dd>

    <br>

    > docs/features/ade-cloud/README.md is excluded by !docs/

    > </dd>

    </dl>

    </details>

    > <details>

    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 108</strong></summary>

    <dl>

    <dd>

    <br>

    > apps/account-directory/README.md

    apps/account-directory/migrations/0084_ad_notice_shown.sql

    apps/account-directory/src/cloud/accountState.ts

    apps/account-directory/src/cloud/adPrice.ts

    apps/account-directory/src/cloud/adProof.ts

    apps/account-directory/src/cloud/chatMessages.ts

    apps/account-directory/src/cloud/contract.ts

    apps/account-directory/src/cloud/cron.ts

    apps/account-directory/src/cloud/gravity.ts

    apps/account-directory/src/cloud/idleCleanup.ts

    apps/account-directory/src/cloud/idleSleep.ts

    apps/account-directory/src/cloud/launches.ts

    apps/account-directory/src/cloud/routes.ts

    apps/account-directory/src/cloud/store.ts

    apps/account-directory/test/cloudAccount.test.ts

    apps/ade-cli/src/adeRpcServer.ts

    apps/ade-cli/src/adeToolAccess.ts

    apps/ade-cli/src/cli.ts

    apps/ade-cli/src/cliMachineTargeting.ts

    apps/ade-cli/src/services/cloudChats/cloudComputerRest.ts

    apps/ade-cli/src/services/power/cloudDeleteFreeze.ts

    apps/ade-cli/src/services/power/cloudKeepAwake.ts

    apps/ade-cli/src/services/power/cloudMoveMark.ts

    apps/ade-cli/src/services/power/power.test.ts

    apps/ade-cli/src/services/sync/brainProjectActionsSyncHandler.ts

    apps/ade-cli/src/services/sync/syncHostService.test.ts

    apps/ade-cli/src/services/sync/syncHostService.ts

    apps/ade-cli/src/services/sync/syncRemoteCommandService.test.ts

    apps/ade-cli/src/services/sync/syncRemoteCommandService.ts

    apps/ade-cli/src/services/sync/syncTerminalStreams.ts

    apps/ade-cli/src/services/sync/syncTunnelClientService.ts

    apps/desktop/src/main/main.ts

    apps/desktop/src/main/services/adeCloud/cloudLaneComputerStages.ts

    apps/desktop/src/main/services/adeCloud/cloudLaneLaunchService.ts

    apps/desktop/src/main/services/adeCloud/cloudLaneLaunchSteps.ts

    apps/desktop/src/main/services/adeCloud/registerCloudIpc.ts

    apps/desktop/src/main/services/cloudChats/registerCloudSavedChatsIpc.ts

    apps/desktop/src/main/services/ipc/registerIpc.ts

    apps/desktop/src/main/services/ipc/runtimeBridge.ts

    apps/desktop/src/main/services/pty/ptyService.test.ts

    apps/desktop/src/main/services/remoteRuntime/remoteConnectionService.test.ts

    apps/desktop/src/main/services/remoteRuntime/remoteConnectionService.ts

    apps/desktop/src/preload/global.d.ts

    apps/desktop/src/preload/preload.ts

    apps/desktop/src/renderer/components/activity/ActivityDetailSheet.tsx

    apps/desktop/src/renderer/components/activity/ActivityPanel.tsx

    apps/desktop/src/renderer/components/activity/HeaderActivityControl.tsx

    apps/desktop/src/renderer/components/activity/useDeletedCloudComputers.ts

    apps/desktop/src/renderer/components/app/App.tsx

    apps/desktop/src/renderer/components/app/TopBar.tsx

    apps/desktop/src/renderer/components/chat/AgentChatPane.tsx

    apps/desktop/src/renderer/components/chat/CloudQueueSendCard.tsx

    apps/desktop/src/renderer/components/chat/CloudQueuedMessages.tsx

    apps/desktop/src/renderer/components/chat/launch/chatLaunchActions.test.ts

    apps/desktop/src/renderer/components/chat/launch/chatLaunchActions.ts

    apps/desktop/src/renderer/components/chat/sponsored/SponsoredReplySlot.test.tsx

    apps/desktop/src/renderer/components/chat/sponsored/SponsoredReplySlot.tsx

    apps/desktop/src/renderer/components/chat/sponsored/useSponsoredViewer.ts

    apps/desktop/src/renderer/components/chat/useCloudQueuedBubbles.ts

    apps/desktop/src/renderer/components/settings/cloudDashboard/CloudAdsBand.tsx

    apps/desktop/src/renderer/lib/useDocumentVisible.ts

    apps/desktop/src/renderer/state/accountCloudLaunches.ts

    apps/desktop/src/renderer/state/adeCloudChatQueue.test.ts

    apps/desktop/src/renderer/state/adeCloudChatQueue.ts

    apps/desktop/src/renderer/state/adeCloudTabs.ts

    apps/desktop/src/renderer/state/appStore.ts

    apps/desktop/src/renderer/state/chatLaunchStore.ts

    apps/desktop/src/renderer/state/cloudAccountStore.ts

    apps/desktop/src/renderer/state/cloudSavedChats.ts

    apps/desktop/src/renderer/webclient/adapter/savedChatOnWeb.ts

    apps/desktop/src/shared/adeCloud/binding.test.ts

    apps/desktop/src/shared/adeCloud/binding.ts

    apps/desktop/src/shared/cloudAdPriceWords.ts

    apps/desktop/src/shared/codedError.ts

    apps/desktop/src/shared/savedChatRoute.test.ts

    apps/desktop/src/shared/savedChatRoute.ts

    apps/desktop/src/shared/sentry/expectedFailure.ts

    apps/desktop/src/shared/types/chatLaunch.ts

    apps/desktop/src/shared/types/core.ts

    apps/desktop/src/shared/types/sync.ts

    apps/ios/ADE/Services/AccountCloudLaunches.swift

    apps/ios/ADE/Services/AccountCloudStore.swift

    apps/ios/ADE/Services/ChatLaunchStore.swift

    apps/ios/ADE/Services/CloudServerClient.swift

    apps/ios/ADE/Services/CloudSponsored.swift

    apps/ios/ADE/Services/SyncService+ChatLaunch.swift

    apps/ios/ADE/Services/SyncService+Cloud.swift

    apps/ios/ADE/Services/SyncService.swift

    apps/ios/ADE/Views/Cloud/CloudAdPrice.swift

    apps/ios/ADE/Views/Cloud/CloudPlansCard.swift

    apps/ios/ADE/Views/Components/StartOnPicker.swift

    apps/ios/ADE/Views/Hub/HubComposerDrawer.swift

    apps/ios/ADE/Views/Hub/HubMachineSections.swift

    apps/ios/ADE/Views/Hub/HubScreen.swift

    apps/ios/ADE/Views/Settings/SettingsMachines.swift

    apps/ios/ADE/Views/Work/WorkChatLaunchPendingScreen.swift

    apps/ios/ADE/Views/Work/WorkChatLaunchSetupCard.swift

    apps/ios/ADE/Views/Work/WorkCloudLaunchViews.swift

    apps/ios/ADE/Views/Work/WorkCloudMachine.swift

    apps/ios/ADE/Views/Work/WorkNewChatMachinePicker.swift

    apps/ios/ADE/Views/Work/WorkNewChatScreen.swift

    apps/ios/ADE/Views/Work/WorkRootScreen.swift

    apps/ios/ADE/Views/Work/WorkSessionDestinationView.swift

    apps/ios/ADE/Views/Work/WorkSponsoredCards.swift

    apps/ios/ADETests/ADETests.swift

    apps/ios/ADETests/ChatLaunchTests.swift

    apps/ios/ADETests/CloudAccountRequestTests.swift

    * apps/ios/ADETests/HubProjectPresentationTests.swift

    > </dd>

    </dl>

    </details>

    > You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

    <!-- end of auto-generated comment: rate limited by coderabbit.ai -->

    <!-- autopilot:start -->

  • <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

  • <!-- autopilot:end -->
    <!-- tips_start -->

    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.

    <details>
    <summary><strong>Share</strong></summary>
    <dl>
    <dd>
    <br>

  • X

  • Mastodon

  • Reddit

  • LinkedIn
  • </dd>
    </dl>
    </details>

    <!-- tips_end -->

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 29, 2026 04:51 UTC
    Code Review
    apps/ios/ADE/Services/SyncService+ChatLaunch.swift:1
    @@ -611,18 +626,121 @@ extension SyncService {
       private func sendChatLaunchAction(_ action: String, launchId: String) async throws {
         try requireInvokableRemoteAction(action)
         let scope = chatLaunchScope(launchId: launchId)
    -    let response = try await performCommandRequest(
    -      action: action,
    -      args: ["launchId": launchId],
    -      disconnectOnTimeout: false,
    -      targetProjectId: scope.projectId,
    -      targetProjectRootPath: scope.rootPath
    -    )
    +    let send = {
    +      try await self.performCommandRequest(
    +        action: action,
    +        args: ["launchId": launchId],
    +        disconnectOnTimeout: false,
    +        targetProjectId: scope.projectId,
    +        targetProjectRootPath: scope.rootPath
    +      )
    +    }
    +    // Only a Retry starts work again; the other launch actions keep the
    +    // computer's sentence.
    +    let response: Any? = action == "chat.retryLaunch"
    +      ? try await chatLaunchCommandWakingCloud(launchId: launchId, projectId: scope.projectId, send: send)
    +      : try await send()
    +    // Deleted while a Retry waited for the computer to wake: nothing to apply.
    +    guard let response else { return }
         if let snapshot = decodeChatLaunchSnapshotIfPresent(response) {
           chatLaunchStore.apply(snapshot, projectId: scope.projectId, projectRootPath: scope.rootPath)
         }
       }
     
    +  /// How long a launch waits for an ADE Cloud computer that refused it while
    +  /// going to sleep, and how often it asks. The desktop's limit, for every
    +  /// computer: a Linux wake ends in seconds, while a Mac's stop saves its drive
    +  /// and then needs a new session (minutes when Macs are scarce).
    +  static let cloudLaunchWakeWait: TimeInterval = 300
    +  static let cloudLaunchWakeRetryNanoseconds: UInt64 = 4_000_000_000
    +
    +  /// Sends a launch command; if its ADE Cloud computer refuses it because it
    +  /// is going to sleep, or its link drops (a computer in its sleep freeze
    +  /// pauses its relay link, so no coded refusal arrives), wakes the computer
    +  /// through the account and sends the same command again
    +  /// every few seconds until it is taken, for up to `cloudLaunchWakeWait`.
    +  /// The launch is not marked failed while it waits
    +  /// (`syncLaunchCommandAfterCloudWake`). Other errors go to the caller as
    +  /// before. Nil when the launch was deleted during the wait.
    +  private func chatLaunchCommandWakingCloud(
    +    launchId: String,
    +    projectId: String?,
    +    send: @escaping () async throws -> Any
    +  ) async throws -> Any? {
    +    do {
    +      return try await send()
    +    } catch where syncLaunchWaitsForCloudWake(error) {
    +      let fleetKey = syncFleetParseMarkedProjectId(projectId)?.machineKey ?? focusedMachineKey
    +      guard let fleetKey, isCloudFleetKey(fleetKey),
    +            let accountKey = cloudAccountMachineKey(fleetKey: fleetKey)
    +      else { throw error }
    +      let name = cloudServerInstance(fleetKey: fleetKey)?.name
    +      // A Delete during the wait marks the launch; the wait reads the mark
    +      // right before each send and right after one lands.
    +      chatLaunchStore.updateLocal(launchId: launchId) {
    +        $0.wakeWaiting = true
    +        $0.wakingName = name ?? "the \(Brand.cloudName) computer"
    +      }
    +      defer {
    +        chatLaunchStore.updateLocal(launchId: launchId) { state in
    +          state.wakeWaiting = false
    +          state.wakingName = nil
    +          state.cancelledWhileWaking = false
    +        }
    +      }
    +      let scope = chatLaunchScope(launchId: launchId)
    +      return try await syncLaunchCommandAfterCloudWake(
    +        refusal: error,
    +        deadline: Date().addingTimeInterval(Self.cloudLaunchWakeWait),
    +        wake: {
    +          // Through the account server, not the computer itself (it refuses
    +          // work now). While its sleep is still on the way the server lists it
    +          // awake and sends nothing; once it sleeps, the next ask starts it. The
    +          // server never starts one that is already coming up, so asking again
    +          // each round costs one list read, not a second start.
    +          guard case .failed(let message) = await self.wakeCloudMachineThroughServer(
    +            machineKey: accountKey,
    +            name: name ?? "the \(Brand.cloudName) computer"
    +          ) else {
    +            // Listed awake or coming up: a freeze that ended keeps no link of
    +            // its own coming back on the backoff, so the round tries it now.
    +            await self.retryCloudLinkDuringFreeze(fleetKey: fleetKey, accountMachineKey: accountKey)
    +            return nil
    +          }
    +          // A Mac still saving its drive refuses a start until that ends: it
    +          // is on its way, so keep waiting (the wake just re-read the list).
    +          return self.cloudServerInstance(fleetKey: fleetKey)?.macStopping == true ? nil : message
    +        },
    +        pause: { try? await Task.sleep(nanoseconds: Self.cloudLaunchWakeRetryNanoseconds) },
    +        cancelled: {
    +          self.chatLaunchStore.entry(launchId: launchId) == nil
    +            || self.chatLaunchStore.localState(launchId: launchId).cancelledWhileWaking
    +        },
    +        send: send,

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Launch reaches the wrong computer

    The wake loop reuses a send with a plain project id. If the person switches computers during the five-minute wait, performCommandRequest sends the next attempt through the newly focused connection. The launch fails on the wrong computer or starts there if that project exists. Keep the original machine in the scope used by both the resend and its cancel.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: apps/ios/ADE/Services/SyncService+ChatLaunch.swift
    Line: 719
    
    Comment:
    **Launch reaches the wrong computer**
    
    The wake loop reuses a send with a plain project id. If the person switches computers during the five-minute wait, `performCommandRequest` sends the next attempt through the newly focused connection. The launch fails on the wrong computer or starts there if that project exists. Keep the original machine in the scope used by both the resend and its cancel.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    <a href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20apps%2Fios%2FADE%2FServices%2FSyncService%2BChatLaunch.swift%0ALine%3A%20719%0A%0AComment%3A%0ALaunch%20reaches%20the%20wrong%20computer%0A%0AThe%20wake%20loop%20reuses%20a%20send%20with%20a%20plain%20project%20id.%20If%20the%20person%20switches%20computers%20during%20the%20five-minute%20wait%2C%20%60performCommandRequest%60%20sends%20the%20next%20attempt%20through%20the%20newly%20focused%20connection.%20The%20launch%20fails%20on%20the%20wrong%20computer%20or%20starts%20there%20if%20that%20project%20exists.%20Keep%20the%20original%20machine%20in%20the%20scope%20used%20by%20both%20the%20resend%20and%20its%20cancel.%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=arul28%2Fdaex&pr=2721&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"><img alt="Fix in Claude Code" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"></picture></a>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 29, 2026 04:51 UTC
    Code Review
    apps/desktop/src/renderer/components/chat/sponsored/SponsoredReplySlot.tsx:1
    @@ -318,6 +349,12 @@ function SponsoredReplySlotOn({
         if (!askAd) return;
         let live = true;
         let timer: number | null = null;
    +    // The first reply asked while the notice is due delivers it: it shows the notice, whatever the answer.
    +    if (noticeDelivers && noticeDue && noticeDeliveryTurn() === null) {
    +      noticeDelivery = { generation: cloudAccountGeneration(), turnKey };
    +      setDeliveredOn(turnKey);
    +    }
    +    const delivering = noticeDelivers && noticeDeliveryTurn() === turnKey;

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Ads skip the visible notice

    With above_prompt, the request uses the dock's seen value, but the notice still requires the below-reply region's onScreen value. If the person is scrolled up when a reply finishes, the server marks the notice delivered without showing it. Starting the next turn removes the only turn allowed to show that notice, so later ads can appear without it. Wait until the notice's own region is visible before sending its delivery request.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: apps/desktop/src/renderer/components/chat/sponsored/SponsoredReplySlot.tsx
    Line: 353-357
    
    Comment:
    **Ads skip the visible notice**
    
    With `above_prompt`, the request uses the dock's `seen` value, but the notice still requires the below-reply region's `onScreen` value. If the person is scrolled up when a reply finishes, the server marks the notice delivered without showing it. Starting the next turn removes the only turn allowed to show that notice, so later ads can appear without it. Wait until the notice's own region is visible before sending its delivery request.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    <a href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20apps%2Fdesktop%2Fsrc%2Frenderer%2Fcomponents%2Fchat%2Fsponsored%2FSponsoredReplySlot.tsx%0ALine%3A%20353-357%0A%0AComment%3A%0AAds%20skip%20the%20visible%20notice%0A%0AWith%20%60above_prompt%60%2C%20the%20request%20uses%20the%20dock's%20%60seen%60%20value%2C%20but%20the%20notice%20still%20requires%20the%20below-reply%20region's%20%60onScreen%60%20value.%20If%20the%20person%20is%20scrolled%20up%20when%20a%20reply%20finishes%2C%20the%20server%20marks%20the%20notice%20delivered%20without%20showing%20it.%20Starting%20the%20next%20turn%20removes%20the%20only%20turn%20allowed%20to%20show%20that%20notice%2C%20so%20later%20ads%20can%20appear%20without%20it.%20Wait%20until%20the%20notice's%20own%20region%20is%20visible%20before%20sending%20its%20delivery%20request.%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=arul28%2Fdaex&pr=2721&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"><img alt="Fix in Claude Code" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"></picture></a>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 29, 2026 04:51 UTC
    Code Review
    apps/account-directory/src/cloud/routes.ts:1
    @@ -1373,6 +1379,55 @@ async function handleSleepLike(env: CloudEnv, computer: ComputerRow, provider: C
       }
     }
     
    +/** How often, and how many times, an idle sleep's rewake reads whether the provider has the computer asleep yet. */
    +const REWAKE_STATE_WAIT_MS = 2_000;
    +const REWAKE_STATE_TRIES = 8;
    +
    +/**
    + * After the computer's own idle sleep: a message queued for it during the
    + * sleep (`queuedDuringIdleSleep`) found the computer still running, so the
    + * queue only asked it to drain, and its freeze before the sleep refused that.
    + * The server wakes it again, once for that message: a real wake (a `wake`
    + * row, the idle count starts over), and its brain drains the queue at the
    + * wake. On Linux the start waits until the provider has the computer asleep,
    + * so it never answers for a computer still on its way down; one that never
    + * gets there did not sleep, and its brain drains when its freeze lifts. A
    + * Mac's stop saves its drive first: the start is a new session, which
    + * `startMac` holds until the save is done (the tick starts it), and the new
    + * session's brain drains at its start.
    + */
    +async function rewakeForQueuedMessage(env: CloudEnv, computer: ComputerRow, provider: CloudProvider, now: number): Promise<void> {
    +  const messageId = await queuedDuringIdleSleep(env, computer, now);
    +  if (!messageId) return;
    +  const current = await ownedComputer(env, computer.user_id, computer.instance_id);
    +  // Still running per the server (the provider refused the sleep), or deleted meanwhile: the brain drains it.
    +  if (!current || isMeteredStatus(current.status)) return;
    +  // Written first: a failure below never wakes it twice for the same message.
    +  await powerLogStatement(env, current, IDLE_REWOKEN_ACTION, messageId, now).run();
    +  logCloud("cloud.idle_sleep_rewoken", { instanceId: current.instance_id, messageId });
    +  const { blocked } = await wakeBlocker(env, current, now);
    +  if (blocked) {
    +    logCloud("cloud.idle_sleep_rewake_refused", { instanceId: current.instance_id, refusal: blocked.refusal });
    +    return;
    +  }
    +  const mac = isMacRow(current);
    +  if (!mac) {
    +    for (let tries = 1; ; tries += 1) {
    +      const seen = await provider.getInstance(current.instance_id).then((instance) => instance.status, () => null);
    +      if (seen !== "running") break;
    +      if (tries >= REWAKE_STATE_TRIES) {
    +        // It never went down: it did not sleep, and its brain drains the queue when its freeze lifts.
    +        logCloud("cloud.idle_sleep_rewake_still_running", { instanceId: current.instance_id });
    +        return;

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Slow sleeps lose queued wakes

    If an accepted sleep takes longer than roughly fourteen seconds to appear at the provider, this function returns without waking the computer. The message's idle_sleep_rewoken row has already been written. If the computer sleeps just afterward, its brain cannot lift the freeze or drain the message, and no later attempt retries this wake. The message stays queued until another action wakes the computer. Keep the wake pending until the sleep finishes or is confirmed refused.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: apps/account-directory/src/cloud/routes.ts
    Line: 1418-1421
    
    Comment:
    **Slow sleeps lose queued wakes**
    
    If an accepted sleep takes longer than roughly fourteen seconds to appear at the provider, this function returns without waking the computer. The message's `idle_sleep_rewoken` row has already been written. If the computer sleeps just afterward, its brain cannot lift the freeze or drain the message, and no later attempt retries this wake. The message stays queued until another action wakes the computer. Keep the wake pending until the sleep finishes or is confirmed refused.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    <a href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20apps%2Faccount-directory%2Fsrc%2Fcloud%2Froutes.ts%0ALine%3A%201418-1421%0A%0AComment%3A%0ASlow%20sleeps%20lose%20queued%20wakes%0A%0AIf%20an%20accepted%20sleep%20takes%20longer%20than%20roughly%20fourteen%20seconds%20to%20appear%20at%20the%20provider%2C%20this%20function%20returns%20without%20waking%20the%20computer.%20The%20message's%20%60idle_sleep_rewoken%60%20row%20has%20already%20been%20written.%20If%20the%20computer%20sleeps%20just%20afterward%2C%20its%20brain%20cannot%20lift%20the%20freeze%20or%20drain%20the%20message%2C%20and%20no%20later%20attempt%20retries%20this%20wake.%20The%20message%20stays%20queued%20until%20another%20action%20wakes%20the%20computer.%20Keep%20the%20wake%20pending%20until%20the%20sleep%20finishes%20or%20is%20confirmed%20refused.%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=arul28%2Fdaex&pr=2721&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"><img alt="Fix in Claude Code" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"></picture></a>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 29, 2026 04:51 UTC
    Code Review
    apps/desktop/src/renderer/state/accountCloudLaunches.ts:1
    @@ -576,10 +578,82 @@ export async function queueAccountCloudMessage(launchId: string, text: string):
     export async function cancelAccountCloudLaunch(launchId: string, options: { deleteComputer?: boolean } = {}): Promise<void> {
       const api = bridge();
       if (!api) return;
    -  const record = await api.cancel(launchId, options);
    +  let record: Awaited<ReturnType<typeof api.cancel>>;
    +  try {
    +    record = await api.cancel(launchId, options);
    +  } catch (error) {
    +    const owed = deleteOwedMessage(error);
    +    if (owed == null) throw error;
    +    // Cancelled; its computer's delete waits on the provider. The next read shows the launch cancelled.
    +    noticeDeleteOwed(launchId, owed);
    +    poller?.kick();
    +    return;
    +  }
    +  settleDeleteOwed(launchId);
       patchEntry(launchId, { record });
     }
     
    +/**
    + * After each of these waits, a page still open sends the cancel of a launch
    + * whose computer isn't deleted yet again (about 10 minutes in all). The server
    + * tries every minute by itself as well; a cancel sent again tries at once.
    + */
    +const DELETE_OWED_RETRY_MS = [30_000, 60_000, 2 * 60_000, 3 * 60_000, 4 * 60_000] as const;
    +const deleteOwed = new Map<string, { tries: number; waiting: boolean; closed: boolean }>();
    +const deleteOwedNoticeId = (launchId: string) => `cloud-launch-delete-owed:${launchId}`;
    +
    +/** The server's sentence when a cancel closed the launch but couldn't delete its computer yet, else null. */
    +function deleteOwedMessage(error: unknown): string | null {
    +  if (!(error instanceof Error)) return null;
    +  const code = (error as { code?: unknown }).code;
    +  // Through IPC the code can be lost; the sentence is the server's own.
    +  if (code === CLOUD_COMPUTER_DELETE_OWED_CODE || error.message.includes(CLOUD_LAUNCH_DELETE_OWED)) return CLOUD_LAUNCH_DELETE_OWED;
    +  return null;
    +}
    +
    +/** The notice stays until closed; "Delete it now" sends the cancel again, and so does this page a few times. */
    +function noticeDeleteOwed(launchId: string, message: string): void {
    +  const state = deleteOwed.get(launchId) ?? { tries: 0, waiting: false, closed: false };
    +  deleteOwed.set(launchId, state);
    +  if (!state.closed) {
    +    showToast({
    +      id: deleteOwedNoticeId(launchId),
    +      title: "Computer not deleted yet",
    +      message,
    +      tone: "warning",
    +      durationMs: 0,
    +      onClose: () => { state.closed = true; },
    +      actions: [{ label: "Delete it now", keepOpen: true, onClick: () => void deleteOwedNow(launchId) }],
    +    });
    +  }
    +  if (state.waiting || state.tries >= DELETE_OWED_RETRY_MS.length) return;
    +  const wait = DELETE_OWED_RETRY_MS[state.tries]!;
    +  state.tries += 1;
    +  state.waiting = true;
    +  setTimeout(() => {
    +    state.waiting = false;
    +    if (deleteOwed.get(launchId) === state) void deleteOwedNow(launchId);
    +  }, wait);

    <a href=""><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> Old retries survive account changes

    The account-change handler clears the launches and stops their poller, but leaves deleteOwed and its timers intact. Those timers later call cancelAccountCloudLaunch through the current account's bridge. The previous account's persistent notice also stays visible. Clear the retry entries and notices on account change, and guard in-flight answers with accountEpoch.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: apps/desktop/src/renderer/state/accountCloudLaunches.ts
    Line: 633-636
    
    Comment:
    **Old retries survive account changes**
    
    The account-change handler clears the launches and stops their poller, but leaves `deleteOwed` and its timers intact. Those timers later call `cancelAccountCloudLaunch` through the current account's bridge. The previous account's persistent notice also stays visible. Clear the retry entries and notices on account change, and guard in-flight answers with `accountEpoch`.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    <a href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20apps%2Fdesktop%2Fsrc%2Frenderer%2Fstate%2FaccountCloudLaunches.ts%0ALine%3A%20633-636%0A%0AComment%3A%0AOld%20retries%20survive%20account%20changes%0A%0AThe%20account-change%20handler%20clears%20the%20launches%20and%20stops%20their%20poller%2C%20but%20leaves%20%60deleteOwed%60%20and%20its%20timers%20intact.%20Those%20timers%20later%20call%20%60cancelAccountCloudLaunch%60%20through%20the%20current%20account's%20bridge.%20The%20previous%20account's%20persistent%20notice%20also%20stays%20visible.%20Clear%20the%20retry%20entries%20and%20notices%20on%20account%20change%2C%20and%20guard%20in-flight%20answers%20with%20%60accountEpoch%60.%0A%0A---%0A%0AFor%20each%20issue%20above%2C%20determine%20whether%20it%20is%20valid%20and%20should%20be%20fixed.%20If%20so%2C%20fix%20it%20directly.&repo=arul28%2Fdaex&pr=2721&platform=github"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=7"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"><img alt="Fix in Claude Code" src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=7"></picture></a>

    cursor[bot] cursor[bot] commented on code on Nov 29, 2026 04:53 UTC
    Code Review
    apps/account-directory/src/cloud/gravity.ts:1
    @@ -745,6 +755,10 @@ async function handleAd(request: Request, env: GravityEnv, userId: string, now:
             reportCloudFailure("cloud.ad_price.proof_failed", { message: error instanceof Error ? error.message : "unknown" });
           });
         }
    +    if (deliversNotice) {
    +      await markNoticeShown(env, userId, now);
    +      return none("notice");
    +    }

    Notice turn can later serve an ad

    Medium Severity

    <!-- DESCRIPTION START -->
    The first reply that delivers the ads notice returns notice before the per-turn answer is stored. A later ask for that same reply (reload, second screen) no longer takes the notice branch, skips the stored-answer reuse, and can fetch a real ad. Ads then appear on the notice turn, not the next reply.
    <!-- DESCRIPTION END -->

    <!-- BUGBOT_BUG_ID: 3fcf5753-7dd1-4b8f-982b-05ac071326de -->

    <!-- LOCATIONS START
    apps/account-directory/src/cloud/gravity.ts#L757-L770
    LOCATIONS END -->
    <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjU4OTcxMmIxLTY1NTYtNDIzNi1iYzNlLWJhYmE4ZDNmYTVlYyIsImVuY3J5cHRpb25LZXkiOiI2WmxMa3NjTFlYWlIzbVgtaXpNWlhQeUx3YW4yckdZekxsREMtblR3eG00IiwiYnJhbmNoIjoiYWRlL3ByaWNpbmctdjMtYmF0Y2gzIiwicmVwb093bmVyIjoiYXJ1bDI4IiwicmVwb05hbWUiOiJEQUVYIiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjU4OTcxMmIxLTY1NTYtNDIzNi1iYzNlLWJhYmE4ZDNmYTVlYyIsImVuY3J5cHRpb25LZXkiOiI2WmxMa3NjTFlYWlIzbVgtaXpNWlhQeUx3YW4yckdZekxsREMtblR3eG00IiwiYnJhbmNoIjoiYWRlL3ByaWNpbmctdjMtYmF0Y2gzIiwicmVwb093bmVyIjoiYXJ1bDI4IiwicmVwb05hbWUiOiJEQUVYIiwicHJOdW1iZXIiOjI3MjEsImNvbW1pdFNoYSI6IjQ2ZDcxMGU3YTZlZmM5YTc5ZDg0YzJmYzk3MTI2NjM0MDE3NDNhMzkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>

    <sup>Reviewed by Cursor Bugbot for commit 46d710e7a6efc9a79d84c2fc9712663401743a39. Configure here.</sup>

    cursor[bot] cursor[bot] commented on code on Nov 29, 2026 04:53 UTC
    Code Review
    apps/desktop/src/renderer/components/activity/ActivityDetailSheet.tsx:1
    @@ -76,7 +76,10 @@ export function ActivityDetailSheet({
       const planPercent = planTotal > 0 ? Math.round((planCompleted / planTotal) * 100) : 0;
       const dismissActionId = `dismiss:${item.id}`;
       // A deleted ADE Cloud computer is not offline: it is gone, and its chat opens from the saved copy.
    -  const deletedComputers = useDeletedCloudComputers(item.machine.online ? [] : [item.machine.accountMachineKey]);
    +  const deletedComputers = useDeletedCloudComputers(item.machine.online ? [] : [{
    +    machineKey: item.machine.accountMachineKey,
    +    chatId: item.destination.kind === "session" ? item.destination.sessionId : null,
    +  }]);

    Moved computer shown as deleted

    Medium Severity

    <!-- DESCRIPTION START -->
    The detail sheet now passes a chatId into useDeletedCloudComputers, so a chat that moved to a new computer is classified as deleted. It still has no cloudComputerMovedTo branch, so the banner says the computer was deleted and the chat is only a saved copy. The Activity list already says that computer was replaced and the chats moved.
    <!-- DESCRIPTION END -->

    <!-- BUGBOT_BUG_ID: 04a3618e-f302-4721-91ed-6c1bbda276e4 -->

    <!-- LOCATIONS START
    apps/desktop/src/renderer/components/activity/ActivityDetailSheet.tsx#L78-L204
    apps/desktop/src/renderer/components/activity/ActivityDetailSheet.tsx#L257-L262
    LOCATIONS END -->
    <details>
    <summary>Additional Locations (1)</summary>

  • apps/desktop/src/renderer/components/activity/ActivityDetailSheet.tsx#L257-L262
  • </details>

    <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmFhYThjYWNiLTcyZDktNDRhMC1hYjBjLTg3ZDczNGU4NjM2ZiIsImVuY3J5cHRpb25LZXkiOiJ0NFJydlJuWnBZdzFHNldrWThOOXFGRkw1b0Z4OXZRUzV5ME9fcUp2d2dNIiwiYnJhbmNoIjoiYWRlL3ByaWNpbmctdjMtYmF0Y2gzIiwicmVwb093bmVyIjoiYXJ1bDI4IiwicmVwb05hbWUiOiJEQUVYIiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmFhYThjYWNiLTcyZDktNDRhMC1hYjBjLTg3ZDczNGU4NjM2ZiIsImVuY3J5cHRpb25LZXkiOiJ0NFJydlJuWnBZdzFHNldrWThOOXFGRkw1b0Z4OXZRUzV5ME9fcUp2d2dNIiwiYnJhbmNoIjoiYWRlL3ByaWNpbmctdjMtYmF0Y2gzIiwicmVwb093bmVyIjoiYXJ1bDI4IiwicmVwb05hbWUiOiJEQUVYIiwicHJOdW1iZXIiOjI3MjEsImNvbW1pdFNoYSI6IjQ2ZDcxMGU3YTZlZmM5YTc5ZDg0YzJmYzk3MTI2NjM0MDE3NDNhMzkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>

    <sup>Reviewed by Cursor Bugbot for commit 46d710e7a6efc9a79d84c2fc9712663401743a39. Configure here.</sup>

    cursor[bot] cursor[bot] commented on Nov 29, 2026 04:53 UTC
    Reviewer

    <!-- BUGBOT_REVIEW -->
    Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

    <!-- BUGBOT_FIX_ALL -->
    <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo3MWMxMThlOC0xNjNkLTQ2ZTUtODAzMi04NmU4MzZjMTY3NGEiLCJlbmNyeXB0aW9uS2V5IjoiTnVleWtsUGpQOEZaVElwNzdaMlhOSDdWemdVb2R6YV9VY29Ua0x5SXFNQSIsImJyYW5jaCI6ImFkZS9wcmljaW5nLXYzLWJhdGNoMyIsInJlcG9Pd25lciI6ImFydWwyOCIsInJlcG9OYW1lIjoiREFFWCIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
    <!-- /BUGBOT_FIX_ALL -->

    <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN -->
    <sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.</sup>
    <!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END -->

    _Comment @cursor review or bugbot run to trigger another review on this PR_

    <sup>Reviewed by Cursor Bugbot for commit 46d710e7a6efc9a79d84c2fc9712663401743a39. Configure here.</sup>

    Assignees
    arul28 arul28
    Labels
    risk: medium confidence: 39.6% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 71.5% (HIGH) · Higher = larger blast radius
    71.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 39.6% · Lower = rushed or shallow review
    39.6%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 43.2% · Moderate risk
    43.2%
    Repository