Skip to content

feat(verify): run install in parallel with prompter, off the critical path#186

Merged
jacsamell merged 1 commit into
mainfrom
feat/install-parallel-with-prompter
May 19, 2026
Merged

feat(verify): run install in parallel with prompter, off the critical path#186
jacsamell merged 1 commit into
mainfrom
feat/install-parallel-with-prompter

Conversation

@jacsamell
Copy link
Copy Markdown
Contributor

@jacsamell jacsamell commented May 19, 2026

Splits verify gate into install (parallel with Phase 1 prompter) + check (post-writer, unchanged). Drops install cost off writer's critical path — saves ~1-2 min on v2 monorepo. Legacy cmd still honoured.

Paired v2 PR follows with the cube.yaml change.

Summary

This PR refactors the verify gate into a two-phase model, moving the installation phase off the writer's critical path to save 1–2 minutes on large monorepos.

Key Changes

Configuration (VerifyConfig)

  • Splits verify into separate install and check commands
  • Adds effective_check property for backwards compatibility with legacy cmd-only configs
  • Updated documentation clarifies opt-in behaviour: operators set both install and check to enable the split; legacy setups using only cmd continue working unchanged

Execution Model

  • Phase 1 (Prompter): Eagerly creates writer worktrees and starts install commands in parallel via run_install_async, which runs in a thread to avoid blocking the async prompter loop. Logs to .cube/verify-logs/<task>-install-<writer>.log with timeout handling (600s default)
  • Phase 2 (Writer): Waits for background install tasks to complete before launching the writer agent, logging warnings for non-zero exits or crashes. Post-commit check command runs the existing verify-and-repair loop unchanged
  • Install failures surface to the writer during its first tool call, allowing it to see the issue without re-running install

Plumbing

  • WorkflowContext gains install_tasks field to track background installs between phases
  • Helper functions: is_install_configured() detects if install is declared, run_install_async() executes installs in parallel
  • is_verify_configured() updated to check effective_check callable first
  • phase2_run_writers now drains install tasks before starting writers and uses config.verify.effective_check instead of raw cmd

Impact

Eliminates the install cost (typically 30s–2min per monorepo) from the writer's execution window, keeping node_modules warm without blocking feedback loops.

Review Change Stack

… path

verify gate split into install + check halves. install runs in each writer worktree IN PARALLEL with Phase 1 (prompter); check runs after the writer commits (unchanged). Drops install off the critical path — saves ~1-2 min wall-clock on monorepos like v2. Legacy 'cmd' still honoured.
@jacsamell jacsamell merged commit 065bac0 into main May 19, 2026
@jacsamell jacsamell deleted the feat/install-parallel-with-prompter branch May 19, 2026 22:53
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 356ac014-b642-424d-abec-3dc4612aa8fe

📥 Commits

Reviewing files that changed from the base of the PR and between a2b0ed5 and f887d2d.

📒 Files selected for processing (4)
  • python/cube/automation/verify.py
  • python/cube/commands/orchestrate/handlers.py
  • python/cube/commands/orchestrate/phases_registry.py
  • python/cube/core/user_config.py

Walkthrough

This PR enables concurrent dependency installation during workflow orchestration by extending the verify configuration with separate install and check commands, adding async installation execution helpers, and coordinating Phases 1 and 2 to overlap installation with prompt generation and defer writer execution until installations complete.

Changes

Parallel Dependency Installation Phase

Layer / File(s) Summary
Verify configuration schema and fallback logic
python/cube/core/user_config.py
VerifyConfig gains install and check fields; new effective_check property prefers check when set, otherwise falls back to cmd for legacy compatibility; config loader updated to parse both fields.
Install detection and async execution
python/cube/automation/verify.py
New is_install_configured detects non-empty install commands; run_install_async executes install commands concurrently via thread executor, captures output to .cube/verify-logs/<task>-install-<writer>.log, handles timeouts with exit code 124, and returns exit code without raising.
Verify gate detection logic
python/cube/automation/verify.py
Updated is_verify_configured to evaluate optional verify.effective_check callable, falling back to checking non-empty verify.check or verify.cmd strings.
Workflow context for install task tracking
python/cube/commands/orchestrate/phases_registry.py
Added install_tasks dict field to WorkflowContext to track background installation task futures keyed by writer key across Phase 1/2 lifecycle.
Phase 1/2 coordination for parallel installation
python/cube/commands/orchestrate/handlers.py
Phase 1 creates writer worktrees and starts run_install_async tasks concurrently, storing futures on ctx.install_tasks; Phase 2 awaits tasks before launching writers, logs warnings on non-zero exit or exceptions, and clears the task dict; verify command parameter switched from verify.cmd to verify.effective_check.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • aetheronhq/agent-cube#182: Extends deterministic verify gate by adding async verify.install phase and switching to verify.effective_check configuration selection atop the existing verification-loop implementation.
  • aetheronhq/agent-cube#181: Both PRs modify verify orchestration pipeline (python/cube/automation/verify.py and handlers), with this PR extending the verify command gate via effective_check and introducing parallel install execution.

Poem

🐰 A writer's worktree, prepared whilst prompts unfold,
Install tasks dancing in threads, swift and bold,
Phase One whispers "go forth," Phase Two awaits,
Then writers leap through the freshly-prepped gates!


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

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