Skip to content

fix(core): harden prompt loop and async session handling#21574

Open
sjawhar wants to merge 1 commit intoanomalyco:devfrom
sjawhar:fix/prompt-loop-async-handling
Open

fix(core): harden prompt loop and async session handling#21574
sjawhar wants to merge 1 commit intoanomalyco:devfrom
sjawhar:fix/prompt-loop-async-handling

Conversation

@sjawhar
Copy link
Copy Markdown

@sjawhar sjawhar commented Apr 8, 2026

Issue for this PR

Closes #17982
Closes #19855
Closes #21524

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This hardens the session prompt loop and the detached prompt_async/cancel paths.

It fixes prompt-loop continuation logic, improves message-v2 handling for incomplete/error cases, makes detached prompt_async execution/reporting safer, and prevents the TUI prompt/cancel path from leaking unhandled promise rejections into stderr.

How did you verify your code works?

  • cd packages/opencode && bun typecheck
  • cd packages/opencode && bun test test/server/session-messages.test.ts test/session/cancel.test.ts test/session/message-v2.test.ts test/session/prompt.test.ts
  • Verified no LSP diagnostics in session/prompt.ts, session/message-v2.ts, and server/routes/session.ts

Screenshots / recordings

N/A (core/session behavior change)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@sjawhar sjawhar force-pushed the fix/prompt-loop-async-handling branch from 277fd3a to 900e12f Compare April 9, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant