Skip to content

Reconcile Claude scheduled-work ownership and cancellation#811

Merged
arul28 merged 8 commits into
mainfrom
ade/start-skill-am-working-another-85f7fc90
Jul 14, 2026
Merged

Reconcile Claude scheduled-work ownership and cancellation#811
arul28 merged 8 commits into
mainfrom
ade/start-skill-am-working-another-85f7fc90

Conversation

@arul28

@arul28 arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • align ADE scheduled-work ownership with Claude Agent SDK session semantics
  • quarantine or tombstone work when provider sessions roll over or become unreachable
  • add lifecycle cleanup, deduplication, TTL/GC, and provider-confirmed cancellation
  • expose list/cancel management in desktop Settings, Chat Info, CLI, TUI, sync, and iOS

Verification

  • quality gate: 0 Blocker / 0 High
  • desktop affected tests: 1,038 passing
  • ADE CLI: 1,745 passing
  • TUI: 875 passing
  • iOS: simulator build + 4 focused XCTest cases
  • docs validation: 190 files

Open in ADE

Summary by CodeRabbit

  • New Features
    • Added ade chat scheduled-work CLI commands to list durable scheduled jobs and cancel a job.
    • Added scheduled-work listing and cancellation to Desktop and iOS Chat Info (“Active scheduled work”) with per-item cancel controls and provider confirmation.
    • Exposed scheduled-work list/cancel APIs across Agent Chat and remote/IPC layers.
  • Bug Fixes
    • Improved scheduled-work reconciliation so managed durable jobs replace stale transcript entries and keep correct cancellable/pause/cancel state across session changes and restarts.
  • Documentation
    • Updated ade chat help text to include scheduled-work list/cancel commands.

Greptile Summary

This PR adds durable scheduled-work management across Claude-backed ADE chats. The main changes are:

  • Claude schedule ownership reconciliation across provider session changes.
  • Durable scheduled-work listing and cancellation APIs.
  • Desktop, CLI, TUI, sync, and iOS controls for active scheduled work.
  • Transcript and managed-state merging for scheduled-work displays.
  • Documentation and tests for the new scheduled-work flows.

Confidence Score: 5/5

This looks safe to merge.

No blocking issues found in the changed code.

T-Rex T-Rex Logs

What T-Rex did

  • Executed a focused test run for scheduled-work tests, which completed with 1 passing test for the list/cancel scenario.
  • Tried to capture the UI visually with Playwright/Vite, but the run was blocked by Port 5175 being in use and connections being refused after retries.
  • Generated repository-backed harness files (TSX and HTML) for the visual capture workflow, which import the real changed component rather than a standalone mock.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
apps/desktop/src/main/services/chat/agentChatService.ts Adds Claude schedule ownership tracking, provider-confirmed cancellation paths, and scheduled-work list/cancel APIs.
apps/ade-cli/src/adeRpcServer.ts Scopes scheduled-work list and cancel ADE actions through the bound chat access checks.
apps/desktop/src/shared/chatScheduledWork.ts Merges managed scheduled-work rows with transcript snapshots while preserving recovery behavior for empty managed state.
apps/ios/ADE/Views/Work/WorkTimelineHelpers.swift Matches desktop scheduled-work merge behavior for iOS timeline rendering.

