fix(tui): Don't overwrite the agent that was specified on the command line#20554
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: PR #18586: "fix(tui): prevent subagent sessions from overwriting the selected agent" This PR appears to address a similar issue where agent selection was being unintentionally overwritten in certain scenarios (specifically for subagent sessions in the TUI). Your current PR (#20554) handles the same type of problem but specifically for the command-line interface when both These are likely addressing different code paths but the same underlying concern about preserving intentional agent selection. |
I checked #18586 and it is unrelated (it deals with subagents, not the collision between -s and --agent), although also making changes close to where I made a changes, in the same file. What it is doing will not be influenced by this patch (or the other way around). |
d1cfe84 to
6ec6bef
Compare
If both -s and --agent are given, we should pick the agent from the latter. Closes anomalyco#20536
dbbe48d to
ec56964
Compare
If both -s and --agent are given, we should pick the agent from the latter.
Issue for this PR
Closes #20536
Type of change
What does this PR do?
At this point the command line arguments are already known; so we can simply check
for the existence of
args.agent(withconst args = useArgs()) to know if an --agentcommand line parameter exists. If it does then the agent found in the last user message
of the given session ID -- that previously was unconditionally used to overwrite whatever
was in
local.agent-- is no longer used. We simply keep the agent value that wasspecified on the command line.
How did you verify your code works?
I repeated the 'Steps to reproduce' steps of #20536.
I can now specify -s and --agent at the same time and pick any agent I want.
Checklist