Skip to content

perf(main): lazy-load automation launch, observation, and hook-review cleanup modules - #51244

Merged
nwparker merged 1 commit into
mainfrom
perf/lazy-automation-launch-and-observation
Nov 28, 2026
Merged

nwparker merged 1 commit into
mainfrom
perf/lazy-automation-launch-and-observation

Conversation

@nwparker

@nwparker nwparker commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Extracts runOwnHandle and createRuntimeRunTerminalRetention into terminal-retention/runtime-run-terminal-retention.ts (re-exporting runOwnHandle from automation-terminal-launch.ts) to keep runtime-automation-service.ts under 300 lines and sever the eager import of automation-terminal-launch.ts.
  • Dynamically imports publishedLaunchTarget, observeAutomationChatRun, closeEarlierHookReviewRunTerminals, launchAutomationChatAgent, launchAutomationTerminalAgent, and automationRunSetupSkip inside runtime-automation-service.ts's async dispatch/observation callbacks.
  • Prunes config/main-blocking-helper-baseline.txt (runtime-automation-service.ts: 2 → 0).

Performance

  • Evicts automation launch, chat observation, setup-skip, and hook-review cleanup modules from the eager Main boot graph until an automation run is actually dispatched or observed, with zero cold-open or runtime latency tradeoff.

Test plan

  • timeout 900 pnpm check:changed --base=origin/main — 38/38 checks passed.
Files Added Deleted Net
Test 0 0 0 0
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​128 $\color{#cf222e}{\Huge{\mathbf{−}}}$​113 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15

@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds runtime terminal-retention behavior in a dedicated module and re-exports runOwnHandle from the terminal launcher. The automation service removes its local retention implementation and dynamically imports selected launch, observation, setup-skip, launch-target, and hook-review cleanup modules. The blocking-helper baseline entry for the automation service is removed.

Merge Risk: Low · up to 7d95b

This change defers loading of automation launch and observation modules until an automation run is dispatched, which should reduce startup work. The remaining risk is small. If the service is stopped just as a dispatch is waiting for those modules to load, an agent could still be launched. Otherwise the refactor appears behavior-preserving, so it is mergeable with awareness of that window.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Description check Inconclusive The description follows the repository template and fills the ELI5, What Changed, Why, Performance, and Testing sections with specific content. It includes a Performance statement with a reason. It le… Add the following to the description: (1) a linked issue, replacing the blank 'Fixes #' line; (2) a Visual Proof entry, or 'N/A' with the reason that no UI or behavior change exists; (3) a Risk section with a Level value (Low, Medium, or Hi…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: lazy-loading automation launch, observation, and hook-review cleanup modules in the main process. The raw summary and objectives confirm that the runtime-automation-se…
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.
Full details: Title check

Explanation

The title names the main change: lazy-loading automation launch, observation, and hook-review cleanup modules in the main process. The raw summary and objectives confirm that the runtime-automation-service now uses dynamic imports for these modules, and the title uses the conventional perf(main) prefix. The title is slightly long at 85 characters, but it is specific and accurate.

Full details: Description check

Explanation

The description follows the repository template and fills the ELI5, What Changed, Why, Performance, and Testing sections with specific content. It includes a Performance statement with a reason. It leaves several required items incomplete. The Linked Issue section has a blank 'Fixes #'. The Visual Proof section has no N/A statement or BEFORE/AFTER evidence. The Risk section has no Level value and no rollback note. The Testing checklist is unchecked. The description also omits the ELI5 and Why sections as separate headings, and it has no AI Disclosure or Review content. The Performance line is complete ('None, because' is not finished in the text, but the body explains the tradeoff). Because the core sections are present but several required fields are missing, the check is inconclusive rather than a pass.

Resolution

Add the following to the description: (1) a linked issue, replacing the blank 'Fixes #' line; (2) a Visual Proof entry, or 'N/A' with the reason that no UI or behavior change exists; (3) a Risk section with a Level value (Low, Medium, or High), the riskiest part of the change, and the rollback method; (4) an ELI5 section in plain language; (5) a Why section that explains why this approach beats the alternatives; (6) completion of the Testing checklist items, or an explanation for any item left unchecked; (7) a Performance sentence that finishes the template line 'None, because' so it reads as a complete statement.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent 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: 88ae6b92-fa52-42f6-9cff-766658c7692c
Commits

Reviewing files that changed from the base of the PR and between 35eb7e7 and 7d95bea.

Files selected for processing: 4

  • config/main-blocking-helper-baseline.txt
  • src/main/automations/launch/automation-terminal-launch.ts
  • src/main/automations/runtime-automation-service.ts
  • src/main/automations/terminal-retention/runtime-run-terminal-retention.ts
Files with no reviewable changes: 1

  • config/main-blocking-helper-baseline.txt

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

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