Keep mobile chat GUI cached during reconnect

Merged
AZ
5mo ago
+909-269

Summary

  • preserve the mobile chat-session cache when the Mac connection is unavailable or a refresh fails
  • move chat-session snapshots into the shell store so leaving and re-entering a workspace does not discard the evidence that GUI history exists
  • render the GUI toggle from cached GUI-history snapshots immediately on workspace re-entry, with authoritative session refreshes replacing or clearing that cache
  • keep the selected terminal/pinned chat conversation store warm while terminal rendering is visible, so opening GUI chat reuses already-loaded history
  • reserve fixed toolbar slots for GUI chat + terminal picker, so first GUI-history discovery fades/scales the chat glyph without pushing the terminal picker or recentering the title
  • add a focused refresh-outcome policy test

Verification

  • inspected /Users/abdulazizalbahar/Downloads/ScreenRecording_06-29-2026 15-53-13_1.mov frame-by-frame; the remaining jump was the chat button appearing alone before the terminal picker slot arrived
  • python3 scripts/swift_file_length_budget.py --budget .github/swift-file-length-budget.tsv
  • xcodebuild -workspace ios/cmux.xcworkspace -scheme cmux-ios -configuration Debug -destination "platform=iOS Simulator,name=iPhone 17" -derivedDataPath "$HOME/Library/Developer/Xcode/DerivedData/cmux-ios-guic" PRODUCT_BUNDLE_IDENTIFIER=dev.cmux.ios.guic "PRODUCT_DISPLAY_NAME=cmux DEV guic" CMUX_GIT_SHA=$(git rev-parse --short=10 HEAD)+ CMUX_DEV_TAG=guic CMUX_PRESENCE_BASE_URL= EXCLUDED_SOURCE_FILE_NAMES=Info.plist CODE_SIGNING_ALLOWED=NO SWIFT_OPTIMIZATION_LEVEL=-O SWIFT_COMPILATION_MODE=wholemodule GCC_OPTIMIZATION_LEVEL=s build
  • IOS_DEVELOPMENT_TEAM=7WLXT3NR37 ./ios/scripts/reload.sh --tag guic --device --device-id 4A52829D-6427-599F-A166-4058881D2DF4 (simulator build succeeded; physical iPhone build/install/auth launch succeeded)
  • ./scripts/reload-cloud.sh --tag guic (cloud unavailable, local fallback build succeeded)
  • curl -fsS http://127.0.0.1:17320/guic
  • CMUX_TAG=guic scripts/cmux-debug-cli.sh ping
  • CMUX_TAG=guic scripts/cmux-debug-cli.sh window display "LG HDR 4K"

Notes

  • verify-video skill was not present in the available session or local skill tree, so the recording was inspected with ffprobe/ffmpeg frame extraction instead.
  • swift test --package-path Packages/iOS/CmuxMobileShellUI is not usable for this iOS-only package locally because SwiftPM evaluates it as macOS and hits existing platform floor mismatches.
  • xcodebuild test -workspace ios/cmux.xcworkspace -scheme CmuxMobileShellUI is not configured for the test action.

Summary by CodeRabbit

  • New Features
    • Added workspace-scoped caching for chat-capable session descriptors and retrieval/recall APIs.
    • Added a refresh-outcome model to control how chat session lists update and whether selection can be invalidated.
    • Enabled chat conversation warming and refreshed session descriptor streams in the workspace detail UI.
    • Added an optional “run store task” mode for the chat screen.
  • Bug Fixes
    • Improved in-memory chat descriptor reconciliation to prevent stale/out-of-order updates.
    • Improved reconnect/backoff behavior to resume promptly when the transport source changes.
    • Better cleanup and fallback behavior when sessions/terminals temporarily disappear.
  • Tests
    • Added tests for refresh outcome behavior.