Skip to content

Simplify immutable chat updates and image history selection - #911

Closed
Gajesh2007 wants to merge 1 commit into
masterfrom
refactor/chat-state
Closed

Gajesh2007 wants to merge 1 commit into
masterfrom
refactor/chat-state

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Chat content updates, thinking updates, and message patches each repeat a nested immutable chat/message traversal. Share that traversal while keeping existing object identity, append order, and persistence behavior. Finding the latest image turn now uses findLastIndex, avoiding a full history copy and reversal before every send/retry. Removes 34 production lines.

Targets master with the complete TypeScript validation from merged #902. Persistence keys, image limits, request shape, streaming flags, and nonmatching messages retain their existing behavior.

Validation: pinned Node 22 passes 697 tests, full TypeScript, ESLint (existing warnings), and Next build. Three new public-store characterization tests also pass against the original store: sibling identity, ordered content/thinking batches and metadata patches, unknown IDs, and image/streaming persistence boundaries. Existing image-history tests pass unchanged.

flowchart LR
  subgraph Before
    A[Token / thought / patch actions] --> B[Three nested chat and message traversals]
    B --> C[Immutable state and sanitized persistence]
    D[Send or retry] --> E[Copy and reverse history]
    E --> F[Newest image turn in API messages]
  end
Loading
flowchart LR
  subgraph After
    A[Token / thought / patch actions] --> B[mapMessage with specific update]
    B --> C[Same immutable state and sanitized persistence]
    D[Send or retry] --> E[findLastIndex]
    E --> F[Same newest image turn in API messages]
  end
Loading

Rebased onto merged #902 in master 06518dc93. The entire Git tree and the master-relative binary patch are identical to the previously reviewed source. Fresh Node 22.23.2 validation passes all 697 tests across 89 files with no skips and the complete TypeScript check; prior lint/build evidence applies to the identical source tree. The rebased commit has a verified SSH signature.

@vercel

vercel Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Ready Ready Preview Sep 12, 2026 11:30pm UTC
d-inference-console-ui-dev Ready Ready Preview Sep 12, 2026 11:30pm UTC
d-inference-landing Ready Ready Preview Sep 12, 2026 11:30pm UTC

Request Review

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-12T23:32:22.140824Z ec70980 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 3c019ac26f

ℹ️ 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".

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: bdc5dea767

ℹ️ 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".

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: ec70980bd7

ℹ️ 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".

@Gajesh2007

Copy link
Copy Markdown
Member Author

Consolidated into #1095 for review and merge into master. That PR contains this branch's exact head (ec70980), including its review fixes. Closing this smaller PR to collapse the stack; the branch and review history are retained. Follow #1095 for combined validation and merge status.

@Gajesh2007 Gajesh2007 closed this Sep 16, 2026

This branch had an error being deployed

1 failed and 3 active deployments
Preview – d-inference-console-ui-dev — ec70980b Deployed Sep 12, 2026 by vercel[bot]
Preview – d-inference — ec70980b Deployed Sep 12, 2026 by vercel[bot]
Preview – d-inference-landing — ec70980b Deployed Sep 12, 2026 by vercel[bot]
benchmarks — ec70980b Deployed Sep 12, 2026 by Gajesh2007 via E2E Benchmarks #1096
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant