Skip to content

Disable session resume UI for worktree chats#67

Merged
mcintyre94 merged 4 commits intomainfrom
i-ve-noticed-an-issue-with-my-claude-session-resum-46a71a16
Mar 12, 2026
Merged

Disable session resume UI for worktree chats#67
mcintyre94 merged 4 commits intomainfrom
i-ve-noticed-an-issue-with-my-claude-session-resum-46a71a16

Conversation

@mcintyre94
Copy link
Copy Markdown
Owner

Summary

  • Session suggestions view is hidden when a chat has a worktree (worktrees are always fresh, nothing to resume)
  • fetchRemoteSessions exits early when worktreePath is set, avoiding a wasteful exec call
  • worktreePath changed from private to private(set) so ChatView can read it

Test plan

  • Open a chat with worktrees enabled — confirm no session suggestions UI appears on the empty chat screen
  • Open a chat without worktrees — confirm session suggestions still load and display normally

🤖 Generated with Claude Code

Worktrees are always fresh so there's nothing to resume — suppress the
SessionSuggestionsView entirely and skip the remote session fetch when
worktreePath is set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude bot commented Mar 12, 2026

Code review

Missing unit test for modified view model logic (CLAUDE.md)

CLAUDE.md requires: "Add new unit tests when adding or modifying logic (models, parsers, utilities, view models)"

fetchRemoteSessions in ChatViewModel.swift has a new conditional code path (early return when worktreePath != nil), but no test was added to WispTests/ChatViewModelTests.swift. There is also no pre-existing coverage for this function.

A test verifying that fetchRemoteSessions is a no-op when worktreePath is set would be expected — e.g. assert that remoteSessions stays empty and no exec call is made when a worktree path is present.

Relevant code:

func fetchRemoteSessions(apiClient: SpritesAPIClient, existingSessionIds: Set<String>) {
// Worktrees are always fresh — no sessions to resume
guard worktreePath == nil else { return }
guard !isLoadingRemoteSessions else { return }
isLoadingRemoteSessions = true

mcintyre94 and others added 3 commits March 12, 2026 22:12
Verifies that fetchRemoteSessions is a no-op for worktree chats:
remoteSessions stays empty and isLoadingRemoteSessions stays false,
confirming no network work is initiated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
worktreePath is nil on a new chat — the worktree is only created on the
first message. The previous guard checked worktreePath != nil, so it
missed the case where worktrees are enabled but not yet set up.

Add usesWorktree computed property that returns true when worktreePath
is set OR worktreePerChat is enabled, and use it in both fetchRemoteSessions
and the ChatView visibility guard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Checking UserDefaults["worktreePerChat"] was too aggressive — it hid
the sessions UI on sprites without git, where worktree setup silently
fails and sessions remain valid.

Instead, query sibling SpriteChats for the same sprite: if any have
worktreePath set, the sprite has git and new chats should suppress
the resume UI. Also set spriteUsesWorktrees = true immediately when
a worktree is first created, so subsequent new chats on the same sprite
are handled correctly without relying on session reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mcintyre94 mcintyre94 merged commit 72472c0 into main Mar 12, 2026
2 checks passed
@mcintyre94 mcintyre94 deleted the i-ve-noticed-an-issue-with-my-claude-session-resum-46a71a16 branch March 12, 2026 22:29
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