Repository navigation
fix(tui): wait for agent and model before auto-submitting --prompt - #51938
Merged
Merged
Conversation
The home screen submitted --prompt once model preferences loaded, but submit also needs the selected agent. When the agent list arrived later, submit returned without sending and the prompt was never retried. Wait for the same readiness the session screen already requires.
11 tasks done
FrozenPandaz
pushed a commit
to nrwl/nx
that referenced
this pull request
Nov 27, 2026
## Current Behavior With OpenCode 2.x installed, the agentic flow of `nx migrate --run-migrations` can't start the agent. Nx launches every OpenCode with the 1.x arguments, and 2.x rejects one of them: ``` Unrecognized flag: --agent in command opencode ``` OpenCode exits at once and the migrate run stays active. ## Expected Behavior Nx reads `opencode --version` and launches 1.x and 2.x with the arguments each accepts. A 2.x session starts on OpenCode's Build agent with Nx's instructions, even when a user config hides Build or makes it a subagent. Nx refuses OpenCode 2.x before 2.0.19 and prerelease builds, and asks the user to install a stable release, 2.0.19 or later. It then falls back to another installed agent, if there is one, and says why it skipped OpenCode. ## Related Issue(s) Fixes #38022 NXC-5300 ## Implementation Notes - The 2.x full-screen command has no `--agent`, and its UI sends `--prompt` with the first listed agent. Nx makes Build the default agent and gives it Nx's instructions through `OPENCODE_CONFIG_CONTENT`, which outranks user config files. - The same config pins Build's default `mode` and `hidden` values, so a user config can't move another agent ahead of it. - `--standalone` keeps the session off OpenCode's shared server, which keeps the config of the session that started it. - `opencode mini --agent` would select an agent directly. It wasn't used because its UI differs from the 1.x one and it reads its working directory from `PWD`. - Releases before 2.0.19 can leave the starting prompt unsent (anomalyco/opencode#51938). A prerelease version such as `0.0.0-beta-19507` doesn't show whether the build has that fix. - Admin-managed OpenCode settings load after Nx's config and can still override Build. The session can then stay open after the run ends. - Real migrate runs passed on OpenCode 1.19.6, 2.0.27, 2.0.32, 2.1.4, 2.2.7, 2.3.2, 2.4.1 and 2.4.2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
What does this PR do?
opencode --prompt <text>fills the home screen prompt but often never sends it.The home screen auto-submitted once model preferences were loaded (
local.model.ready), but submit also needs the selected agent. When the agent list arrived later, submit returned early without sending, and because the auto-submit only runs once, the prompt was never retried.The home screen now waits for the same readiness the session screen already requires before sending a startup prompt: the model catalog, the current agent, and the current model.
How did you verify your code works?
home startup prompt is submitted exactly oncetopackages/tui/test/app-lifecycle.test.tsx. It fails without the fix and passes with it; the full file passes.bun typecheckinpackages/tui.--promptagainst a local server; the prompt is sent.Checklist