Comments Outside Diff (2)

  1. General comment

    P1 Continuity recovery no longer includes gzipped transcript content in the recovery capsule

    • Bug
      • The focused desktop suite fails src/main/services/chat/agentChatService.test.ts > explicit provider-thread continuity recovery > decompresses a gzipped transcript when building the recovery capsule. The test creates only a .gz transcript containing Compressed original task, runs recoverContinuity({ mode: "recover_from_history" }), and expects the returned capsulePreview to include that original task. Instead the capsule preview omits it, so recovery from compressed history can lose the original task context.
    • Cause
      • The changed agentChatService continuity recovery path appears not to read/decompress the .gz transcript when building the recovery capsule, or otherwise drops the decompressed user message before constructing capsulePreview.
    • Fix
      • Update the recovery capsule construction path to fall back to the gzipped transcript when the plain transcript is absent, parse the decompressed transcript events, and include the original user task/history in capsulePreview; keep the existing test passing as regression coverage.

    T-Rex Ran code and verified through T-Rex

  2. General comment

    P1 ADE RPC spawn_agent no longer supplies command/args to PTY create when executable resolution is absent

    • Bug
      • The focused ADE CLI validation fails four adeRpcServer.test.ts spawn_agent tests. In each failure, runtime.ptyService.create is called without the expected concrete command and args fields for Claude/Codex launches, leaving only startupCommand plus env/metadata. This contradicts the PR verification claim that ADE CLI tests pass and weakens the runtime PTY launch contract these tests cover: spawn_agent callers/tests expect the launch executable and permission/model flags to be passed structurally, not only embedded in a preview string.
    • Cause
      • In apps/ade-cli/src/adeRpcServer.ts, the spawn_agent path conditionally spreads { command: providerExecutable, args: commandArgs } only when resolveExecutableOnPath(provider) returns a path. When resolution returns null in the test/runtime environment, the PTY create payload omits both command and args, even though startupCommand still contains the intended provider and flags.
    • Fix
      • Always provide a deterministic launch command/args to runtime.ptyService.create for spawn_agent, falling back to the provider name when path resolution fails, or otherwise update the PTY service contract/tests intentionally if startupCommand-only launch is now supported. Preserve structured args for Claude/Codex permission/model flags so PTY launch and management plumbing can inspect them reliably.

    T-Rex Ran code and verified through T-Rex

Reviews (7): Last reviewed commit: "fix: preserve chat lifecycle recovery" | Re-trigger Greptile

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Jul 14, 2026 12:03pm

@arul28 arul28 changed the title orphaned-scheduled-work-prompts -> Primary Fix orphaned Claude scheduled-work prompts Jul 14, 2026
@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@copilot review but do not make fixes

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Durable scheduled work now has persisted lifecycle metadata, Claude provider-session ownership, expiration and quarantine handling, shared snapshot reconciliation, cancellation APIs, CLI and remote commands, and desktop/iOS management controls. Tests cover scheduler migration, provider hooks, authorization, compatibility gating, cancellation, and UI behavior.

Changes

Scheduler lifecycle and provider integration

Layer / File(s) Summary
Durable scheduler state and Claude lifecycle
apps/desktop/src/main/services/chat/chatScheduledWorkScheduler.ts, apps/desktop/src/main/services/chat/agentChatService.ts, apps/desktop/src/main/services/ai/tools/*
Schedules persist durability, provider ownership, expiration, terminal history, pause state, and provider-confirmed cancellation; Claude hook handling reconciles wakeups and cron jobs across provider sessions.
Lifecycle and migration validation
apps/desktop/src/main/services/chat/*test.ts
Tests cover persisted-state migration, quarantine, expiry, provider hook payloads, session recovery, cancellation, and disposal behavior.

Cross-platform APIs and commands

Layer / File(s) Summary
Shared contracts and desktop bridges
apps/desktop/src/shared/types/*, apps/desktop/src/shared/ipc.ts, apps/desktop/src/preload/*, apps/desktop/src/main/services/ipc/*
Scheduled-work models, IPC channels, preload methods, ADE actions, and main-process handlers expose listing and cancellation.
CLI and remote command routing
apps/ade-cli/src/*, apps/desktop/src/main/services/sync/*
CLI list/cancel commands, aliases, scoped ADE dispatch, and non-queueable remote cancellation are implemented and tested.
iOS synchronization and compatibility
apps/ios/ADE/Models/*, apps/ios/ADE/Services/*, apps/ios/ADETests/*
iOS models and sync APIs support cancellation with host capability gating and session-scoped command routing.

Snapshot reconciliation and management UI

Layer / File(s) Summary
Managed snapshot reconciliation
apps/desktop/src/shared/chatScheduledWork.ts, apps/ios/ADE/Views/Work/WorkTimelineHelpers.swift, apps/desktop/src/shared/chatScheduledWork.test.ts
Transcript-derived snapshots are merged with managed durable schedules, preserving authoritative status, identity, metadata, and cancellability.
Desktop cancellation controls
apps/desktop/src/renderer/components/chat/*, apps/desktop/src/renderer/components/settings/*
Chat and Settings surfaces display active scheduled work and provide cancellation controls for cancellable items.
iOS cancellation controls
apps/ios/ADE/Views/Work/*
Chat Info displays active cancellable schedules, tracks cancellation progress, updates managed summaries, and refreshes rendered snapshots.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

  • arul28/ADE#676: Extends the same ADE chat-action authorization and scoping flow.
  • arul28/ADE#721: Provides related scheduled-work snapshot groundwork used by the reconciliation changes.

Suggested labels: desktop, ios, docs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.13% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: reconciling Claude scheduled-work ownership and cancellation.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/start-skill-am-working-another-85f7fc90

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread apps/desktop/src/main/services/chat/agentChatService.ts Outdated
Comment thread apps/desktop/src/main/services/adeActions/registry.ts
Comment thread apps/desktop/src/shared/chatScheduledWork.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 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/ade-cli/src/cli.ts`:
- Around line 6447-6450: Update the scheduledWorkOperation condition to
recognize the same schedule aliases handled by the dispatch block:
“scheduled-work”, “schedules”, and “schedule”. Preserve the existing list/cancel
checks and ensure these aliases identify the operation before the sessionId
resolver processes positional arguments.

In `@apps/desktop/src/main/services/adeActions/registry.ts`:
- Around line 1372-1383: Update the listScheduledWork adapter to pass an empty
object fallback to readObjectActionArg when args is undefined, while preserving
the existing sessionId and includeTerminal handling.

In `@apps/desktop/src/main/services/chat/chatScheduledWorkScheduler.ts`:
- Around line 298-306: Update the inactive-session cancellation branches in both
processDue and reconcileSchedule to invoke pruneTerminalHistory() immediately
after markTerminal, including when quarantineInactiveProviderSchedule does not
mark the schedule terminal. Preserve the existing timer cleanup, persistence,
transition emission, and return flow.

In `@apps/desktop/src/preload/preload.ts`:
- Around line 5485-5506: Update the callProjectRuntimeActionOr invocations in
listScheduledWork and cancelScheduledWork to pass args directly instead of
wrapping them as { args }, while preserving the existing IPC fallback calls and
cache-clearing behavior.

In `@apps/desktop/src/renderer/components/settings/AiFeaturesSection.tsx`:
- Around line 430-436: The scheduled-work Cancel button in AiFeaturesSection
must be disabled when item.cancellable is false; update the button rendering
while preserving handleCancelScheduledWork for cancellable items. In
apps/desktop/src/renderer/components/settings/AiFeaturesSection.test.tsx lines
164-173, add cancellable: true to the mocked scheduled work item so the test can
click the enabled button.

In `@apps/desktop/src/shared/types/sync.ts`:
- Line 1030: Add "chat.listScheduledWork" to the SyncRemoteCommandAction union
alongside the existing chat scheduling actions, preserving the union’s type
contract for the remote action exposed by callProjectRuntimeActionOr.
🪄 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: 4737df37-534b-40f9-8519-cec5c1698d72

📥 Commits

Reviewing files that changed from the base of the PR and between 958592d and 865251f.

⛔ Files ignored due to path filters (5)
  • docs/ARCHITECTURE.md is excluded by !docs/**
  • docs/features/agents/README.md is excluded by !docs/**
  • docs/features/chat/README.md is excluded by !docs/**
  • docs/features/onboarding-and-settings/README.md is excluded by !docs/**
  • docs/features/sync-and-multi-device/ios-companion.md is excluded by !docs/**
📒 Files selected for processing (40)
  • apps/ade-cli/README.md
  • apps/ade-cli/src/adeRpcServer.test.ts
  • apps/ade-cli/src/cli.test.ts
  • apps/ade-cli/src/cli.ts
  • apps/ade-cli/src/services/sync/syncRemoteCommandService.test.ts
  • apps/ade-cli/src/services/sync/syncRemoteCommandService.ts
  • apps/ade-cli/src/tuiClient/__tests__/appPolling.test.tsx
  • apps/ade-cli/src/tuiClient/__tests__/chatInfo.test.ts
  • apps/ade-cli/src/tuiClient/chatInfo.ts
  • apps/desktop/src/main/services/adeActions/registry.ts
  • apps/desktop/src/main/services/ai/tools/systemPrompt.test.ts
  • apps/desktop/src/main/services/ai/tools/systemPrompt.ts
  • apps/desktop/src/main/services/chat/agentChatService.test.ts
  • apps/desktop/src/main/services/chat/agentChatService.ts
  • apps/desktop/src/main/services/chat/chatScheduledWorkScheduler.test.ts
  • apps/desktop/src/main/services/chat/chatScheduledWorkScheduler.ts
  • apps/desktop/src/main/services/ipc/registerIpc.ts
  • apps/desktop/src/main/services/sync/syncRemoteCommandService.test.ts
  • apps/desktop/src/main/services/usage/usageStatsStore.ts
  • apps/desktop/src/main/services/usage/usageTrackingService.test.ts
  • apps/desktop/src/preload/global.d.ts
  • apps/desktop/src/preload/preload.ts
  • apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
  • apps/desktop/src/renderer/components/chat/ChatSubagentsPanel.test.tsx
  • apps/desktop/src/renderer/components/chat/ChatSubagentsPanel.tsx
  • apps/desktop/src/renderer/components/chat/chatExecutionSummary.ts
  • apps/desktop/src/renderer/components/settings/AiFeaturesSection.test.tsx
  • apps/desktop/src/renderer/components/settings/AiFeaturesSection.tsx
  • apps/desktop/src/shared/chatScheduledWork.test.ts
  • apps/desktop/src/shared/chatScheduledWork.ts
  • apps/desktop/src/shared/ipc.ts
  • apps/desktop/src/shared/types/chat.ts
  • apps/desktop/src/shared/types/sync.ts
  • apps/ios/ADE/Models/RemoteModels.swift
  • apps/ios/ADE/Services/SyncService.swift
  • apps/ios/ADE/Views/Work/WorkChatRichCardViews.swift
  • apps/ios/ADE/Views/Work/WorkModels.swift
  • apps/ios/ADE/Views/Work/WorkSessionDestinationView.swift
  • apps/ios/ADE/Views/Work/WorkTimelineHelpers.swift
  • apps/ios/ADETests/ADETests.swift

Comment thread apps/ade-cli/src/cli.ts Outdated
Comment thread apps/desktop/src/main/services/adeActions/registry.ts
Comment thread apps/desktop/src/main/services/chat/chatScheduledWorkScheduler.ts
Comment thread apps/desktop/src/preload/preload.ts
Comment thread apps/desktop/src/renderer/components/settings/AiFeaturesSection.tsx
Comment thread apps/desktop/src/shared/types/sync.ts
@arul28 arul28 changed the title Fix orphaned Claude scheduled-work prompts Reconcile Claude scheduled-work ownership and cancellation Jul 14, 2026
@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 317fd82ac8

ℹ️ 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".

Comment thread apps/desktop/src/main/services/adeActions/registry.ts
Comment thread apps/ade-cli/src/services/sync/syncRemoteCommandService.ts
Comment thread apps/ios/ADE/Views/Work/WorkTimelineHelpers.swift
@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop/src/main/services/chat/agentChatService.ts (1)

33480-33483: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Enforce chat session scoping for schedule cancellation.

cancelScheduledWork is exposed via IPC but does not verify that the target chat session exists or is valid. This allows remote clients to invoke cancellation without proper chat scoping (as noted in the PR objectives).

Add the same sessionService check here that is already used in setScheduledWorkPaused and listScheduledWork to ensure proper authorization and state validation. As per path instructions, we must check for IPC security.

🔒️ Proposed fix to add session scoping
     await scheduledWorkReady;
+    const row = sessionService.get(normalizedSessionId);
+    if (!row || !isChatToolType(row.toolType)) {
+      throw new Error(`Chat session '${normalizedSessionId}' was not found.`);
+    }
     if (!scheduledWorkScheduler) {
🤖 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/main/services/chat/agentChatService.ts` around lines 33480 -
33483, Update cancelScheduledWork to perform the same sessionService
chat-session validation used by setScheduledWorkPaused and listScheduledWork
before cancelling scheduled work; preserve the existing scheduler availability
check and ensure invalid or unauthorized sessions are rejected through the
established IPC security path.

Source: Path instructions

🤖 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.

Outside diff comments:
In `@apps/desktop/src/main/services/chat/agentChatService.ts`:
- Around line 33480-33483: Update cancelScheduledWork to perform the same
sessionService chat-session validation used by setScheduledWorkPaused and
listScheduledWork before cancelling scheduled work; preserve the existing
scheduler availability check and ensure invalid or unauthorized sessions are
rejected through the established IPC security path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f9afd008-b44f-4f4b-a692-2c9e0e1773d7

📥 Commits

Reviewing files that changed from the base of the PR and between 865251f and c5bf448.

📒 Files selected for processing (15)
  • apps/ade-cli/src/adeRpcServer.test.ts
  • apps/ade-cli/src/adeRpcServer.ts
  • apps/ade-cli/src/cli.test.ts
  • apps/ade-cli/src/cli.ts
  • apps/desktop/src/main/services/adeActions/registry.ts
  • apps/desktop/src/main/services/chat/agentChatService.test.ts
  • apps/desktop/src/main/services/chat/agentChatService.ts
  • apps/desktop/src/main/services/chat/chatScheduledWorkScheduler.ts
  • apps/desktop/src/renderer/components/settings/AiFeaturesSection.test.tsx
  • apps/desktop/src/renderer/components/settings/AiFeaturesSection.tsx
  • apps/desktop/src/renderer/components/terminals/useWorkSessions.test.ts
  • apps/desktop/src/shared/chatScheduledWork.test.ts
  • apps/desktop/src/shared/chatScheduledWork.ts
  • apps/ios/ADE/Views/Work/WorkTimelineHelpers.swift
  • apps/ios/ADETests/ADETests.swift
🚧 Files skipped from review as they are similar to previous changes (10)
  • apps/desktop/src/shared/chatScheduledWork.test.ts
  • apps/ade-cli/src/adeRpcServer.test.ts
  • apps/ade-cli/src/cli.ts
  • apps/desktop/src/renderer/components/settings/AiFeaturesSection.tsx
  • apps/desktop/src/shared/chatScheduledWork.ts
  • apps/ios/ADE/Views/Work/WorkTimelineHelpers.swift
  • apps/desktop/src/main/services/adeActions/registry.ts
  • apps/ios/ADETests/ADETests.swift
  • apps/desktop/src/main/services/chat/agentChatService.test.ts
  • apps/desktop/src/main/services/chat/chatScheduledWorkScheduler.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5bf448edb

ℹ️ 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".

Comment thread apps/desktop/src/main/services/chat/agentChatService.ts Outdated
Comment thread apps/ios/ADE/Services/SyncService.swift
@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

CodeRabbit out-of-diff session-validation suggestion was not applied: authorization is enforced at the ADE RPC/sync boundaries, while the service intentionally allows an operator to tombstone scheduled-work rows whose chat record is already gone. Requiring a live session row would recreate the exact uncancellable-orphan failure this PR fixes; the orphan cleanup regression remains green.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef22b86486

ℹ️ 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".

Comment thread apps/ade-cli/src/adeRpcServer.ts
@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 670438443f

ℹ️ 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".

Comment thread apps/desktop/src/renderer/components/settings/AiFeaturesSection.tsx
Comment thread apps/desktop/src/main/services/chat/agentChatService.ts
Comment thread apps/desktop/src/main/services/chat/agentChatService.ts
@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d63897b953

ℹ️ 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".

Comment thread apps/desktop/src/main/services/chat/agentChatService.ts Outdated
@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop/src/main/services/chat/agentChatService.ts (1)

33443-33511: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

requestClaudeScheduledWorkCancellation can throw and block deleteSession/archiveSession.

messageSession({ kind: "wake", ... }) can throw (busy turn, full steer queue, pending-input guard), and when confirmedOwnerSchedules.length > 0 this rethrows unconditionally (line ~33465). Separately, the 30s confirmation poll throws "Claude did not confirm CronDelete within 30 seconds…" if Claude never runs the tool call in time (line ~33511). Both call sites — deleteSession (line 34965-34971) and archiveSession (line ~35050-35056) — call this with { awaitConfirmation: true } and no try/catch, so either failure mode aborts the entire delete/archive operation, leaving the chat un-deleted.

A user should always be able to delete/archive a chat regardless of whether the underlying agent is reachable. Consider catching the error at both call sites, logging a warning, and proceeding with deletion/archival (the orphaned schedule can still be reconciled later via the tombstone path already used for deleted-session rows).

🛡️ Proposed fix sketch
     await scheduledWorkReady;
     if (scheduledWorkScheduler) {
       const providerSchedules = scheduledWorkScheduler.list(trimmedSessionId).filter((schedule) =>
         schedule.provider === "claude"
         && schedule.status !== "done"
         && schedule.status !== "cancelled");
-      await requestClaudeScheduledWorkCancellation(providerSchedules, { awaitConfirmation: true });
+      try {
+        await requestClaudeScheduledWorkCancellation(providerSchedules, { awaitConfirmation: true });
+      } catch (error) {
+        logger.warn("agent_chat.scheduled_work_cancel_before_delete_failed", {
+          sessionId: trimmedSessionId,
+          error: error instanceof Error ? error.message : String(error),
+        });
+      }
     }

(apply the equivalent change in archiveSession)

🤖 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/main/services/chat/agentChatService.ts` around lines 33443 -
33511, Wrap the `{ awaitConfirmation: true }` calls to
`requestClaudeScheduledWorkCancellation` in both `deleteSession` and
`archiveSession` with error handling so failures from the wake request or
confirmation timeout are caught, logged as warnings with relevant error details,
and do not abort deletion or archival. Preserve the existing successful
cancellation behavior and allow the tombstone reconciliation path to handle any
orphaned schedules.
🤖 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.

Outside diff comments:
In `@apps/desktop/src/main/services/chat/agentChatService.ts`:
- Around line 33443-33511: Wrap the `{ awaitConfirmation: true }` calls to
`requestClaudeScheduledWorkCancellation` in both `deleteSession` and
`archiveSession` with error handling so failures from the wake request or
confirmation timeout are caught, logged as warnings with relevant error details,
and do not abort deletion or archival. Preserve the existing successful
cancellation behavior and allow the tombstone reconciliation path to handle any
orphaned schedules.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 01b20178-7fa1-445a-8f79-96afcc5d5708

📥 Commits

Reviewing files that changed from the base of the PR and between c5bf448 and d63897b.

📒 Files selected for processing (10)
  • apps/ade-cli/src/adeRpcServer.test.ts
  • apps/ade-cli/src/adeRpcServer.ts
  • apps/ade-cli/src/services/personalChats/personalChatScope.test.ts
  • apps/ade-cli/src/services/personalChats/personalChatScope.ts
  • apps/ade-cli/src/services/sync/syncRemoteCommandService.test.ts
  • apps/desktop/src/main/services/chat/agentChatService.test.ts
  • apps/desktop/src/main/services/chat/agentChatService.ts
  • apps/desktop/src/renderer/browserMock.ts
  • apps/desktop/src/shared/types/personalChats.ts
  • apps/ios/ADETests/ADETests.swift
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/ade-cli/src/adeRpcServer.test.ts
  • apps/ade-cli/src/adeRpcServer.ts

Comment thread apps/desktop/src/main/services/chat/agentChatService.ts
@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

Addressed CodeRabbit review 4693968581 in fb84223: deleteSession and archiveSession now catch/log provider cancellation wake or confirmation failures, then always honor the user lifecycle action and locally terminalize scheduled work. Added fake-timer regressions proving both operations complete after the 30-second provider timeout.

@arul28

arul28 commented Jul 14, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@arul28
arul28 merged commit 86bd006 into main Jul 14, 2026
33 checks passed
@arul28
arul28 deleted the ade/start-skill-am-working-another-85f7fc90 branch July 14, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant