Skip to content

feat(daemon): pipeline v2 — multi-runner, process/passthrough, compound steps#165

Merged
claude-puntlabs merged 13 commits intomainfrom
docs/pipeline-v2-design
Apr 18, 2026
Merged

feat(daemon): pipeline v2 — multi-runner, process/passthrough, compound steps#165
claude-puntlabs merged 13 commits intomainfrom
docs/pipeline-v2-design

Conversation

@claude-puntlabs
Copy link
Copy Markdown
Contributor

@claude-puntlabs claude-puntlabs commented Apr 18, 2026

Summary

Pipeline v2 adds CLI runners, process/passthrough data flow, compound CLI steps, and JSON schema validation to the beadle daemon pipeline orchestrator.

  • CLI runner: execute tools (biff, jq, git) directly in milliseconds via exec.Command. Binary whitelist with filepath.EvalSymlinks at load + exec time. 1MB stdout cap via io.LimitReader.
  • Process/passthrough modes: commands declare whether they transform the pipe (process, default) or pass it through as a side-effect (passthrough). Side-effect commands don't destroy pipeline data.
  • Compound CLI steps: chain binaries (jq | biff) via goroutine-per-step with io.Pipe. First nonzero exit cancels all steps. No shell invoked.
  • JSON output schema: process-mode output validated against declared schema via santhosh-tekuri/jsonschema/v6. output_schema: text bypasses validation.
  • Runner interface: decouples executor from spawn mechanism. ClaudeRunner wraps existing mission/spawner. CLIRunner for deterministic ops.
  • Security fixes: CLI env isolation (minimal PATH+HOME+USER), stderr cap (1MB), pipe escaping (no truncation), fireElse dead param removed.

Also includes: pipeline v2 architecture doc (3 architect reviews), task-level implementation design, approved development process doc, updated PR/FAQ (v3.0), updated README, DES-030/031 ADRs settled, CHANGELOG.

Test plan

  • go vet ./... clean
  • go test -race -count=1 ./internal/daemon/ — 81 tests pass (66 existing + 15 edge-case)
  • djb security review: 2 HIGH + 2 MEDIUM fixed, re-reviewed clean
  • 3 architect reviews of design doc, all findings resolved

Epic: beadle-mvd | Pipeline: standard-2026-04-18-7c0858


Note

High Risk
High risk because it changes the daemon’s core pipeline execution model (new runner dispatch, pipe semantics, and JSON schema validation) and introduces direct subprocess execution/whitelisting logic plus new dependencies, which could affect correctness and security if misconfigured.

Overview
Pipeline execution is refactored to Pipeline v2. Commands now declare runner (claude or cli), mode (process vs passthrough), and output_schema (either text or inline JSON Schema), with runner-conditional validation and CLI-specific fields like binary, fixed_args, steps, and positional args.

Executor behavior changes. The daemon now maintains a JSON “pipe” (initialized from email metadata), dispatches each stage through a Runner interface, preserves the pipe for passthrough stages, and validates process outputs against precompiled schemas (new jsonschema/v6 dependency); reply handling is updated to send inputs.pipeline_output and else-path replies are fixed-text only.

Docs and project metadata are updated. Adds/updates pipeline v2 design docs (docs/pipeline-v2-design.md, docs/pipeline-v2.md), formalizes delegation/pipeline workflow in CLAUDE.md and docs/process.md, expands README/CHANGELOG, and records new DES entries (DES-030/031).

Reviewed by Cursor Bugbot for commit 42a9a21. Bugbot is set up for automated code reviews on this repo. Configure here.

… compound steps

DES-030: multi-runner commands (claude + cli)
DES-031: pipeline v2 data flow with process/passthrough modes,
compound CLI steps, JSON pipe payload, output schema validation

Three rounds of architect review, all findings addressed.
Full design doc at docs/pipeline-v2-design.md.
Rewrite the intro to describe beadle as a programmable agent daemon
with a Unix-like command model: commands are programs, the daemon is
the shell, pipelines are pipes, GPG signatures are sudo. Includes
a concrete 3-stage pipeline example showing claude + cli runners.
Update press release, solution, getting started, customer quote,
competitor analysis, timeline, feature appendix, and risk assessment
to reflect current state: Go binary (not Python), YAML commands
(not Markdown), two runners (claude + cli), process/passthrough
pipe modes, shipped pipeline v1, and pipeline v2 design in progress.
Replace PyPI references with GitHub Releases. Bump to v3.0.
Replace ad-hoc mission dispatch with pipeline-first workflow.
Pipeline selection table with 8 options evaluated by work nature.
Execution loop: fresh agent per stage, mission carries context.
Direct dispatch retained for rare single-mission work only.
Codifies the standard pipeline workflow: pipeline selection, 5-stage
execution (design → implement → test → review → document), stage 4
multi-round review cycle, setup checklist, shipping protocol.
Beads mirror pipeline stages. Session task list via TaskCreate maps
to bead IDs for user visibility. Epic bead closes when all stages
close and PR merges.
Stage 1 output from standard pipeline. Exact struct changes, function
signatures, migration steps, test cases for T1-T7. Commit order
specified. Ready for mechanical implementation in stage 2.
…nd steps

T1: Command struct v2 with Runner/Mode/OutputSchema, runner-conditional
    validator, YAML + test fixture migration (atomic)
