fix(ios): stabilize chat streaming layout and session flow#50483
fix(ios): stabilize chat streaming layout and session flow#50483eulicesl wants to merge 2 commits into
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
Maintainer Review Update — 2026-04-06All open review threads resolved. CI is passing. CI Status
Validation
Ready for maintainer review. |
55779a7 to
6f520a8
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 June 8, 2026, 1:18 AM ET / 05:18 UTC. Summary PR surface: Docs +1, Other +396. Total +397 across 7 files. Reproducibility: yes. for the review blockers: PR-head source shows the recovered-bootstrap flag gap and the stale-refresh assistant-final path. The original iOS flicker/session-flow symptom still lacks an inspectable runtime artifact in this review. Review metrics: 1 noteworthy metric.
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:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Rebase onto current main, preserve the newer ChatViewModel session/history flow, fix the remaining stale-refresh and load-recovery defects, remove the changelog entry, and attach redacted real behavior proof for the iOS streaming scenario. Do we have a high-confidence way to reproduce the issue? Yes for the review blockers: PR-head source shows the recovered-bootstrap flag gap and the stale-refresh assistant-final path. The original iOS flicker/session-flow symptom still lacks an inspectable runtime artifact in this review. Is this the best way to solve the issue? No: the branch is a plausible bug fix, but not the best merge shape against current main until it is rebased, preserves current main's newer session/history implementation, and fixes the remaining state defects. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against b8adc11977ab. Label changesLabel justifications:
Evidence reviewedPR surface: Docs +1, Other +396. Total +397 across 7 files. View PR surface stats
Acceptance criteria:
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
|
|
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".
| await self.fetchModels() | ||
| self.errorText = nil | ||
| } catch { | ||
| self.hasLoadedInitialState = false |
There was a problem hiding this comment.
Mark recovered refreshes as loaded
When the initial load() bootstrap fails, this resets hasLoadedInitialState, but a later successful manual refresh() calls bootstrap() without ever setting the flag back to true. In that recovery path, the next view onAppear will run load() again and start a full bootstrap, which clears pending runs, tool calls, and streamingAssistantText; navigating away and back during a new in-flight reply after recovering from a startup error can therefore drop the active stream. Set the flag on any successful bootstrap, not only before load() starts one.
Useful? React with 👍 / 👎.
|
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. |
Summary
OpenClawChatUIlayer used by both iOS and macOS. The bug (cross-run UI drift during concurrent session-key agent events) affects any client usingChatViewModel; macOS uses the same chat view and benefits equally, but the fix is not platform-specific — it guards shared streaming state.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
git blame, prior PR, issue, or refactor if known): this branch supersedes fix(ios): use plain Text during streaming to eliminate markdown flicker [AI-assisted] #40985 by fixing the broader lane/acceptance/layout causes instead of only the earlier visible symptom.Regression Test Plan (if applicable)
apps/shared/OpenClawKit/Tests/OpenClawKitTests/ChatViewModelTests.swiftapps/shared/OpenClawKit/Tests/OpenClawKitTests/AssistantTextParserTests.swiftUser-visible / Behavior Changes
Diagram (if applicable)
N/A
Security Impact (required)
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
Steps
Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
swift test --package-path apps/shared/OpenClawKit --filter ChatViewModelTestsswift test --package-path apps/shared/OpenClawKit --filter AssistantTextParserTestsxcodegen generatexcodebuild -project apps/ios/OpenClaw.xcodeproj -scheme OpenClaw -destination 'generic/platform=iOS Simulator' CODE_SIGNING_ALLOWED=NO buildReview Conversations
chatgpt-codex-connector[bot]+copilot-pull-request-reviewer) resolved in this update.If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No): YesYes/No): NoYes/No): NoRisks and Mitigations