Skip to content

feat(opencode): OC Kit workflow engine (Phase 3) - #10

Merged
qkhalk merged 2 commits into
mainfrom
feature/oc-kit-workflow
Aug 19, 2026
Merged

qkhalk merged 2 commits into
mainfrom
feature/oc-kit-workflow

Conversation

@qkhalk

@qkhalk qkhalk commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Workflow engine (Phase 3) for OC Kit: pure Effect modules under \packages/opencode/src/ockit/workflow/\ that execute a kit's declared \Workflow\ through a state machine over \WorkflowState, with retry and onFailure recovery, producing a deterministic run trace.

Modules

  • \graph.ts\ — validates a workflow: every step.skill and onFailure id resolves in the kit index, duplicate \�s\ aliases rejected, self-referential steps (key == workflow id) rejected. Typed \WorkflowError.
  • \state.ts\ — pure (state, event) -> state\ reducer over the shared \WorkflowState\ literals (start/step-ok/step-fail/retry/complete/fail/cancel), throws typed \IllegalTransitionError\ on illegal transitions. Adds \WorkflowRunRecord, \createRecord, \�pplyEvent, \stepKey.

  • unner.ts\ — runs a workflow end-to-end (feature-development and bug-fix advance to COMPLETED), applies the retry budget per step, routes a step failing past retries to onFailure, records a per-step trace (status ok/recovered/failed + attempts).
  • \scheduler.ts\ — deterministic FIFO dispatch plan with max-concurrency bound.
  • \engine.ts\ —
    unWorkflow(input): Effect<RunSummary, WorkflowError>\ orchestrates graph validation + state + runner + scheduler; \RunSummary\ (workflowId, runId, state, steps, recovered, startedAt, completedAt) is deterministic when \�t\ is supplied.

Constraints honored: no change to shared types.ts / index.ts / cli.ts; only relative imports; kebab-case files; self-export pattern; \Effect.fn/pure helpers; no network or disk I/O in the core path; steps are simulated (executor injection point for the live run path in a later phase).

Tests (\ est/ockit/workflow/*): state transitions incl. illegal ones, graph validation failures (unknown step, unknown onFailure, duplicate alias, cycle), FIFO scheduling, end-to-end feature-development + bug-fix to COMPLETED, retry-within-budget, fail-without-recovery, recover-via-onFailure (recovered: true), onFailure-also-fails (FAILED), and deterministic RunSummary equality.

Copilot AI lite review requested due to automatic review settings August 19, 2026 21:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown

The following comment was made by an LLM, it may be inaccurate:

@qkhalk
qkhalk merged commit 053b60f into main Aug 19, 2026
6 of 8 checks passed
@qkhalk
qkhalk deleted the feature/oc-kit-workflow branch August 19, 2026 22:05
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.

2 participants