T2: Runner interface, ClaudeRunner extracted from executor
T3: CLIRunner with BinaryWhitelist (EvalSymlinks), arg assembly, 1MB cap
T4: Compound CLI steps with goroutine-per-step io.Pipe chaining
T5: Process/passthrough pipe in executor, initial EmailMeta JSON
T6: Output schema validation via santhosh-tekuri/jsonschema/v6
T7: Auto-reply reads inputs.pipeline_output, fireElse uses fixed-text pipe

66 tests passing. go vet clean. Implements docs/pipeline-v2.md spec.
15 new tests: hybrid pipeline (claude+cli), passthrough data survival,
schema validation rejection, text mode bypass, compound step mid-chain
failure, whitelist deletion, pipe initial value, empty plan else handler,
fireElse fixed-text pipe, unknown runner, invalid JSON, process mode
pipe update, compound resolve failure, pipeline store integration,
multiple consecutive passthrough stages.
H1: CLIRunner sets explicit minimal env (PATH+HOME+USER+declared),
    no longer inherits daemon credentials to CLI subprocesses
H2: stderr buffers capped at 1MB via cappedWriter, prevents memory
    exhaustion from malicious binaries
M2: escapeYAMLPipe for pipeline_output has no 500-char cap, prevents
    silent truncation of large pipe values in mission contracts
L1: fireElse pipe parameter removed (was dead — function constructs
    its own fixed-text error)
Stage 5: CHANGELOG entries for pipeline v2 (6 Added, 4 Security).
DES-030 and DES-031 status PROPOSED → SETTLED. DES-030 YAML examples
updated to v2 schema (mode, output_schema, no input/output fields).
Copilot AI review requested due to automatic review settings April 18, 2026 15:45
Copy link
Copy Markdown

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

Pipeline v2 upgrades the daemon’s pipeline orchestrator to support multiple execution backends (Claude + direct CLI), a persistent “pipe” data flow with process/passthrough semantics, compound CLI step chaining, and optional JSON Schema validation for process outputs—plus updated docs/ADRs and changelog.

Changes:

  • Introduces Runner abstraction with ClaudeRunner and CLIRunner (binary whitelist, env isolation, stderr cap, compound steps).
  • Adds pipeline “pipe” semantics (process replaces pipe; passthrough preserves) and JSON Schema output validation (output_schema).
  • Updates command YAML schema (runner/mode/output_schema/cli fields), tests, and project documentation/ADRs/FAQ/README.

Reviewed changes

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

Show a summary per file
File Description
prfaq.tex Updates PR/FAQ (v3.0) and product narrative/press release text
internal/daemon/schema.go Adds output schema compilation + output validation helpers
internal/daemon/schema_test.go Unit tests for schema compilation/validation behavior
internal/daemon/runner.go Adds Runner interface, ClaudeRunner, CLIRunner, whitelist + compound step execution
internal/daemon/runner_test.go Extensive CLIRunner tests (whitelist, args, timeouts, caps, compound steps, env isolation)
internal/daemon/pipeline.go Refactors executor to use runners, introduces pipe semantics + schema validation + reply wiring
internal/daemon/pipeline_test.go Updates pipeline tests for runner dispatch + pipe behavior + reply args changes
internal/daemon/pipeline_edge_test.go Adds edge/integration tests for hybrid pipelines, passthrough survival, schema rejection, etc.
internal/daemon/mission.go Adds escapeYAMLPipe for untruncated pipeline output in mission contracts
internal/daemon/handler.go Wires Executor construction to Runners map (currently only ClaudeRunner)
internal/daemon/command.go Updates command schema: runner/mode/output_schema, CLI binary/steps, arg positions, validation
internal/daemon/command_test.go Updates loader tests and fixtures for new command schema + CLI commands
go.mod Adds jsonschema/v6 dependency (and adjusts uuid direct dep / x/text indirect)
go.sum Updates sums for new/updated dependencies
docs/process.md Adds/defines “Beadle Development Process” doc (pipeline-based workflow)
docs/pipeline-v2.md Adds Pipeline v2 implementation design (task-level spec)
docs/pipeline-v2-design.md Adds Pipeline v2 architecture/design document
README.md Updates top-level product positioning + adds pipeline v2 design link
DESIGN.md Adds/settles DES-030 and DES-031 ADRs for multi-runner + pipe semantics
CLAUDE.md Updates delegation guidance to emphasize pipelines + selection rules
CHANGELOG.md Documents Pipeline v2 features + security notes
.ethos/missions.jsonl Records mission pipeline metadata for the epic execution history

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

Comment thread internal/daemon/handler.go
Comment thread internal/daemon/pipeline.go Outdated
Comment thread internal/daemon/runner.go Outdated
Comment thread internal/daemon/runner.go
Comment thread internal/daemon/runner.go
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 60d51a1. Configure here.

Comment thread internal/daemon/runner.go Outdated
Comment thread internal/daemon/runner.go
F1: register CLI runner in handler.go with BinaryWhitelist
F2: auto-reply runner lookup with ok-check, skip on missing
F3: compound step Start failure cleanup — cancel, close pipes, Wait
F4: drain stdout to io.Discard after 1MB LimitReader (single binary)
F5: same stdout drain for compound steps
F6: wire buildStageContract through to ethos mission create — pipe
    data and command-specific instructions now reach Claude workers
F7: cappedWriter always returns len(p) to prevent ErrShortWrite
@claude-puntlabs claude-puntlabs merged commit 54c8091 into main Apr 18, 2026
6 checks passed
@claude-puntlabs claude-puntlabs deleted the docs/pipeline-v2-design branch April 18, 2026 16:02
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