Skip to content

prompt_async returns 204 before prompt persistence completes #38092

Description

@tracycam

Description

The prompt_async handler forks the entire prompt operation, including user-message persistence, and immediately returns HTTP 204. A client can therefore observe a successful response before the prompt has been durably admitted. If the process or request scope ends in that window, the caller has no way to distinguish an accepted prompt from one that never reached storage.

Expected behavior

HTTP 204 should mean the user message has been persisted. Model execution can remain asynchronous.

Suggested change

Separate prompt admission from loop execution: await admission in the handler, then fork only the session loop when noReply is not set. A regression test can call promptAsync with noReply: true and immediately verify the message is present.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions