Skip to content

feat(daemon): CLI runner resolves args from pipe JSON#170

Merged
claude-puntlabs merged 2 commits intomainfrom
feat/cli-pipe-args
Apr 18, 2026
Merged

feat(daemon): CLI runner resolves args from pipe JSON#170
claude-puntlabs merged 2 commits intomainfrom
feat/cli-pipe-args

Conversation

@claude-puntlabs
Copy link
Copy Markdown
Contributor

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

Summary

  • CLI runner falls back to pipe JSON fields when call.Args doesn't have a value for a declared arg
  • Planner-provided args take precedence over pipe fields
  • Enables multi-stage hybrid pipelines: Claude stage produces JSON, CLI stage consumes fields as --name=value flags
  • 3 tests: pipe-only args, planner override, invalid JSON graceful handling

Test plan

  • go vet ./... clean
  • go test -race -count=1 ./internal/daemon/ passes

Bead: beadle-vjo


Note

Medium Risk
Changes CLI stage argument resolution in the pipeline executor, which can alter subprocess invocation based on prior stage output; incorrect parsing or unexpected fields could change runtime behavior despite best-effort JSON handling and tests.

Overview
Enables hybrid multi-stage pipelines by teaching CLIRunner.Run to best-effort parse the incoming pipe as JSON and use matching fields as fallback values for declared CLI args when the planner didn’t supply them.

Adds unit coverage for pipe-derived args, planner override precedence, and graceful handling when the pipe is not valid JSON. Also updates tracked .beads/issues.jsonl / .ethos/missions.jsonl records with the new bead/mission entries for this work.

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

When call.Args doesn't have a value for a declared arg, the CLI
runner falls back to parsing the pipe JSON and extracting the field
by name. Planner-provided args take precedence. Enables multi-stage
pipelines where Claude produces JSON that a CLI stage consumes as
command flags. beadle-vjo
Copilot AI review requested due to automatic review settings April 18, 2026 22:19
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

Adds support for the daemon’s CLI runner to populate missing command arguments from JSON emitted by the previous pipeline stage (the “pipe”), while keeping planner-provided args authoritative.

Changes:

  • Parse pipe as JSON (best-effort) and use its fields as fallback values for declared CLI args when call.Args doesn’t provide them.
  • Add runner tests covering pipe-only args, planner override precedence, and invalid JSON handling.
  • Update mission/issue tracking JSONL entries related to this work.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
internal/daemon/runner.go Adds JSON parsing of pipe and uses parsed fields as fallback sources for declared CLI args (plus a placeholder parse in compound mode).
internal/daemon/runner_test.go Adds tests validating arg fallback from pipe, override precedence, and invalid JSON behavior.
.ethos/missions.jsonl Records additional mission runs related to implementing/testing this feature.
.beads/issues.jsonl Adds/updates issue entries related to the feature and release tracking.

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

Comment thread internal/daemon/runner.go
Comment thread internal/daemon/runner.go
Comment thread internal/daemon/runner.go Outdated
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 824c272. Configure here.

Comment thread internal/daemon/runner.go
Comment thread internal/daemon/runner.go Outdated
- TODO comment: pipe-derived args bypass ValidateArgs (accepted risk)
- Pre-check: skip JSON parse when pipe doesn't start with '{'
- Remove dead pipeFields parse in runCompound
@claude-puntlabs claude-puntlabs merged commit 56a35c2 into main Apr 18, 2026
6 checks passed
@claude-puntlabs claude-puntlabs deleted the feat/cli-pipe-args branch April 18, 2026 22:31
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