Skip to content

OpenClawKit: stabilize iOS ChatUI updates after gateway replies#18165

Merged
mbelinky merged 2 commits intomainfrom
port/ios-chatui-stability-sharedkit
Feb 16, 2026
Merged

OpenClawKit: stabilize iOS ChatUI updates after gateway replies#18165
mbelinky merged 2 commits intomainfrom
port/ios-chatui-stability-sharedkit

Conversation

@mbelinky
Copy link
Contributor

@mbelinky mbelinky commented Feb 16, 2026

Summary

Ports chat update stabilization for iOS shared OpenClawKit ChatUI.

Included

  • ChatViewModel stability adjustments for gateway reply/session update behavior
  • Matching ChatViewModel test updates

Scope

  • Shared OpenClawKit ChatUI source + tests only

Testing

  • cd apps/shared/OpenClawKit && swift test --filter ChatViewModelTests
  • Result: pass (8 tests)

Greptile Summary

This PR stabilizes iOS ChatUI updates after gateway replies with two key changes:

  • Message ID reconciliation: Adds reconcileMessageIDs and messageIdentityKey to preserve SwiftUI-stable UUIDs when messages are re-decoded from history payloads. Without this, every history refresh generates new UUIDs, causing SwiftUI to treat all messages as new items and triggering unnecessary re-renders and visual flicker.
  • Canonical session key handling: Reorders the session-key guard in handleChatEvent so that events belonging to the view's own pending run are never dropped due to a session key mismatch (e.g. gateway publishes "agent:main:main" while the view uses "main"). This prevents the UI from getting stuck in a "thinking" state.

Both new tests (acceptsCanonicalSessionKeyEventsForOwnPendingRun, preservesMessageIDsAcrossHistoryRefreshes) directly cover the new behaviors. Note: the pre-existing test sessionChoicesPreferMainAndRecent is failing in the test output — this appears unrelated to this PR's changes, but should be investigated separately.

Confidence Score: 4/5

  • This PR is safe to merge — both changes are well-scoped, correctly implemented, and tested.
  • The changes are focused, logically sound, and address real UX issues (UI flicker from unstable message IDs, stuck "thinking" state from canonical key mismatches). The reconcileMessageIDs function handles edge cases like empty arrays and duplicate identity keys correctly. The session key guard reorder is minimal and well-commented. Two new tests directly cover the new behaviors. The only concern is the pre-existing failing test in the test output, which is unrelated to this PR.
  • No files require special attention from this PR. The pre-existing sessionChoicesPreferMainAndRecent test failure in the test output should be investigated separately.

Last reviewed commit: 489c9c7

@mbelinky mbelinky self-assigned this Feb 16, 2026
@openclaw-barnacle openclaw-barnacle bot added size: S maintainer Maintainer-authored PR labels Feb 16, 2026
@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

@mbelinky mbelinky force-pushed the port/ios-chatui-stability-sharedkit branch from 489c9c7 to 454dc51 Compare February 16, 2026 15:37
@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

@mbelinky mbelinky force-pushed the port/ios-chatui-stability-sharedkit branch from 454dc51 to f45eff9 Compare February 16, 2026 15:39
@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

@mbelinky mbelinky force-pushed the port/ios-chatui-stability-sharedkit branch from f45eff9 to c7a2734 Compare February 16, 2026 15:45
@mbelinky mbelinky force-pushed the port/ios-chatui-stability-sharedkit branch from c7a2734 to 9b6e38d Compare February 16, 2026 15:46
@github-actions
Copy link
Contributor

⚠️ Formal models conformance drift detected

The formal models extracted constants (generated/*) do not match this openclaw PR.

This check is informational (not blocking merges yet).
See the formal-models-conformance-drift artifact for the diff.

If this change is intentional, follow up by updating the formal models repo or regenerating the extracted artifacts there.

@mbelinky mbelinky merged commit 6effcdb into main Feb 16, 2026
20 of 21 checks passed
@mbelinky mbelinky deleted the port/ios-chatui-stability-sharedkit branch February 16, 2026 15:51
@mbelinky
Copy link
Contributor Author

Merged via squash.

Thanks @mbelinky!

archerhpagent pushed a commit to howardpark/openclaw that referenced this pull request Feb 18, 2026
…claw#18165)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 9b6e38d
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
…claw#18165)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 9b6e38d
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky

(cherry picked from commit 6effcdb)

# Conflicts:
#	CHANGELOG.md
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
…claw#18165)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 9b6e38d
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky

(cherry picked from commit 6effcdb)

# Conflicts:
#	CHANGELOG.md
#	apps/shared/MoltbotKit/Sources/MoltbotChatUI/ChatViewModel.swift
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…claw#18165)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 9b6e38d
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants