Skip to content

Recover a conversation after the TypeScript client loses its create response #5035

Description

@neubig

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_conversation onto an existing id, without the duplicate path disturbing the surviving conversation.
  • The server advertises this via an idempotent_conversation_create_v1 capability 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.

Fixed by #5362 (server) and #5363 (client).

Activity

  1. added
    ready-for-dev
    on Sep 14, 2026
  2. removed
    ready-for-dev
    on Sep 14, 2026
  3. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    ⚠️ Not yet ready-for-dev

    This issue does not yet meet the readiness criteria, so the
    ready-for-dev label has not been applied (or has been removed).
    The criteria are type-specific:

    Bug reports (bug label, see .github/ISSUE_TEMPLATE/bug_template.yml):

    • The ### Actual Behavior section must describe reproducible SDK steps
      and include a command such as python, pytest, uv, or pip.
    • An ### Acceptance Criteria section with at least one checklist item (- [ ] …).

    Enhancements (enhancement label, see .github/ISSUE_TEMPLATE/feature_request.yml):

    • A ### Desired Behavior section.
    • An ### Acceptance Criteria section with at least one checklist item.

    What is missing:

    • Add a ### Desired Behavior section describing the behavior you want.
    • Add an ### Acceptance Criteria section with testable checklist items.

    Edit the issue to address the gaps and the ready-for-dev label will be
    applied 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.

  4. added
    enhancement
    javascript
    ready-for-dev
    on Sep 14, 2026
  5. removed
    ready-for-dev
    on Sep 14, 2026
  6. added
    ready-for-dev
    on Sep 14, 2026
  7. removed
    ready-for-dev
    on Sep 14, 2026
  8. self-assigned this
    on Sep 14, 2026
  9. added
    ready-for-dev
    on Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementjavascriptready-for-devsdk

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions