Two shapes need two paths
A UI tested only with the immediate answer can break exactly when the gateway outcome becomes uncertain. The durable-job branch must preserve the user's conversation association and avoid adding an empty assistant message that later masquerades as a real answer. Treat valid response-envelope decoding as a prerequisite. The distinct regression target is the pending assistant slot: a valid deferred branch and later fixture content must attach once to the correct conversation turn, without an empty fabricated answer or duplicate local message.
What to do next
- 01
Build separate test envelopes
Create one fixture for the documented confirmed completion and one for the documented uncertain job. Include the response status in the fixture, and validate required fields for each variant instead of casting both into one type.
- 02
Assert different UI outcomes
For confirmed completion, attach the returned answer to its conversation turn. For the job variant, show that the response is still being confirmed and retain the associated task without presenting invented text.
- 03
Complete the deferred path
Drive the uncertain-job fixture through follow-up completion and private JSON retrieval in your test environment. Verify that the eventual assistant response fills the original pending turn once, rather than creating a second unrelated conversation message.
A concrete example
Illustrative example: a test sends one user turn and receives 202 with a job. The conversation displays one pending assistant slot. When the fixture later yields the confirmed stored answer, that slot is completed without another paid submission.
Before you call it ready
- Both response statuses are covered.
- Pending turns contain no fabricated answer.
- Deferred completion attaches exactly once.
When to stop or choose another method
Stop shipping a chat integration whose only success test assumes choices is present immediately on every successful HTTP response.
