Skip to content

Add live CI test for real agent CLI plumbing#62

Closed
Tim-Pohlmann wants to merge 4 commits into
mainfrom
test/live-agent-cli-plumbing
Closed

Add live CI test for real agent CLI plumbing#62
Tim-Pohlmann wants to merge 4 commits into
mainfrom
test/live-agent-cli-plumbing

Conversation

@Tim-Pohlmann

Copy link
Copy Markdown
Owner

Summary

  • New agent-plumbing job in ci.yml: installs the real opencode and claude CLIs via npm and invokes them with the exact flag shapes OpenCodeAgent/ClaudeAgent construct, with no API key set.
  • opencode with no --model is expected to actually succeed (validates the free-default-model assumption for real, not mocked).
  • Every other (agent, model) combination is expected to fail with an auth-shaped error, not an "unknown argument" error — proving the flags are still accepted by the real CLI, catching drift the mocked unit tests can't see.
  • No paid credentials needed in CI; runs on every push/PR.

Split out from #61 per request, so the model/provider-passthrough change and its live CI coverage can be reviewed independently.

Test plan

  • Ran the bats file locally with the real bats interpreter — parses/executes correctly (fails only on "command not found" since opencode/claude aren't installed in this sandbox)
  • shellcheck clean
  • YAML parses (python3 -c "import yaml; yaml.safe_load(...)")
  • CI run on this PR (once opened) exercises it for real

Unit tests assert BuildInvocation's argument shape against a fake process
runner, so a real opencode/claude CLI renaming or dropping a flag we rely
on (--model, --format json, --append-system-prompt, ...) would go
unnoticed until a real job run failed.

Adds a new agent-plumbing CI job that installs the real CLIs via npm and
invokes them with no API key: opencode with no --model is expected to
actually succeed on its free default, and every other (agent, model)
combination is expected to fail with an auth-shaped error rather than an
"unknown argument" error — proving the flags were accepted without
needing any paid credentials in CI.
Tim-Pohlmann added a commit that referenced this pull request Jul 7, 2026
The real claude-code CLI rejects --print combined with
--output-format=stream-json unless --verbose is also present
("Error: When using --print, --output-format=stream-json requires
--verbose"). Our fake-process unit tests never caught this since they
stub the CLI; PR #62's new live agent-plumbing CI job (which invokes
the real CLI with no key) caught it immediately.
…rding

CI showed opencode wraps request-level failures (missing key, unauthorized,
upstream errors) in a generic {"type":"error","error":{"name":"UnknownError",...}}
JSON envelope rather than surfacing auth-specific wording, so the keyword-based
assert_auth_failure check (which fits claude) never matched. A "type":"error"
envelope is still proof the CLI parsed --model/--format as real flags, since an
unrecognized flag fails with a CLI usage error before any JSON is emitted at all.
S6505 (--ignore-scripts) and S8543 (pin versions) both conflict with what
this line is for: opencode-ai's postinstall script symlinks its real
binary (so --ignore-scripts breaks the install), and the job exists
specifically to test against latest to catch upstream CLI drift (so
pinning defeats its purpose). Suppressed via sonar.issue.ignore.multicriteria
in the scanner begin step rather than left unexplained/red.
PR #61 added --verbose to ClaudeAgent.BuildInvocation (claude now requires
it alongside --print --output-format stream-json). This branch's bats file
hardcodes that same invocation shape to test the real CLI directly, so it
needs the same flag or every claude test here fails on a CLI usage error
that the assert_auth_failure check correctly refuses to treat as an auth
failure.
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

@Tim-Pohlmann

Copy link
Copy Markdown
Owner Author

Superseded by #63 + #64: instead of a bats script invoking the real agent CLIs with hand-copied argument lists (which drifted from ClaudeAgent/OpenCodeAgent once already, requiring a manual --verbose fix), the new PRs run the actual job.yml composite actions directly, so there's no separate mirror of the argument-building logic to keep in sync. Closing this one.

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