Skip to content

feat(chat): preserve conversation history#108

Draft
tcballard wants to merge 1 commit into
codex/restart-gateway-after-app-replacementfrom
codex/chat-conversation-history
Draft

feat(chat): preserve conversation history#108
tcballard wants to merge 1 commit into
codex/restart-gateway-after-app-replacementfrom
codex/chat-conversation-history

Conversation

@tcballard

Copy link
Copy Markdown
Contributor

Summary

Implements WF-ROADMAP-0015 desktop v0.1.0 conversation history.

Adds:

  • locally persisted conversations that remain available after starting a new chat or relaunching Wayfinder;
  • a conversation-first sidebar with chat titles, turn counts, timestamps, and full-text search;
  • deterministic state and persistence coverage for restoring older chats.

Scope

Included

  • Replace the destructive single-chat reset with creation of a separate conversation.
  • Restore a complete prior thread when its sidebar row is selected.
  • Store up to 100 non-empty conversations in a bounded local Application Support JSON file.
  • Keep chat selection disabled while a response is streaming.

Excluded

  • Cloud sync, export, sharing, or remote conversation storage.
  • Conversation renaming, deletion, folders, or pinning.
  • Routing, provider, credential, or gateway behaviour changes.

Product / Architecture Decisions

  • The sidebar represents conversations rather than individual turns; the transcript remains the place for turn-level review.
  • Conversation history is local-only and written to Application Support/Wayfinder/chat-history.json.
  • Empty draft conversations are not persisted or shown in history.
  • Storage is bounded to 100 conversations and 8 MiB; unreadable or malformed history fails safely to an empty list without blocking Chat.
  • Tests receive an in-memory store by default, while the shipped app explicitly selects the Application Support store.

User-Facing Contract

CLI

No CLI changes.

Human Output

“New chat” opens an empty conversation without deleting existing chats. Older conversations remain listed under Chats and can be restored by selecting them. Search covers conversation titles and message text.

JSON Output

No gateway JSON changes. The app owns a private local Codable persistence file that is not a public API contract.

Exit Codes

No exit-code changes.

Verification

Ran

env CLANG_MODULE_CACHE_PATH=/private/tmp/wayfinder-history-module-cache SWIFTPM_MODULECACHE_OVERRIDE=/private/tmp/wayfinder-history-module-cache WAYFINDER_DISABLE_SWIFTPM_SANDBOX=1 swift test --disable-sandbox --scratch-path /private/tmp/wayfinder-history-build --package-path macos/WayfinderMac

git diff --check

Covered

  • 173 Swift tests passed with zero failures.
  • Starting a new chat retains the prior conversation and selecting it restores all messages.
  • Local history round-trips through the persistence store in newest-first order.
  • Empty and malformed storage remain non-blocking by construction.
  • No manual or visual app testing was performed; maintainer testing is intentionally deferred.

Review Path

  1. ChatConversation.swift for the persisted conversation boundary.
  2. ChatConversationStore.swift for local storage bounds and failure behaviour.
  3. AppState.swift for new-chat, selection, and save transitions.
  4. ChatSidebarView.swift and WayfinderChatWindow.swift for conversation navigation.
  5. ChatStateTests.swift for lifecycle and persistence coverage.

Notes For Reviewer

This PR is stacked on PR #106 because PR #107 was merged into that branch rather than main. After #106 lands, rebase or retarget this PR to main before merging.

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