Skip to content

feat(runtime): korg parallel — verifiable parallel runs (fan → pick winner → seal)#20

Open
New1Direction wants to merge 1 commit into
mainfrom
feat/korg-parallel-verifiable-runs
Open

feat(runtime): korg parallel — verifiable parallel runs (fan → pick winner → seal)#20
New1Direction wants to merge 1 commit into
mainfrom
feat/korg-parallel-verifiable-runs

Conversation

@New1Direction

Copy link
Copy Markdown
Owner

What

korg parallel "<task>" -n N — fan one task across N isolated git worktrees, run the honest run_once pipeline in each, pick a winner deterministically, and seal the entire fan-out as one korg-ledger@v1 journal that korg-verify accepts.

This is "compare N attempts" (table-stakes for agent IDEs) plus the thing only Korg can do: the parallel run is independently verifiable, not just eyeballed.

How

  • crates/korg-runtime/src/parallel.rs
    • select_winner — deterministic: compiles → smallest real diff → lowest index (no extra model call). Unit-tested.
    • build_fanout_events — a hash-chained causal DAG (parallel_prompt → candidate×N → winner_selected) built from the same ledger_chain primitives run_once uses, so it verifies byte-identically.
    • run_parallel — worktree-per-candidate, loser cleanup, winner kept on a mergeable branch.
  • src/main.rskorg parallel <task> [-n N] [--repo P], mirroring run-once's provider/repo handling (--provider ollama for live diverse candidates).

Verified

  • 6/6 unit tests (winner logic + the fan-out journal chains correctly).
  • e2e: korg parallel "..." -n 2 on the bundled fixture → korg-verify: "journal VALID — 4 events, hash-chain + DAG intact".

Not in this PR (follow-ups)

  • Minting the portable korgcert certificate over the fan-out journal (one korg-seal step).
  • One-click winner merge + desktop UI surfacing.

…inner → seal)

Fan one task across N isolated git worktrees, run the honest run_once pipeline
in each, pick a winner deterministically (compiles → smallest real diff, ties to
lowest index), and seal the whole fan-out as ONE korg-ledger@v1 journal that
korg-verify accepts — provable parallel runs, not just compared ones.

- crates/korg-runtime/src/parallel.rs: select_winner (pure, unit-tested),
  build_fanout_events (hash-chained causal DAG via ledger_chain primitives),
  run_parallel (worktree-per-candidate, loser cleanup, winner kept on a
  mergeable branch).
- src/main.rs: `korg parallel <task> [-n N] [--repo P]` subcommand.

Verified: 6/6 unit tests; e2e `korg parallel ... -n 2` on the fixture →
korg-verify: 'journal VALID — 4 events, hash-chain + DAG intact'. The live
multi-candidate fan-out (--provider ollama) is the user's to run.
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