Skip to content

Handle failed optimistic user messages - #388

Open
SaravanakumarR2018 wants to merge 1 commit into
mainfrom
codex/add-optimistic-message-failure-handling
Open

Handle failed optimistic user messages#388
SaravanakumarR2018 wants to merge 1 commit into
mainfrom
codex/add-optimistic-message-failure-handling

Conversation

@SaravanakumarR2018

Copy link
Copy Markdown
Owner

Motivation

  • Preserve user-submitted messages in the UI when a send fails by marking optimistic messages as failed instead of removing them, improving error visibility and preserving user intent.

Description

  • Add src/frontend/src/utils/optimisticMessageUtils.ts with markOptimisticMessageFailed to set optimistic: false and failed: true on a message object.
  • Update the playground send flow in src/frontend/src/modals/IOModal/playground-modal.tsx to create an optimistic user message (using uuid) and addMessage it before sending, and to call markOptimisticMessageFailed on catch to preserve the message state on error.
  • Change addMessage logic in src/frontend/src/stores/messagesStore.ts to replace an existing optimistic/failed user message when the real user message arrives by matching sender, session_id, and text, preventing duplicate messages.
  • Remove an unused setIsBuilding selector and update sendMessage dependencies accordingly.

Testing

  • No automated tests were run.

Codex Task

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

Copy link
Copy Markdown

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: 6902063bc8

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,18 @@
import { MessageType } from "@/types/messages";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Import existing message type to avoid build failure

The new utility imports MessageType from @/types/messages, but that module only exports Message (see src/frontend/src/types/messages/index.ts). Because this is a value import (not import type) and the project uses isolatedModules/noEmit, bundlers like Vite/esbuild will treat it as a runtime import and error with “export not found,” and TypeScript will also fail the build. Use the existing Message type (ideally via import type { Message }) or add a real MessageType export.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant