[PR #12922] fix(opencode): set session status before async operations #14437

Open
opened 2026-02-16 18:19:13 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12922

State: open
Merged: No


Summary

  • Set SessionStatus to busy before the fire-and-forget SessionPrompt.prompt() call in the prompt_async route, so clients see the correct status immediately
  • Add error handler to reset status to idle if the async prompt fails
  • Add null check for Agent.get() in createUserMessage to throw a clear error when an invalid agent name is provided

Closes #12860

Test plan

  • Call prompt_async and verify SessionStatus is busy immediately after the call returns
  • Verify that when the prompt completes, status transitions correctly
  • Verify that if the prompt fails, status resets to idle
  • Pass an invalid agent name and verify a clear error message is returned instead of a crash
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12922 **State:** open **Merged:** No --- ## Summary - Set `SessionStatus` to `busy` before the fire-and-forget `SessionPrompt.prompt()` call in the `prompt_async` route, so clients see the correct status immediately - Add error handler to reset status to `idle` if the async prompt fails - Add null check for `Agent.get()` in `createUserMessage` to throw a clear error when an invalid agent name is provided Closes #12860 ## Test plan - [ ] Call `prompt_async` and verify `SessionStatus` is `busy` immediately after the call returns - [ ] Verify that when the prompt completes, status transitions correctly - [ ] Verify that if the prompt fails, status resets to `idle` - [ ] Pass an invalid agent name and verify a clear error message is returned instead of a crash
yindo added the pull-request label 2026-02-16 18:19:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14437