GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(cli): preserve literal prompt arguments by HootRock · Pull Request #56206 · anomalyco/opencode

Conversation

@HootRock

@HootRock HootRock commented Oct 16, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #56120

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Join parsed prompt arguments directly instead of adding shell-style quotes a second time. opencode run 'hello world' should send hello world, including any intentional quotes or whitespace, rather than a quoted reconstruction of argv. Stdin merging stays unchanged.

Adapted from @andreivince's withdrawn #50245, with attribution retained in the commit. The original #43923 was closed in the v1 sweep; #56120 reproduces the same defect on v2.

How did you verify your code works?

Native Windows, Bun 1.4.2, frozen dependencies:

  • Local real CLI-to-loopback probes fail on unchanged bc5ebf0 and pass with the repair, covering literal quotes, newlines, backslashes, Unicode, surrounding whitespace, multiple arguments and stdin merging. The two cases passed ten repeats (20 passes). Their subprocess fixture and evidence are retained locally, outside this PR, following review.
  • After removing the fixture, the existing mini module passes 12 tests; CLI typecheck and scoped lint/format pass. These existing tests cover stdin merging and other CLI behavior, but do not replace the removed exact-argv regression coverage.
  • Before the test-only removal, the full CLI package suite passed 332 tests with 10 skips after adding the existing Git for Windows test utilities to the process PATH (the initial run failed at a missing mktemp command). Production code is unchanged; the full suite was not rerun for the removal. Root checks stop at Astro's telemetry-directory permission error; no full-workspace pass is claimed.
  • Independent review found no consequential defect in the final one-line aggregate diff.

No live model/provider calls. Implementation and review were AI-assisted.

reviewed and tested locally.

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@HootRock @andreivince
fix(cli): preserve literal prompt arguments
ff4178e
Adapt the withdrawn anomalyco#50245 fix to the current v2 CLI and cover exact
prompt text through real CLI subprocess requests, including stdin merging.

Co-authored-by: andreivince <[email protected]>
@github-actions

github-actions Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

opencode-agent[bot]
opencode-agent Bot reviewed Oct 16, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The fix works. I ran the reproduction from #56120 from source on the base and on this branch (local mock provider, opencode serve plus --server). On the base, opencode run 'Reply with: one two' stored the prompt with literal quotes added. With this change it is stored exactly as given, the same as the separate-arguments and stdin forms. The CLI type check passes. formatMessage is only called from run(), and the V1 command path goes through the same function, so nothing else depended on the old quoting.

Public API: unchanged. The prompt text sent by opencode run simply no longer gets extra quotes.

The one-line fix doesn't need the new 105-line subprocess test, so packages/cli/test/run/input.test.ts can be dropped to keep the change minimal (see the inline comment).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/cli/test/run/input.test.ts Outdated
stdin: 'a "quoted" line\n',
expected: 'compare first file second file\na "quoted" line\n',
},
])("run preserves prompt text from $name", async ({ args, stdin, expected }) => {

@opencode-agent opencode-agent Bot Oct 16, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This test is large and brittle for a one-line fix. It hand-mocks about eight server endpoints and their event shapes (/api/info, /api/location, /api/session, /api/event, prompt, permission/form, wait, message) just to check how argv is joined, so any protocol change will break it for reasons unrelated to this behaviour. It also starts two full CLI processes (about 1.3s of CPU each), and the CLI unit-test guidance in .opencode/skills/unit-tests asks to test parsing in-process and keep spawned processes to a minimum. I'd drop this file so the change stays a one-liner.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@HootRock HootRock Oct 16, 2026

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Removed the subprocess fixture in 7460c22. The aggregate diff is now the one-line prompt join; the local base/head reproduction and regression evidence are retained outside the PR. The existing mini tests pass 12/12, and CLI typecheck plus scoped lint/format pass. These tests cover stdin merging but do not replace the removed exact-argv cases. The PR description now distinguishes this fresh validation from the earlier full-package run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@opencode-agent opencode-agent Bot Oct 16, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks. I checked 7460c22: the test file is removed and the change is now just the one-line join in packages/cli/src/run/run.ts. That's the same change I verified with the #56120 reproduction, so I have no further concerns about it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@HootRock
test(cli): remove prompt subprocess fixture
7460c22
@opencodejr opencodejr Bot mentioned this pull request Nov 6, 2026
run: on Windows the prompt after -- is stored twice, with literal shell quotes #62202
Closed
@github-actions

github-actions Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Nov 16, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automated-pr-cleanup

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

fix(cli): run adds literal quotes to spaced prompt arguments

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@HootRock
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.