fix: iOS chat streaming stays visually stable as replies arrive#50483
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1f9853bc9
ℹ️ 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".
Greptile SummaryThis PR addresses three root causes behind iOS chat instability: session mis-scoping, stream acceptance / initial-load churn, and repeated layout re-parses. The changes are well-motivated and the majority of the implementation is sound — the stable Key findings:
Confidence Score: 3/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a08fd3040
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21aad88f23
ℹ️ 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".
21aad88 to
5df7c10
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5df7c10821
ℹ️ 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".
5df7c10 to
aa25cd5
Compare
P1 review thread fixes for openclaw#50483: 1. History sync after local finals: appendFinalAssistantMessage now always calls refreshHistoryAfterRun() instead of only when the append failed. This ensures tool results from local runs are persisted to canonical history. 2. Multi-client reconciliation: When external client finals arrive while this client has a pending run, immediately append the message AND schedule history refresh instead of deferring refresh until pendingRuns.isEmpty. This prevents cross-client history gaps. Added test cases: - appendsFinalAssistantMessageImmediatelyAndRefreshesHistory: validates history sync after local finals - externalFinalMessageRefreshesHistoryEvenDuringLocalPendingRun: validates multi-client reconciliation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa25cd5e5c
ℹ️ 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".
aa25cd5 to
830fb0c
Compare
830fb0c to
ad77e13
Compare
ad77e13 to
3d5e074
Compare
0c32438 to
01acd67
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f520a890b
ℹ️ 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".
6f520a8 to
8bfa960
Compare
P1 review thread fixes for openclaw#50483: 1. History sync after local finals: appendFinalAssistantMessage now always calls refreshHistoryAfterRun() instead of only when the append failed. This ensures tool results from local runs are persisted to canonical history. 2. Multi-client reconciliation: When external client finals arrive while this client has a pending run, immediately append the message AND schedule history refresh instead of deferring refresh until pendingRuns.isEmpty. This prevents cross-client history gaps. Added test cases: - appendsFinalAssistantMessageImmediatelyAndRefreshesHistory: validates history sync after local finals - externalFinalMessageRefreshesHistoryEvenDuringLocalPendingRun: validates multi-client reconciliation
Address copilot-pull-request-reviewer feedback on openclaw#50483: - Track optimistically-appended assistant messages by UUID in pendingOptimisticMessageIds so they are not dropped during the race window between append and history refresh. - reconcileRunRefreshMessages now accepts pendingOptimisticIds and preserves any previous messages matching those IDs that are absent from incoming history. - refreshHistoryAfterRun clears pendingOptimisticIds for messages now confirmed by the incoming history payload. - bootstrap also passes pendingOptimisticIds to reconcileRunRefreshMessages so bootstrap history loads are consistent with the same logic. - appendFinalAssistantMessage tracks new message IDs on append.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bfa960895
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1768568561
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbd9bbd46c
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89dab2506c
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 151405b3ff
ℹ️ 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".
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff1ecc4249
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5a032f220
ℹ️ 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".
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 6:58 AM ET / 10:58 UTC. Summary PR surface: Other +10. Total +10 across 4 files. Reproducibility: Source-reproducible: current main gives assistant text segments fresh UUIDs on each parse and renders the typing indicator solely from blocking run activity, so the reported visual instability path is clear from source. I did not run a live iOS streaming session. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrowed Chat UI fix after adding a short simulator or device streaming proof that shows visible streamed text replacing the Writing state without flicker. Do we have a high-confidence way to reproduce the issue? Source-reproducible: current main gives assistant text segments fresh UUIDs on each parse and renders the typing indicator solely from blocking run activity, so the reported visual instability path is clear from source. I did not run a live iOS streaming session. Is this the best way to solve the issue? Yes, this is the best narrow fix I found: it changes parser identity and duplicate-state rendering at the SwiftUI surface where the churn originates, while leaving current-main run-state and scroll ownership untouched. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c067802cda3a. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Other +10. Total +10 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (7 earlier review cycles)
|
|
Rebuilt this branch on top of current What changed:
Local verification:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29f6bd56d9
ℹ️ 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".
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
2 similar comments
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Co-authored-by: Eulices Lopez <[email protected]>
|
Land-ready review complete at The original stale branch was rewritten against current main. Retained: stable assistant-segment identity and removal of the duplicate typing state once streamed text is visible. Removed as obsolete: old session routing, bootstrap-state, event acceptance, and scroll-throttle changes now owned by current main implementations. Proof:
Contributor credit remains on the PR and in the implementation commit’s |
|
Merged via squash.
|
Related: #40985
What Problem This Solves
Fixes an issue where iOS and macOS chat could rebuild unchanged completed assistant segments during unrelated view updates and show both the typing indicator and visible streamed text at the same time. The result was avoidable flicker and a contradictory “Writing” state as replies arrived.
Why This Change Was Made
Assistant text parsing now gives semantic segments deterministic positional identities, so SwiftUI preserves unchanged markdown views. Chat rendering also computes visible streaming content once and uses that same fact for the stream bubble, transient-content state, empty state, and typing-indicator suppression.
The earlier branch’s session routing, bootstrap guards, and scroll throttle were intentionally removed during the current-main rewrite: those areas have since been replaced by the current run-state and reader-managed scrolling implementations.
User Impact
Chat replies transition from “Writing” to visible streamed text without rendering both states, and completed assistant content remains visually stable during unrelated updates.
Evidence
Thanks @eulicesl for identifying the streaming stability problems and iterating on the original implementation. The rewritten commit preserves contributor credit with a
Co-authored-bytrailer.