Repository navigation
Description
A conversation creation POST can succeed on the server while the TypeScript client loses its response or times out during startup. The caller then sees a failure even though the initial message may already have run.
The original acceptance criteria below assumed this could only be worked around client-side, by never replaying the POST. That assumption was wrong: the server already advertised an idempotent create contract (201 when a conversation is created, 200 when an existing one is returned, and the reuse path skips the initial message), but the check-then-act in ConversationService._start_conversation ran the existence check before the conversation's lifecycle lock and the create inside it. Two concurrent creates for one id could therefore both pass the check and both run the new-conversation path — two EventServices, is_new true for both callers, and the initial message delivered twice. fork_conversation had the same window. So replaying was unsafe because of a server bug, not because replay is inherently wrong. With that fixed, a re-send is the correct and much simpler remedy.
Acceptance criteria (updated):
- Concurrent creates for one conversation id are deduplicated under the conversation's lifecycle lock: exactly one applies, the other returns the existing conversation, and the initial message runs once.
- The same holds for
fork_conversationonto an existing id, without the duplicate path disturbing the surviving conversation. - The server advertises this via an
idempotent_conversation_create_v1capability so clients can gate a re-send. - The client re-sends a create that failed without an HTTP response, but only when the server advertises that capability and the caller supplied a conversation id; otherwise it preserves the original transport error as before.
- Explicit HTTP failures are preserved, never concealed by a retry.
- Covered by a concurrency test that fails against the previous code, and client tests against a real HTTP server.
Supersedes the GET-reconciliation workaround in #5036, which is being closed. Extracted from #4966 so response recovery can be reviewed independently of conversation-scoped runtime routing.
Activity
github-actions commentedon Sep 14, 2026
ready-for-devThis issue does not yet meet the readiness criteria, so the
ready-for-devlabel has not been applied (or has been removed).The criteria are type-specific:
Bug reports (
buglabel, see .github/ISSUE_TEMPLATE/bug_template.yml):### Actual Behaviorsection must describe reproducible SDK stepsand include a command such as
python,pytest,uv, orpip.### Acceptance Criteriasection with at least one checklist item (- [ ] …).Enhancements (
enhancementlabel, see .github/ISSUE_TEMPLATE/feature_request.yml):### Desired Behaviorsection.### Acceptance Criteriasection with at least one checklist item.What is missing:
### Desired Behaviorsection describing the behavior you want.### Acceptance Criteriasection with testable checklist items.Edit the issue to address the gaps and the
ready-for-devlabel will beapplied automatically.
Note: Section headings require exact
###matches from the templates.If a missing type label is reported, no action is needed from external
contributors — maintainers will add the label during triage.
This is an automated check — no AI was used to generate this comment.