Skip to content

Commit a554fad

Browse files
authored
fix(tui): Don't overwrite the agent that was specified on the command line (#20554)
1 parent 4dd0d1f commit a554fad

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • packages/opencode/src/cli/cmd/tui/component/prompt

packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { useToast } from "../../ui/toast"
3737
import { useKV } from "../../context/kv"
3838
import { useTextareaKeybindings } from "../textarea-keybindings"
3939
import { DialogSkill } from "../dialog-skill"
40+
import { useArgs } from "@tui/context/args"
4041

4142
export type PromptProps = {
4243
sessionID?: string
@@ -81,6 +82,7 @@ export function Prompt(props: PromptProps) {
8182

8283
const keybind = useKeybind()
8384
const local = useLocal()
85+
const args = useArgs()
8486
const sdk = useSDK()
8587
const route = useRoute()
8688
const sync = useSync()
@@ -202,7 +204,8 @@ export function Prompt(props: PromptProps) {
202204
// Only set agent if it's a primary agent (not a subagent)
203205
const isPrimaryAgent = local.agent.list().some((x) => x.name === msg.agent)
204206
if (msg.agent && isPrimaryAgent) {
205-
local.agent.set(msg.agent)
207+
// Keep command line --agent if specified.
208+
if (!args.agent) local.agent.set(msg.agent)
206209
if (msg.model) {
207210
local.model.set(msg.model)
208211
local.model.variant.set(msg.model.variant)

0 commit comments

Comments
 (0)