Skip to content

feat(workflows): add graph workflow editor, validator, and DAG runner (MVP) - #48

Merged
zereight merged 1 commit into
mainfrom
feat/workflows-mvp
Nov 22, 2026
Merged

zereight merged 1 commit into
mainfrom
feat/workflows-mvp

Conversation

@zereight

Copy link
Copy Markdown
Owner

Summary

  • Introduces the Core MVP of zereight/robot's node-graph Workflows feature natively into OpenMyBot.
  • Backend (server/workflows/, server/routes/workflows.ts):
    • Data model for text, decision, and approval nodes with {{input}} / {{trigger}} interpolation and shared responsible document (system prompt).
    • Static graph checker (checkWorkflowGraph) blocking cycles/deadlocks, self-loops, invalid option IDs/counts, and invalid connection ports.
    • Per-run atomic JSON storage (<dataDir>/workflows/runs/<workflowId>/<runId>.json) with startup recovery (recoverInterruptedRuns fails interrupted running/queued runs while preserving waiting runs for stateless resume).
    • DAG runner with fixed wf-slot-0..2 thread pool (sessionReset: true), global bus isolation (shouldIgnoreProviderEvent), request.opened auto-handling, decider.choose("botDecide", ...) integration with 16KB state truncation and manual fallback, approval gates with user comments, and mid-flight cancellation.
    • Admin-only HTTP routes under /api/workflows and /api/workflow-runs (+3 lines in server/index.ts, respecting index-route-ratchet and file-size-ratchet).
  • Frontend (src/components/workflows/, src/lib/workflows-api.ts):
    • Workflows entry in SidebarFooterNav (activeView: "workflows" in src/state/store.tsx with 0 net line growth) and 16 locale catalogs (sidebar.nav.workflows).
    • Interactive visual DAG canvas (WorkflowCanvas), node inspector (WorkflowNodeInspector, using <Select>), responsible document editor, and live run history with inline Approval/Decision response cards (WorkflowRunsPanel).

Verification (Before / After)

  • Before: OpenMyBot had no /api/workflows routes or visual multi-step DAG workflow view.
  • After:
    • pnpm typecheck, pnpm lint (oxlint --deny-warnings .), pnpm build, and pnpm i18n:check: all passed.
    • Guard & unit tests (file-size-ratchet.test.ts, index-route-ratchet.test.ts, Select.guard.test.ts, SidebarFooterNav.test.ts, everyday-words.test.ts, words.test.ts): 6/6 files, 41/41 tests passed.
    • End-to-end runtime verification (/tmp/verify-workflows.ts): verified cycle deadlock detection, Text -> Decision (auto-routed 95%) -> Approval (waiting) with request.opened auto-allow, simulated server restart (recoverInterruptedRuns preserving waiting), and stateless resume delivering Comment from the user: downstream while skipping unchosen branches.
    • Live OpenMyBot server HTTP verification (OMB_PORT=18841): verified GET/POST /api/workflows, 400 on self-loop/deadlock PATCH, POST /runs → waiting, 409 on PATCH while waiting, and POST /respond → done with comment appended.

@zereight
zereight merged commit dd47e83 into main Nov 22, 2026
1 of 2 checks passed
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