opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(tui): wait for model store before auto-submitting --prompt

Open altendky opened this issue 6 days ago • 1 comments

What does this PR do?

fixes https://github.com/anomalyco/opencode/issues/7485

When using --prompt, the prompt was being submitted in onMount() before sync data and model store were fully loaded, causing it to use a different default model than expected. Now uses a createEffect to wait for both sync.ready and local.model.ready before submitting.

To debug model selection, run: cd packages/opencode && bun dev --print-logs --log-level=DEBUG --prompt "hey"

Related issues: #7211, #7099

How did you verify your code works?

i compared running bun dev and waiting for it to load and then submitting a prompt vs. bun dev --prompt "heya". i observed both using the desired model with this change.

altendky avatar Jan 09 '26 12:01 altendky