Skip to content

feat(run): workflow rewrite — smart skip, org cycle, wave execution [v0.3.0 — 2/7]#732

Merged
kokevidaurre merged 8 commits intodevelopfrom
v030/run-engine
Apr 13, 2026
Merged

feat(run): workflow rewrite — smart skip, org cycle, wave execution [v0.3.0 — 2/7]#732
kokevidaurre merged 8 commits intodevelopfrom
v030/run-engine

Conversation

@kokevidaurre
Copy link
Copy Markdown
Contributor

Summary — PR 2 of 7 for v0.3.0 release

Run engine and workflow rewrite. The core execution pipeline.

Changes (2 files, major)

  • run.ts (+255 lines): --force, --focus, --resume flags. Org cycle coordination. Wave-based parallel execution. Quota detection. Worker timeout. Goal/directive injection.
  • workflow.ts (rewritten): Plan/execute/review/verify phases with token budget. Auto-compact transcript. Convergence detection (STATUS/VERDICT). Cap transcript turns at 8K chars. Role-based tool sets. SYSTEM.md as immutable Layer 1.

Merge order

Depends on PR #731 (core-refactor). Merge second:

  1. ✅ core-refactor (refactor(core): run engine decomposition + context helpers [v0.3.0 — 1/7] #731)
  2. → run-engine (this PR)
  3. conversation
  4. new-commands
  5. init-ux
  6. security-guardrails
  7. tests-docs

Test plan

  • npm run build passes
  • Review workflow state machine for correctness
  • Review quota detection logic

Reorganized from 219-commit develop branch for proper review.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant architectural shift in the squad workflow, moving from a turn-based conversation model to a parallel execution model (Plan → Execute → Review → Verify). It also adds support for wave-based parallel execution in org cycles, resume capabilities after quota hits, and improved context injection for agents. While the changes improve scalability and efficiency, several issues were identified in the new workflow implementation: a critical bug where providing a CLI task causes the lead agent to lose its planning context, a logic error that forces a 'converged' status even when tasks are incomplete, and a resource leak due to an uncleared timeout in the agent execution logic. Additionally, the task assignment fallback only utilizes a single worker, and the execution query limit may be too low for large organizations.

Comment thread src/lib/workflow.ts
Comment thread src/lib/workflow.ts Outdated
Comment thread src/commands/run.ts Outdated
Comment thread src/lib/workflow.ts Outdated
Comment thread src/lib/workflow.ts
…focus/resume

Run engine and workflow rewrite from v0.3.0 development cycle.

Fixes applied from Gemini Code Assist review:
- HIGH: task directive now includes planPrompt context (was bypassed)
- HIGH: converged reflects actual status (was forced true)
- MEDIUM: setTimeout cleared on close/error (resource leak)
- MEDIUM: skip logic query limit bumped to 500
- MEDIUM: fallback assigns ALL workers, not just first
- Added CLI_RUN_COMPLETE telemetry event
- Removed unused imports (dirname, homedir, bold)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added the tests label Apr 13, 2026
Jorge Vidaurre and others added 5 commits April 13, 2026 18:18
… async)

findProjectRoot() returns string|null, not a Promise.

Co-Authored-By: Claude <noreply@anthropic.com>
workflow.ts now uses spawn instead of execSync. Updated test mocks:
- Added createMockChild helper for spawn-based child processes
- Added appendFileSync to fs mock
- Added observability mock (snapshotGoals, diffGoals, logObservability)
- All 16 tests pass

Co-Authored-By: Claude <noreply@anthropic.com>
Wave definitions had our internal squad names (research, intelligence,
cli, marketing, etc.) hardcoded. A user's squads would never match.

Now: all planned squads run in a single parallel wave. Custom wave
ordering can be added later via SQUAD.md `wave:` field.

Co-Authored-By: Claude <noreply@anthropic.com>
Auto-committing hq memory between waves was our internal pattern,
not a product feature. Users won't have .agents/memory/ in their
project root. Removed.

Co-Authored-By: Claude <noreply@anthropic.com>
"No prompts in code" — behavioral instructions live in markdown.
Extracted the inline planPrompt template string to a markdown file
with {{VARIABLE}} placeholders. TypeScript loads and substitutes.

Also: squadContext is now included in the template (was passed as
empty string, losing goals/priorities context).

Co-Authored-By: Claude <noreply@anthropic.com>
No longer needed after removing hardcoded git commit between waves.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant