Skip to content

fix(cli): switch opencode provider to stdin prompt delivery#65

Merged
onevcat merged 2 commits into
onevcat:masterfrom
kkkiio:fix-opencode-stdin
May 31, 2026
Merged

fix(cli): switch opencode provider to stdin prompt delivery#65
onevcat merged 2 commits into
onevcat:masterfrom
kkkiio:fix-opencode-stdin

Conversation

@kkkiio

@kkkiio kkkiio commented May 20, 2026

Copy link
Copy Markdown

Summary

The opencode CLI provider passes the prompt as a shell argument (opencode run "<prompt>" ...), which breaks for argue's long task prompts (natural language + full RoundTaskInput JSON + output JSON Schema). This can exceed shell argument limits or get corrupted by escaping, causing opencode to receive empty input and produce no output.

OpenCode actually supports stdin, so this PR switches prompt delivery from CLI argument to stdin, consistent with claude, codex, gemini, and pi providers.

Changes

  • usesStdinPrompt(): move "opencode" from false to true branch
  • buildBaseArgs(): remove prompt from opencode args
  • Update test to expect prompt in stdin instead of argv

Closes #64

🤖 Generated with Claude Code

OpenCode sends the prompt via CLI argument (`opencode run "<prompt>"`)
which breaks for long prompts (full Task Context JSON + Output JSON Schema).
Args can exceed shell limits or get corrupted by escaping.

OpenCode actually supports stdin; switch `usesStdinPrompt` to return true
and remove prompt from `buildBaseArgs` so the prompt goes through stdin
like other CLI providers (claude, codex, gemini, pi).
@onevcat

onevcat commented May 31, 2026

Copy link
Copy Markdown
Owner

@onevclaw @onevtail /argue Please review this PR and determine whether we should merge it. Check the OpenCode source code, look for supporting evidence, and verify whether this fix actually works.

@onevtail

Copy link
Copy Markdown
Collaborator

🤖 Argue 研判结果

  • Trace: mh_1780191126764_883e8240
  • Session status: interrupted
  • Participants: @onevtail, @onevclaw
  • Rounds: 2
  • Claims: 5/5 resolved, 0 unresolved
  • Verdict: pass

Representative

  • Agent: onevtail
  • Score: 71.38

Summary

Recommend merging PR #65. The patch correctly switches the OpenCode provider from argv prompt delivery to stdin, OpenCode source confirms opencode run consumes piped stdin as the prompt, and targeted tests, typecheck, build, and PR CI all pass. The missing live OpenCode integration test is a real but non-blocking follow-up for this narrow fix.

All claims

  • ✅ OpenCode run accepts stdin (1/1)
    • Claim ID: onevtail:0:0
    • Statement: The current OpenCode run command reads piped stdin when stdin is not a TTY and uses that text as the non-interactive prompt, so invoking opencode run with no positional message but with stdin is supported by source code.
  • ✅ Argue now writes the prompt to opencode stdin (1/1)
  • ✅ The fix addresses the reported long-prompt failure mode (1/1)
    • Claim ID: onevtail:0:2
    • Statement: Moving the full RoundTaskInput prompt and JSON schema out of argv avoids OS argv-size pressure and argument quoting/escaping hazards while preserving the same opencode run flags.
  • ✅ Verification is strong enough to merge (1/1)
    • Claim ID: onevtail:0:3
    • Statement: The PR's targeted runtime-cli tests pass locally, packages/argue-cli typecheck and build pass, and the PR head has a successful GitHub Actions CI run, so there is no blocking evidence against merging.
  • ✅ End-to-end OpenCode coverage is still missing (1/1)
    • Claim ID: onevtail:0:4
    • Statement: The repository test verifies argv/stdin construction with an echo helper rather than running a real opencode binary, so a future smoke test could reduce integration risk, but this should not block this small fix.

Report


🧵 mh_1780191126764_883e8240
🐾 MeowHook Argue
⚙️ Powered by onevcat/argue engine

@onevcat
onevcat merged commit 23dfccf into onevcat:master May 31, 2026
1 check passed
@onevcat

onevcat commented May 31, 2026

Copy link
Copy Markdown
Owner

@kkkiio Thank you for the fix!

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.

opencode CLI provider fails with long prompts

5 participants