Skip to content

fix(opencode): preserve run subcommand before launch flags - #13065

Closed
coelho-doti wants to merge 2 commits into
stablyai:mainfrom
coelho-doti:fix/opencode-auto-rename-flags
Closed

coelho-doti wants to merge 2 commits into
stablyai:mainfrom
coelho-doti:fix/opencode-auto-rename-flags

Conversation

@coelho-doti

@coelho-doti coelho-doti commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes OpenCode AI commit-message generation when an agentCmdOverrides value includes launch flags, for example opencode --auto. Orca now produces opencode run --auto ... instead of opencode --auto run ..., which caused OpenCode to print global help and exit with code 1.

  • Limits the reordering to direct OpenCode binaries: opencode, opencode.cmd, and opencode.exe.
  • Leaves wrapper commands such as npx opencode unchanged.
  • Adds regression coverage for POSIX and Windows executable names.

X: @coelhoxyz

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck (fails before the changed files are analyzed: TypeScript 7 reports the unchanged root tsconfig.json baseUrl setting as deprecated.)
  • pnpm test (8 existing failures outside this change; the targeted test passes.)
  • pnpm build (desktop build completed; native macOS universal-binary packaging cannot find expected arm64/x86_64 artifacts and lipo exits 1.)
  • Added regression tests covering the direct POSIX, .cmd, and .exe OpenCode commands.

Additional validation:

  • pnpm vitest run src/shared/commit-message-plan.test.ts (22 tests passed).
  • opencode run --auto --model opencode/gpt-5.4-mini --agent build --format default --help (validated that the resulting command is parsed by opencode run).

AI Review Report

Reviewed the focused diff for CLI token ordering and wrapper-command behavior, then checked cross-platform compatibility for macOS, Linux, and Windows. The review covered executable suffixes, path separators, and shell behavior. This remains a pure shared planner used by local, remote, and SSH generation paths; it adds no platform-specific I/O.

The review also checked supported-agent behavior, Electron/UI impact, and performance. Only the explicit opencode path changes; there are no renderer, shortcut, label, or Electron API changes. The added regex runs only while building a generation plan. No defects were found after adding Windows executable coverage.

Security Audit

The change only reorders existing tokenized argv values. It introduces no shell execution, input interpolation, path resolution, auth, IPC, secret, or dependency changes. Existing command-override tokenization and validation remain in place. No follow-up is needed.

Notes

  • The direct OpenCode command was exercised on macOS. Windows behavior is covered at planner level for .cmd and .exe; no Windows runtime is available in this environment.
  • X: @coelhoxyz

@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds special handling for OpenCode preset commands. Override arguments now appear after the generated run subcommand and before generated model and agent arguments. Other commands retain prefix-before-generated ordering. Parameterized tests verify opencode, opencode.cmd, and opencode.exe command plans, including generated arguments and stdin prompt handling.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the OpenCode command-ordering fix and matches the main change.
Description check ✅ Passed The description covers the required sections, explains failed checks, documents testing, and includes AI review, security, and platform notes.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H

Copy link
Copy Markdown
Contributor

Closing this submitted branch and routing the bug to owner issue #17551. We will carry the fix ourselves on current main and will not request any contributor follow-up. Full contributor credit is preserved for @coelho-doti. No action is requested from you. Thank you.

@Jinwoo-H Jinwoo-H closed this Aug 31, 2026
kukapu added a commit to kukapu/orca that referenced this pull request Sep 2, 2026
nwparker added a commit that referenced this pull request Oct 2, 2026
… hosts

Use configured models and JSON answer/error events, preserve run-first arguments, and handle the precise v2 variant rejection. Hydrate SSH execution-host PATH through the existing bounded login environment resolver before direct spawning.

Credits: andy-murr (PR #5197 SSH environment intent) and coelho-doti (PR #13065 argument-order intent).
nwparker added a commit that referenced this pull request Oct 3, 2026
… hosts

Restack the original focused change onto current main, preserving every owned source and test blob and the merged CI contract and journal cleanup fixes.

Original-commit: 64bb15e
fix(source-control): generate clean OpenCode answers on local and SSH hosts

Use configured models and JSON answer/error events, preserve run-first arguments, and handle the precise v2 variant rejection. Hydrate SSH execution-host PATH through the existing bounded login environment resolver before direct spawning.

Credits: andy-murr (PR #5197 SSH environment intent) and coelho-doti (PR #13065 argument-order intent).

Original-commit: 1b60ec5
fix(source-control): retry inline OpenCode model and variant options

Original-commit: 98fdecc
Preserve OpenCode named errors without a data message

Restacked-from: 98fdecc
Restacked-onto: f7b1f9d
nwparker added a commit that referenced this pull request Oct 3, 2026
…r SSH (#24613)

* fix(source-control): generate clean OpenCode answers on local and SSH hosts

Restack the original focused change onto current main, preserving every owned source and test blob and the merged CI contract and journal cleanup fixes.

Original-commit: 64bb15e
fix(source-control): generate clean OpenCode answers on local and SSH hosts

Use configured models and JSON answer/error events, preserve run-first arguments, and handle the precise v2 variant rejection. Hydrate SSH execution-host PATH through the existing bounded login environment resolver before direct spawning.

Credits: andy-murr (PR #5197 SSH environment intent) and coelho-doti (PR #13065 argument-order intent).

Original-commit: 1b60ec5
fix(source-control): retry inline OpenCode model and variant options

Original-commit: 98fdecc
Preserve OpenCode named errors without a data message

Restacked-from: 98fdecc
Restacked-onto: f7b1f9d

* fix(ci): prevent concurrent pnpm refresh during mobile typechecks (#24776)

* fix(ci): run mobile typechecks without concurrent dependency refresh

* test(ci): check effective Linux E2E package list

* test(ci): preserve the mobile production compiler barrier

---------

Co-authored-by: Orca Integration Recovery <[email protected]>

* test(terminal): restore the live fish fixture prerequisites (#24947)

A restored pane waits for the initial status replay before subscribing to
PTY output. This fixture never settled that replay, so fish printed its
mode-2031 arm before the renderer connected. Its PTY API also omitted the
reset-input listener required by the serializer, aborting attachment.

Settle and dispose the existing startup-snapshot registration and provide
the same reset-listener mock used by the other PTY tests. The real fish
child-stdin assertions and timeouts remain unchanged. No production change.

* fix(shortcuts): defer TUI editing chords in terminal-first mode (#24640)

Restack the original focused change onto current main, preserving every owned source and test blob and the merged CI contract and journal cleanup fixes.

Original-commit: f707cde
fix(shortcuts): defer TUI editing chords in terminal-first mode

Original-commit: 0c6348e
docs(shortcuts): describe deferred preview terminal chords

Original-commit: be62c1b
Align worktree history shortcut metadata with terminal conflict policy

Restacked-from: be62c1b
Restacked-onto: f7b1f9d

* Register supervised Qoder China and Qwen Code (#24616)

* Add Qoder session history and search with real CLI coverage

* Allow the real Qoder marker file to end with a newline

* Keep Qoder tool output out of history previews and search

* Keep Qoder search pages readable by older clients

* Verify persisted Qoder history after a real generated and resumed task

* Negotiate Qoder filters before searching an older execution host

* Combine search client imports for the CI plugin gate

* Keep the relay search oracle aligned with legacy agent filtering

* Register supervised Qoder China and Qwen lifecycle integration

* Cover Qoder China mobile assets and mixed-host resume gates

* Verify Qoder provider tags against the older released wire parser

* Verify China and Qwen keep independent Windows hook scripts

* Verify Qoder registrations against the installed older Windows release

* test(qoder): align search capability contracts and pin old-host fencing

* fix(qoder): rank exact picker identities and command aliases first

* test(qoder): preserve the regional CLI shared icon expectation

Keep the full bundled-asset and no-remote-image checks, with an explicit
shared-logo basename for Qoder China. The map also works with older
catalog type unions.

* fix(qoder): align China catalog entry with fallback order

---------

Co-authored-by: Orca Integration Recovery <[email protected]>

* Use the measured pnpm lookup policy automatically in hosted root CI (#24951)

* Select lookup automatically for the measured hosted root-install profile

* Record hosted automatic-mode cold cache publication proof

* fix: bound remote generation setup and honor OpenCode option terminators

Count execution-host profile resolution inside the existing request deadline, cancel its waiter promptly, and pass only the remaining time to the child. Shared bounded profile probes keep their existing cache lifetime; the SSH transport margin is unchanged.

Read OpenCode output format from active final-argv options before -- so literal prompt arguments cannot select the JSON finalizer.

Fresh exact-source controls reproduce nine failures before; 139 related checks pass after, including primary/fallback delays, deadline boundaries, cancellation, parser metadata, and SSH lanes. Node typecheck and strict changed-file lint pass.

* Continue Antigravity IDE and 2.0 history in new CLI conversations (#24692)

* feat(antigravity): bridge IDE history into new CLI conversations

* fix(antigravity): preserve fresh-launch model and environment for IDE references

* fix(antigravity): forward IDE history opt-in through desktop IPC

* fix(antigravity): rebuild remote IDE reference startup on its host

* fix(antigravity): register IDE continuation action labels

* fix(antigravity): confine IDE references and bound metadata reads

* fix(antigravity): localize IDE continuation badges

* Preserve scanner service cache assertions and refresh Antigravity opening metadata

* Preserve Antigravity opening joins and target folder runtime authority

* fix(opencode): retry timed-out SSH plugin updates (#24666)

Preserve bounded retry behavior and the current-main status-envelope fields.

Original-PR: #24124
Reviewed-source: 103144f

Co-authored-by: Justas Brazauskas <[email protected]>

* fix(opencode): keep Go credentials private and resolve backend keys (#24615)

Preserve the complete credential storage, migration, IPC, Settings and rate-limit refresh change alongside standalone GLM plans, current-main database diagnostics and the reviewed unknown-backend environment correction. Keep native discovery cancellation third and selected environment fourth.

Original-topic-commit: 7903f1c
Original-topic-commit: 588117b
Original-topic-commit: dedd4f8
Original-topic-commit: 6645dae
Original-topic-commit: a25b80c02c1af7830b0e6a65e72d965b3ad98276
Restacked-from: a25b80c02c1af7830b0e6a65e72d965b3ad98276
Restacked-onto: b032867

Co-authored-by: kespineira <[email protected]>
Co-authored-by: kevimux <[email protected]>
Reported-by: pullfrog
Reviewed-full-source: 849fe093073f4c1606bd65d79a0c725d955d0d1f
Native-helper-source: 80dbe23


Reviewed-full-current-source: 36acb57d44adb3d378c0289c8c15f7da0fda214c

* fix(opencode): enforce deadline through executable startup

Keep synchronous Windows PATH resolution and child startup within the existing request budget.

---------

Co-authored-by: Orca Integration Recovery <[email protected]>
Co-authored-by: Justas Brazauskas <[email protected]>