Skip to content

Fix web chat streaming reconciliation across reconnects - #362

Merged
rogeralsing merged 1 commit into
mainfrom
codex/fix-streaming-rendering-in-ui
Oct 24, 2025
Merged

rogeralsing merged 1 commit into
mainfrom
codex/fix-streaming-rendering-in-ui

Conversation

@rogeralsing

Copy link
Copy Markdown
Contributor

Summary

  • keep chat DOM controller entries keyed by runtime IDs across reconnects so streaming updates replace the existing rows instead of duplicating them
  • add a jsdom-backed regression test that reproduces the reconnect scenario and asserts a single message bubble survives the stream
  • document the reconnect-aware behaviour in the chat services context summary

Testing

  • npm test -- packages/web/frontend/src/js/services/tests/chat_domController.test.ts

https://chatgpt.com/codex/tasks/task_e_68fb8e5f890c832897eee0613e220054

@rogeralsing
rogeralsing merged commit 9ada80d into main Oct 24, 2025
1 check failed

@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

beginRuntimeSession() {
runtimeGeneration += 1;
for (const [eventId, record] of messageEntries) {
if (!record.entry.wrapper.parentElement || record.entry.final) {
messageEntries.delete(eventId);
}
}
for (const [eventId, record] of commandEntries) {
if (!record.entry.wrapper.parentElement) {
commandEntries.delete(eventId);
}
}

P1 Badge Clear stale command entries when runtime restarts

Command entries survive beginRuntimeSession() unless their DOM wrapper has been removed. When a reconnect spins up a fresh agent runtime, the event IDs restart (createRuntimeEmitter uses the same prefix with a counter that resets), so the first command in the new run reuses an eventId that already exists in commandEntries. Because the stale record remains, appendCommand updates the old bubble instead of creating a new row, hiding the new command’s output. Message entries avoid this by dropping final entries, but commands never get pruned. Consider tracking command completion or clearing the command map on session boundaries so IDs from new runtimes cannot collide.

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

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