Repository navigation
Let automations run in Chat - #34332
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 4

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f1b7a1b1-0258-4d7f-a201-b8104b7994bc
Files selected for processing: 73-
src/main/automations/automation-chat-session-reuse.tssrc/main/automations/automation-dispatch-host-fence.test.tssrc/main/automations/automation-dispatch-request.tssrc/main/automations/automation-run-operation.tssrc/main/automations/automation-run-receipt.tssrc/main/automations/automation-worker-durability.test.tssrc/main/automations/dispatch-refusal.tssrc/main/automations/headless-automation-agent-launch.test.tssrc/main/automations/headless-automation-agent-launch.tssrc/main/automations/headless-dispatch-durability.test.tssrc/main/automations/headless-dispatch-runner.tssrc/main/automations/headless-dispatch.tssrc/main/automations/headless-workspace-create.test.tssrc/main/automations/headless-workspace-create.tssrc/main/automations/run-completion-watcher.test.tssrc/main/automations/run-completion-watcher.tssrc/main/automations/runtime-automation-service.test.tssrc/main/automations/runtime-automation-service.tssrc/main/automations/runtime-chat-run-observer.test.tssrc/main/automations/runtime-chat-run-observer.tssrc/main/automations/service.test.tssrc/main/automations/service.tssrc/main/persistence/applying-settings/persistence-automation-extra-agent-args.test.tssrc/main/persistence/applying-settings/persistence-legacy-automation-twin-host.test.tssrc/main/persistence/scheduling-automations/automation-definition-operations.tssrc/main/persistence/scheduling-automations/automation-run-operations.tssrc/main/runtime/rpc/methods/agent-launch-surfaces.tssrc/main/runtime/rpc/methods/agent-launch-worktree-creation.tssrc/main/runtime/rpc/methods/agent-launch.test.tssrc/main/runtime/rpc/methods/agent-launch.tssrc/main/runtime/runtime-automation-controller.tssrc/renderer/src/components/automations/AutomationEditorDialog.tsxsrc/renderer/src/components/automations/AutomationEditorSettingsSidebar.test.tsxsrc/renderer/src/components/automations/AutomationEditorSettingsSidebar.tsxsrc/renderer/src/components/automations/AutomationSurfaceField.test.tsxsrc/renderer/src/components/automations/AutomationSurfaceField.tsxsrc/renderer/src/components/automations/automation-capability-probe.tssrc/renderer/src/components/automations/automation-draft-model.tssrc/renderer/src/components/automations/automation-edit-draft.tssrc/renderer/src/components/automations/automation-extra-agent-args-capability.test.tssrc/renderer/src/components/automations/automation-host-client.tssrc/renderer/src/components/automations/automation-launch-surface.tssrc/renderer/src/components/automations/automation-orca-save.tssrc/renderer/src/components/automations/automation-run-view-state.test.tssrc/renderer/src/components/automations/automation-run-view-state.tssrc/renderer/src/components/automations/automation-run-workspace-action.paired-server.test.tssrc/renderer/src/components/automations/automation-run-workspace-action.tssrc/renderer/src/components/automations/automation-save-action.tssrc/renderer/src/components/automations/automation-scoped-list-client.tssrc/renderer/src/components/automations/automations-page-test-harness.tsxsrc/renderer/src/hooks/automation-dispatch-completion.tssrc/renderer/src/hooks/automation-dispatch-handler.tssrc/renderer/src/hooks/automation-dispatch-observer-test-probe.tssrc/renderer/src/hooks/automation-dispatch-unverifiable-loss.test.tssrc/renderer/src/hooks/automation-dispatch-workspace.tssrc/renderer/src/hooks/useAutomationDispatchEvents.test.tssrc/renderer/src/hooks/useAutomationDispatchEvents.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/pt.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/automation-extra-agent-args-record.tssrc/shared/automation-launch-setup.tssrc/shared/automation-runtime-capabilities.tssrc/shared/automations-types.tssrc/shared/orcad-migration/orcad-migration-dormant-automation-validation.tssrc/shared/orcad-migration/orcad-migration-manifest.test.tssrc/shared/protocol-version.tssrc/shared/rpc-contract/automation-params-extra-agent-args.test.tssrc/shared/rpc-contract/automation-params.ts
Files with no reviewable changes: 7-
- src/renderer/src/hooks/automation-dispatch-completion.ts
- src/renderer/src/hooks/useAutomationDispatchEvents.ts
- src/renderer/src/hooks/automation-dispatch-unverifiable-loss.test.ts
- src/renderer/src/hooks/automation-dispatch-handler.ts
- src/renderer/src/hooks/automation-dispatch-workspace.ts
- src/main/automations/headless-workspace-create.ts
- src/renderer/src/hooks/automation-dispatch-observer-test-probe.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
-
There was a problem hiding this comment.
Actionable comments posted: 9
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Critical · Read run.automationId into a constant before the… · runtime-automation-service.ts:69-73
src/main/automations/runtime-automation-service.ts:69-73
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winRead
run.automationIdinto a constant before thefindcallbacks. The typecheck fails on lines 71 and 129.
runis alet. Line 102 assigns it after these closures are created. For this reason, TypeScript does not keep therun &&narrowing inside thefindcallbacks. CI reports TS18048 on lines 71 and 129, so the packaged build cannot compile. Look up the automation outside the callback with aconst.Proposed fix
let run = options.run let originalHandle: string | undefined if (run && (handle.startsWith('automation:') || run.sessionKind !== 'chat')) { + const automationId = run.automationId + const agentId = store.listAutomations().find((entry) => entry.id === automationId)?.agentId if (!run.chatSessionId) { ... - const agent = - tuiAgentDisplayName( - store.listAutomations().find((entry) => entry.id === run.automationId)?.agentId ?? - 'Agent' - ) ?? 'Agent' + const agent = tuiAgentDisplayName(agentId ?? 'Agent') ?? 'Agent' ... } if (run.sessionKind === 'chat') { ... - const agent = - tuiAgentDisplayName( - store.listAutomations().find((entry) => entry.id === run.automationId)?.agentId ?? - '' - ) ?? 'The agent' + const agent = tuiAgentDisplayName(agentId ?? '') ?? 'The agent'Also applies to: 127-131
Source: Pipeline failures

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
56a4eff3-569a-4d14-9a54-7ce7bf186396
Files selected for processing: 61-
src/main/automations/automation-run-receipt.tssrc/main/automations/desktop-run-terminal-lifecycle.tssrc/main/automations/desktop-run-terminal-stop.tssrc/main/automations/headless-automation-agent-launch.test.tssrc/main/automations/headless-automation-agent-launch.tssrc/main/automations/headless-dispatch-runner.tssrc/main/automations/headless-dispatch.tssrc/main/automations/precheck-runner.tssrc/main/automations/runtime-automation-service.test.tssrc/main/automations/runtime-automation-service.tssrc/main/automations/runtime-chat-run-observer.test.tssrc/main/automations/runtime-chat-run-observer.tssrc/main/automations/service-lifecycle.test.tssrc/main/automations/service.tssrc/main/daemon/daemon-pty-adapter-history-shutdown-admission.test.tssrc/main/daemon/daemon-pty-session-control.tssrc/main/daemon/daemon-pty-session-liveness.tssrc/main/ipc/pty/provider/shutdown-detect.tssrc/main/ipc/pty/runtime/controller-deps.tssrc/main/ipc/pty/runtime/kill.tssrc/main/native-chat/agent-session-wire/agent-session-subscriber-catch-up.tssrc/main/native-chat/agent-session-wire/structured-agent-session-actionable-prompts.tssrc/main/native-chat/agent-session-wire/structured-agent-session-background-task-channel.tssrc/main/native-chat/agent-session-wire/structured-agent-session-current-work.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-current-work.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host.tssrc/main/providers/local-pty-provider.tssrc/main/providers/local-pty-termination.tssrc/main/providers/pty-provider-contract.tssrc/main/pty-descendant-snapshot.tssrc/main/pty-descendant-stop-authorization.test.tssrc/main/pty-descendant-termination.tssrc/main/runtime/rpc/methods/agent-launch-replay.tssrc/main/runtime/rpc/methods/agent-launch-surfaces.tssrc/main/runtime/rpc/methods/agent-launch-target-authorization.tssrc/main/runtime/rpc/methods/agent-launch-worktree-creation.tssrc/main/runtime/rpc/methods/agent-launch.test.tssrc/main/runtime/rpc/methods/agent-launch.tssrc/main/runtime/runtime-pty-controller-contract.tssrc/main/runtime/terminal/stop/worktree-terminal-stop-targets.tssrc/main/window/runtime-window-lifecycle.tssrc/main/window/terminal-tab-close-request-relay.tssrc/preload/api/automation-api.tssrc/preload/api/automations-bridge.tssrc/renderer/src/components/automations/automation-run-workspace-action.paired-server.test.tssrc/renderer/src/hooks/ipc-events/terminal-presentation-ipc-bridge.tssrc/renderer/src/hooks/ipc-events/terminal-presentation-pane-title.test.tssrc/renderer/src/hooks/ipc-events/terminal-tab-mount-ipc-bridge.tssrc/renderer/src/lib/adopt-agent-background-session-tab.tssrc/renderer/src/lib/agent-background-session-contract.tssrc/renderer/src/lib/automation-terminal-ownership.test.tssrc/renderer/src/lib/automation-terminal-ownership.tssrc/renderer/src/lib/launch-agent-background-session-extra-args.test.tssrc/renderer/src/lib/launch-agent-background-session-launch-parity.test.tssrc/renderer/src/lib/launch-agent-background-session-remote.test.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-background-session.tssrc/renderer/src/store/terminals/terminal-actions.tssrc/renderer/src/store/terminals/terminal-pane-hibernation-commit.tssrc/renderer/src/store/terminals/terminal-pane-hibernation.tssrc/shared/automation-terminal-lifecycle.ts
Files with no reviewable changes: 7-
- src/renderer/src/lib/launch-agent-background-session-launch-parity.test.ts
- src/renderer/src/lib/launch-agent-background-session-remote.test.ts
- src/renderer/src/lib/agent-background-session-contract.ts
- src/renderer/src/lib/launch-agent-background-session-extra-args.test.ts
- src/renderer/src/lib/launch-agent-background-session.ts
- src/renderer/src/lib/launch-agent-background-session.test.ts
- src/renderer/src/lib/adopt-agent-background-session-tab.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
-
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
9b12a9d2-a7ea-4424-83ef-62c7d30d28a2
Files selected for processing: 17-
src/main/automations/automation-agent-run-result.tssrc/main/automations/automation-chat-session-reuse.tssrc/main/automations/desktop-run-terminal-lifecycle.tssrc/main/automations/headless-automation-agent-launch.test.tssrc/main/automations/headless-automation-agent-launch.tssrc/main/automations/runtime-chat-run-observer.test.tssrc/main/automations/runtime-chat-run-observer.tssrc/main/native-chat/agent-session-journal/journal-stop-marks.tssrc/main/native-chat/agent-session-journal/journal-store.tssrc/main/native-chat/agent-session-wire/structured-agent-session-client-delivery.tssrc/main/native-chat/agent-session-wire/structured-agent-session-conversations.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-conversations.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host.tssrc/main/native-chat/agent-session-wire/structured-agent-session-publication-wiring.tssrc/main/native-chat/agent-session-wire/structured-agent-session-subscribers.test.tssrc/renderer/src/lib/automation-terminal-ownership-test-harness.tssrc/renderer/src/lib/automation-terminal-ownership.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Major · Recheck the Windows target after stop authorization. · pty-descendant-termination.ts:128-129
src/main/pty-descendant-termination.ts:128-129
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftRecheck the Windows target after stop authorization.
If the original process exits while
authorizeStop()awaits a reply, its PID can be reused. The cachedpreparedTarget === 'own'can then authorizekillWindowsTree(rootPid)against a different process when owned-job termination is unavailable. Keep the preparation before the veto, but perform a fresh identity check after authorization and before the PID-based kill. The identity check proves ancestry only for the process observed at check time. (raw.githubusercontent.com)

Major · Continue observing pre-upgrade Terminal runs without a… · runtime-automation-service.ts:71-83
src/main/automations/runtime-automation-service.ts:71-83
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftContinue observing pre-upgrade Terminal runs without a launch receipt.
If a dispatched Terminal run predates this launch path,
readAutomationRunReceiptfinds no operation row. This branch marks the rundispatch_failedeven when its recorded pane still resolves to a live terminal. Keep receipt-based recovery for runs launched through the new path, but let legacy dispatched runs use their recorded terminal identity and the terminal observer. The retained-run watcher explicitly reattaches dispatched runs after restart. (raw.githubusercontent.com) As per coding guidelines, “Clients and servers update independently; preserve compatibility across mixed versions.”Source: Coding guidelines

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2bd2e5a7-e648-4b79-964b-4ecb1d8ea873
Files selected for processing: 11-
config/flaky-test-pattern-baseline.txtconfig/scripts/orcad-entry-build.test.mjssrc/main/automations/runtime-automation-service-retention.test.tssrc/main/automations/runtime-automation-service.test.tssrc/main/automations/runtime-automation-service.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host.tssrc/main/native-chat/agent-session-wire/structured-agent-session-workspace-sleep.tssrc/main/pty-descendant-snapshot.tssrc/main/pty-descendant-termination.tssrc/main/startup/main-process-automations.tssrc/renderer/src/lib/automation-terminal-ownership.test.ts
Files with no reviewable changes: 1-
- config/flaky-test-pattern-baseline.txt
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
-
[High impact] The reviewed changes appear safe to merge; both numbered previous findings are addressed. SummaryAdds explicit Chat automations while keeping saved automations without a surface on Terminal.
|
|
Automations previously opened Terminal sessions. This PR adds Chat runs, records output from the exact accepted turn, and opens the recorded Chat from Run Details. Existing saved automations remain Terminal. Busy Chat reuse uses the ordinary queue, and Run Details and History share the same existing-record opener. The full review is complete on QA by flow:
Known limits stay explicit: in-flight close retraction is deferred, tracked in #27583; fully settled close is the passing boundary. Mounted Runs freshness is deferred, tracked in #31375. Old paired servers remain Terminal; old desktops cannot preserve Chat on host move; old phones show status/output without Chat opening. Startup census was not captured; instrumented timestamps are not performance measurements. Sanitized archive manifests are exact, with designated original raw/log omissions; no complete console-error census is claimed. Histories intentionally refused during the fixture; offline restoration supports durable preservation without a fresh readable-history claim. All owned copies/drivers stopped, exact originals restored, lead exited, slots released, five real-config hash pairs unchanged. Private ledger, bounded independent audits and original evidence are retained in For Brennan’s review: main/current form, Terminal and earlier fresh-reply comparisons are in the PR body. Current affected opener flows:
Judgment spots: saved/default surface and atomic launch setup, Chat launch through the shared host entrypoint, recorded Chat opening and unavailable feedback. |









Automations previously opened Terminal sessions. This adds Chat runs that retain output from their exact accepted turn and open the recorded Chat from Run Details. Busy Chat reuse uses its ordinary queue; restart recovery follows the accepted request without resubmitting it and reports an interrupted request truthfully.
Terminal automations retain integrated-main behavior. Only explicit Chat automations take the shared Chat launch/send path. An absent saved surface permanently means Terminal. The editor adds the approved Chat/Terminal choice, with the native default on the right and selected, and keeps the existing agent control and supplemental Terminal Arguments. The full picker is tracked in #35802.
Run Details and ordinary History share the existing-record opener: reveal the saved Chat on its owning host, apply its publication, then select that exact Chat. An unavailable Chat opens its workspace and keeps saved output in Run Details, without creating a replacement Chat or resending. The History wrapper preserves its navigation and refusal messages.
Full review is complete on
72fe71a8832d598c52b9e26c886ab5dcd0d2aa91: six historical rounds plus one expressly authorized reduced-cut round, with subsequent bounded fix/evidence checks. All 27 prescribed final cases and the normal commit hook passed. CI is green: 49 passed, 17 skipped. The first attempt hit an existing-main ACP fixture synchronization race; exactly one named failed-jobs-only retry passed. That P2/main/repeat test defect remains deferred, tracked in STA-12959.Real QA, with isolated profiles and real Claude/Codex agents:
973de2All owned apps/drivers stopped; the QA lead exited; tickets released; five real-config hash pairs unchanged. No cleanup-only launch. Ten saved runs/output and paused definitions were preserved. Histories intentionally refused during the unreadable-record fixture; durable journal preservation is established by offline restoration evidence, not a fresh readable-history comparison. Sanitized archives have exact archive-manifest hashes but omit designated raw/log entries from their original stage manifests; no complete console-error census is claimed. Startup census was not captured, and instrumented event times are identity/order evidence, not performance measurements.
Accepted compatibility limits:
Existing-main limitations remain deferred: mounted Runs history may need a genuine page reopen (tracked in #31375); an earlier close still in flight can retract a reopened Chat (tracked in #27583). Only fully settled closes are passing reopening evidence. Overlapping mobile/workspace work is tracked in #31617 and #31255; their behavior is preserved.
6ee27ef6; retained comparison)72fe71a8)Private production-component fixture: unknown support, Chat selected and both controls disabled. Presentation evidence only.
Earlier fresh-flow screenshots (
f4cec2b3, isolated profile upgraded from main6ee27ef6) illustrate carried execution evidence; they are not current closed-Chat acceptance.