Skip to content

fix(api): Delay persisting case chat sessions until first message#2183

Merged
topher-lo merged 1 commit intomainfrom
feat/delay-case-chat-session-persistence
Feb 25, 2026
Merged

fix(api): Delay persisting case chat sessions until first message#2183
topher-lo merged 1 commit intomainfrom
feat/delay-case-chat-session-persistence

Conversation

@topher-lo
Copy link
Contributor

@topher-lo topher-lo commented Feb 25, 2026

Summary

  • keep the case chat draft state until the user submits the first message and only persist a session when needed
  • route the draft session through the chat body with new flags so the UI shows a pre-send placeholder and handles pending messages safely
  • adjust chat session pane handling for optional chat data and pending message tracking to avoid double sends

Testing

  • Not run (not requested)

Summary by cubic

Delay case chat session creation until the first message is sent, keeping a draft state in the UI and safely sending the initial message once the session exists. Non-case entities keep the existing auto-create behavior.

  • New Features

    • Case chats start as drafts; the session is created on first send via onBeforeSend.
    • Draft UI shows a pre-send placeholder and disables input while creating.
    • Tracks the first pending message and auto-sends it after creation.
    • Preserves auto-create for non-case entities; case chats no longer auto-create on open.
    • Shows a toast with parsed errors if chat creation fails.
  • Bug Fixes

    • Prevents double-sending the first message with per-chat message keys.
    • Avoids rendering tools when no chat exists.
    • Cleans up loading states and error handling in ChatBody.

Written for commit 852e886. Summary will update on new commits.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 852e886b53

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@topher-lo topher-lo added the fix Bug fix label Feb 25, 2026
@topher-lo topher-lo changed the title Delay persisting case chat sessions until first message fix(api): Delay persisting case chat sessions until first message Feb 25, 2026
@topher-lo topher-lo merged commit 193bceb into main Feb 25, 2026
13 checks passed
@topher-lo topher-lo deleted the feat/delay-case-chat-session-persistence branch February 25, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant