Skip to content

feat(rig-2y5.2): Core DAG Orchestrator Implementation#65

Merged
thoreinstein merged 6 commits intorig-v1from
feat/rig-2y5.2-dag-orchestrator
Feb 28, 2026
Merged

feat(rig-2y5.2): Core DAG Orchestrator Implementation#65
thoreinstein merged 6 commits intorig-v1from
feat/rig-2y5.2-dag-orchestrator

Conversation

@thoreinstein
Copy link
Owner

This PR implements the Core DAG Orchestrator in pkg/orchestration as part of ticket rig-2y5.2.

Key Changes:

  • Core DAG Execution Engine: Implemented in pkg/orchestration/orchestrator.go with support for concurrent node execution and dependency management.
  • Structural Validation: Added circular dependency detection using Kahn's algorithm.
  • State Persistence: Integrated with the existing Dolt-backed persistence layer for atomic state transitions and execution tracking.
  • Robustness Enhancements: Added panic recovery in node execution, context cancellation monitoring, and row-level locking (FOR UPDATE) for status transitions.
  • Comprehensive Testing: Added unit, mock, and integration tests to verify validation logic and execution flow.

Verification:

  • All unit and mock tests pass.
  • Integration tests pass when Dolt is available.
  • Linter and build checks pass via pre-commit hooks.

thoreinstein and others added 4 commits February 27, 2026 16:58
…ram in DAG orchestrator

- Fix goroutine leak: Execute loop now drains all in-flight goroutines
  before exiting on failure instead of breaking immediately
- Fix silent error discard: UpdateExecutionStatus failure on the error
  path now returned via errors.CombineErrors instead of being discarded
- Remove unused results param from runNode (dead code + race hazard)
- Replace buggy skipRemaining (graph-walk from ready queue missed
  unreachable nodes) with skipUnprocessed (launched set tracks what ran)
- Add mock test for failure propagation and downstream skip behavior
- Add mock test for diamond DAG (A->B,C->D) concurrent execution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements a core DAG orchestrator in pkg/orchestration to execute workflow nodes concurrently while persisting execution/node state transitions via the Dolt-backed DatabaseManager.

Changes:

  • Added Orchestrator execution engine with dependency scheduling, failure propagation, and panic recovery.
  • Added ValidateWorkflow (Kahn’s algorithm) and integrated validation into workflow definition persistence.
  • Enhanced DB state-transition persistence (row locking via SELECT … FOR UPDATE) and added orchestrator unit + Dolt-backed integration tests.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
pkg/orchestration/orchestrator.go New DAG execution engine, validation helper, and node execution simulation.
pkg/orchestration/orchestrator_test.go New unit + integration tests for orchestrator execution and validation.
pkg/orchestration/database.go Adds DAG validation on save, introduces CreateExecutionWithInitialStates, and makes status transitions transactional with row locks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Replace leaking ctx-cancellation goroutine with in-loop ctx.Err() check
- Move RUNNING transition after all preflight checks (validate + stateMap)
- Add ValidateWorkflow call in Execute before running
- Assign node/edge IDs before ValidateWorkflow in SaveWorkflowDefinition
- Use context.WithoutCancel for cleanup on failure/cancellation paths
- Panic recovery now marks panicked node as FAILED
- Gate IsAvailable logging behind Verbose flag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Prevent double-decrement of activeNodes on panic with decremented flag
- Validate empty and duplicate node IDs in ValidateWorkflow
- Wrap tx.Commit() errors in UpdateExecutionStatus and UpdateNodeStatus
- Add tests for context cancellation and panic recovery
- Add ValidateWorkflow test cases for empty/duplicate node IDs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thoreinstein thoreinstein merged commit b2226f1 into rig-v1 Feb 28, 2026
7 checks passed
@thoreinstein thoreinstein deleted the feat/rig-2y5.2-dag-orchestrator branch February 28, 2026 12:52
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.

2 participants