Skip to content

fix(cli): pass --model through to the TUI entry - #48163

Open
holny wants to merge 1 commit into
anomalyco:v2from
holny:tui-model-flag
Open

fix(cli): pass --model through to the TUI entry#48163
holny wants to merge 1 commit into
anomalyco:v2from
holny:tui-model-flag

Conversation

@holny

@holny holny commented Sep 9, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #47172

Type of change

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

What does this PR do?

opencode --model <id> --prompt ... accepted the flag on the root command but dropped it before the TUI started, so the session silently ran on the configured default model — the requested id was never mentioned or validated. The run path already resolves and validates the same flag.

  • Define --model (with -m alias) on the root command params
  • Pass it through to the TUI args, where the existing args.model handling parses it and selects the model, warning on malformed values — matching the run path

How did you verify your code works?

  • --help on the root entry now lists --model, -m
  • bun typecheck in packages/cli and packages/tui
  • bun test in packages/cli (259 passing) and packages/tui (2 pre-existing timeouts in dialog-shell-output tests reproduce on a clean baseline, unrelated)

Checklist

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

Supersedes #47699 — the PR head fork was accidentally deleted on 2026-09-09 (not intentional, see the notification comment there); re-filing so the review can continue. Original conversation: #47699

The root command accepted --model but dropped it before the TUI started, so `opencode --model <id> --prompt ...` silently ran on the configured default model. Pass the flag through to the TUI args, where the existing args.model handling parses it and selects the model — matching the run path's behavior.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant