Skip to content

fix(tui): keep --model when resuming a session - #53807

Closed
glmn wants to merge 1 commit into
anomalyco:devfrom
glmn:fix/tui-keep-model-flag-on-resume
Closed

glmn wants to merge 1 commit into
anomalyco:devfrom
glmn:fix/tui-keep-model-flag-on-resume

Conversation

@glmn

@glmn glmn commented Oct 7, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #53806

Type of change

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

What does this PR do?

When the prompt syncs agent/model from the last user message of a resumed session, it already skips the agent if --agent was passed, but it always applied the message's model. So opencode --session <id> --model x/y opened with the session's old model and the next prompt went there.

The fix applies the same rule to the model: if --model was passed, the message's model (and its variant) are not applied. Without --model nothing changes.

Use case: NeuroSquad runs OpenCode in a terminal and relaunches it with --session + --model when the user switches models; today that needs a plugin that rewrites the model on outgoing messages.

This PR was prepared with help from an AI coding agent; I reviewed the change and the tests.

How did you verify your code works?

  • New packages/tui/test/session-model-arg.test.tsx: starts the TUI against a fake server with a session whose last message used alpha/model-a; with --model beta/model-b the footer shows model-b (fails before the fix), without --model it still shows model-a.
  • bun test in packages/tui (the only failure, runtime.test.tsx "abbreviates paths within home boundaries", fails on dev too on Windows), bun run typecheck, oxlint and prettier on the changed files.
  • Manually: ran src/index.ts from this branch in a pty against a local OpenAI-compatible stub with two providers. run --model fakea/ma created the session, then --session <id> --model fakeb/mb: on dev the footer showed model A and the request went to ma; with this change the footer shows model B and the request goes to mb.

Screenshots / recordings

Not a visual change (only which model is selected).

Checklist

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

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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

@glmn

glmn commented Oct 7, 2026

Copy link
Copy Markdown
Author

Closing: this is v1-only and v1 only takes critical fixes now (see #53806); v2's mini interface already keeps --model on resume.

@glmn glmn closed this Oct 7, 2026
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.

--model is ignored when resuming a session with --session

1 participant