Skip to content

feat(dag): dynamic workflow engine with bridge completion + runtime - #70

Closed
LeXwDeX wants to merge 2 commits into
devfrom
feat/dynamic-workflow
Closed

feat(dag): dynamic workflow engine with bridge completion + runtime#70
LeXwDeX wants to merge 2 commits into
devfrom
feat/dynamic-workflow

Conversation

@LeXwDeX

Copy link
Copy Markdown
Owner

What

Lands the DAG workflow engine on dev: the core graph/layering/transition/replan primitives in packages/core/src/dag/, plus the opencode runtime layer (eval/scheduling/spawn/recovery/worktree-manager) with HTTP API wiring, TUI plugin hooks, and a durable SQL-backed store with migrations. OpenSpec planning artifacts covering runtime wiring, structured output, scheduling correctness, scheduler durability, and node completion semantics are included for review traceability.

Two commits:

  • c8e7b676fd feat(dag): add DAG workflow engine with HTTP API, TUI plugins, and runtime
  • ba9118668b fix(dag): bridge node completion + OpenSpec architecture analysis

Verification baseline (before PR gate)

  • packages/core/test/dag-core.test.ts validates graph construction, transition rules, replan, required-validator and projector behavior.
  • The HTTP API additions route into the existing session/dag endpoint group; SDK regeneration required post-merge if routes touch packages/opencode/src/server/routes/instance/httpapi/.

Why this PR now

This is the second branch the user asked to land on dev (the first being fix/elicitation-calltool PR #69 which is already merged). It unblocks the DAG scheduling/correctness and runtime-wiring work tracked in OpenSpec changes under openspec/changes/dag-*.

Notes

  • This PR only runs the dev Typecheck gate; full Unit Tests / E2E will fire after merge to dev, consistent with the dev-first workflow.
  • If CI flags new routes without an SDK regen, follow up with ./packages/sdk/js/script/build.ts.

Test added 2 commits July 2, 2026 14:10
…ntime
Phase 0-6 complete:
- Core: pure scheduling logic (graph, layering, transitions, replan, required-validator)
- Core: CQRS read-model (store, projector, sql tables, migration, probe)
- Schema: 15 EventV2 definitions (dag-event.ts) + durable-event-manifest registration
- Opencode: Dag.Service + layer + .node (LayerNode), EventV2Bridge-backed
- Opencode: runtime (scheduling, spawn, eval, recovery, worktree-manager, templates)
- Opencode: workflow tool (start/extend/control)
- HTTP API: DagApi group (6 endpoints) + dagHandlers + server.ts wiring
- TUI: sidebar DAG indicator + full-screen inspector route
- SDK regenerated
Bug fixes applied:
- scheduling: failed nodes no longer counted as 'done' (separate failed Set)
- scheduling: parallel forkDetach for 4 event subscriptions (was serial-blocked)
- handlers: Effect.die -> notFound()/InvalidRequestError (500 -> 404/400)
- spawn: model resolution requires both modelID+providerID (no empty fallback)
- spawn: prompt resolved via resolveTemplate (was hardcoded empty text)
- Removed dead core/dag/dag.ts (duplicate Service tag, zero consumers)
All packages typecheck green. 80 tests pass (49 core + 31 opencode).
Phase 0 (dag-node-completion-semantics, 17/17 tasks complete):
- spawn.ts: replace failure-only catchCause with Effect.gen success path
that extracts output text and publishes NodeCompleted on prompt resolution
- Fixes F1: successful nodes now publish NodeCompleted, preventing the
scheduling loop deadlock that froze every workflow after first layer
- 4 new completion tests (success/failure/empty-output/idempotency)
OpenSpec changes (architecture analysis captured as specs):
- dag-node-completion-semantics: completion contract (Level 1 text output)
- dag-scheduler-durability: restart recovery + saga rehydration (Phase 2)
- dag-scheduling-correctness: 6 internal bugs (race/replan/pause/cleanup)
(Phase 2)
- dag-structured-output: Level 2 data flow (structured output/input_mapping)
(Phase 2)
- dag-runtime-wiring spec relaxed: permits spawn.ts completion bridge
- dag-runtime-wiring proposal: marks completion-semantics as prerequisite
Boundary: Level 1 output is plain text; input_mapping field references
(nodeID.output.field) resolve to undefined until Level 2 lands.
@LeXwDeXLeXwDeX closed this Jul 5, 2026
@LeXwDeXLeXwDeX mentioned this pull request Aug 24, 2026
2 tasks
Sign up for freeto 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

@LeXwDeX