Skip to content

feat(ios): complete deterministic Chat lifecycle#121

Merged
tcballard merged 3 commits into
mainfrom
codex/ios-chat-state-machine
Jul 24, 2026
Merged

feat(ios): complete deterministic Chat lifecycle#121
tcballard merged 3 commits into
mainfrom
codex/ios-chat-state-machine

Conversation

@tcballard

Copy link
Copy Markdown
Contributor

Summary

Implements the final Phase 2 Chat lifecycle in WF-ROADMAP-0016.

Adds:

  • deterministic, network-free assistant streaming behind a typed provider contract
  • persisted user and assistant message states with stop, interruption recovery, failure, and retry
  • simulator coverage plus updated mobile design, roadmap, and build documentation

Scope

Included

  • ordered provider deltas applied to one authoritative assistant message
  • pending, streaming, completed, stopped, interrupted, and failed message states
  • idempotent cancellation and retry that preserves the earlier failed attempt
  • compact route receipts on assistant replies and automatic transcript scrolling
  • restoration of abandoned pending or streaming replies as interrupted
  • removal of the empty iOS 26 hidden-tab glass bar and its blank accessibility tabs
  • deterministic mock success and failure outcomes with no network access

Excluded

  • Keychain or provider credentials
  • live hosted providers or API requests
  • Apple Foundation Models execution
  • account authentication, Kimi, or paired-Mac support
  • changes to macOS provider or credential boundaries

Product / Architecture Decisions

  • The Phase 2 provider implements a small typed ProviderExecutor contract and emits ordered deltas plus one terminal completion event.
  • AppModel owns one active request identifier and rejects concurrent sends, thread changes, and new-chat actions while generation is active.
  • A partial response remains visible when execution fails; the terminal error is represented by status rather than replacing received content.
  • Retry creates a new request and message pair while retaining the original failed, stopped, or interrupted attempt.
  • The deterministic provider is explicitly described as network-free and is not presented as a live model.
  • Compact-width navigation remains drawer-driven; the hidden TabView was removed because iOS 26 rendered it as an empty glass capsule.

User-Facing Contract

CLI

No CLI changes.

Human Output

  • Send produces a conventional user message and streamed assistant reply.
  • The send control becomes Stop while a reply is active.
  • Failed, stopped, and interrupted replies show a concise status and Retry action.
  • Routing detail remains behind the compact receipt rather than occupying transcript space.

JSON Output

No public JSON schema changes. Conversation exports may now contain the streaming message-status value while an in-progress state is persisted.

Exit Codes

No exit-code changes.

Verification

Ran

xcodebuild test
  -project ios/WayfinderIOS/WayfinderIOS.xcodeproj
  -scheme WayfinderIOS
  -destination 'platform=iOS Simulator,name=iPhone 17,OS=latest'
  CODE_SIGNING_ALLOWED=NO

Result: 22 tests passed, 0 failed, with no build warnings.

Also built, installed, launched, and exercised the app on an iPhone 17 simulator. Verified:

  • empty Chat shell has no residual bottom tab surface
  • accessibility hierarchy exposes no blank tab controls
  • sending renders distinct user and assistant content
  • deterministic reply completes with a compact on-device route receipt

Covered

  • ordered fragmented deltas and one terminal assistant message
  • cancellation before output and stopped persistence
  • failure after partial output
  • retry preservation and new-attempt creation
  • pending/streaming restoration as interrupted
  • SwiftData round-trip of streaming status
  • privacy-based route exclusion
  • multi-turn persistence and thread restoration

Review Path

  1. ChatExecution.swift for the bounded provider and event contract.
  2. AppModel.swift for routing, execution transitions, persistence, stop, and retry.
  3. ChatTabView.swift and RootView.swift for transcript/composer and compact navigation behavior.
  4. AppModelTests.swift and ConversationStoreTests.swift for lifecycle evidence.
  5. Design, roadmap, and README updates for the Phase 3 boundary.

Notes For Reviewer

The response is intentionally deterministic and network-free. Phase 3 owns Keychain and the first live OpenAI-compatible provider; this PR does not anticipate or broaden those credential boundaries.

@tcballard
tcballard marked this pull request as ready for review July 24, 2026 14:20
@tcballard
tcballard merged commit 891ca11 into main Jul 24, 2026
4 checks passed
@tcballard
tcballard deleted the codex/ios-chat-state-machine branch July 24, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant