Present the new-session sheet instantly; load branches behind it - #450
Merged
Conversation
The sidebar pencil button (and Fork) blocked sheet presentation on loadBranches(), whose fetchAndGetDefaultRemoteBaseBranch runs a network git fetch --all — multi-second on slow networks or unreachable remotes. - preselectRepository is now synchronous (repo match only); the sheet presents immediately and beginBranchLoad() runs git behind the sheet's existing isLoadingBranches spinner, setting the loading flags synchronously so the first frame never flashes an empty picker. - configureForFork is synchronous too, and loads branches with applyDefaultBaseBranch: false so the late fetch fills the picker but cannot overwrite fork's deliberate baseBranch = nil (current HEAD). - loadBranches is generation-guarded: switching repositories while a slow fetch is in flight discards the superseded load's results. - New MultiSessionLaunchBranchLoadTests pin the contract in the headless core gate. Also repairs the app-target test bundle, which had rotted unnoticed (nothing gates it): adds the AgentHubTests testable to the shared AgentHub scheme so xcodebuild test works headless, and restores missing AgentHubSessionGraph/AgentHubCLIKit imports in five test files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Users reported the start-thread sheet (sidebar pencil button) taking seconds to appear. Presentation was blocked on
await loadBranches(), whosefetchAndGetDefaultRemoteBaseBranchruns a networkgit fetch --all— multi-second on slow networks and worst-case a DNS/connect timeout per unreachable remote. The Fork flow had the same await-before-present pattern.Fix
preselectRepositoryis now synchronous (repository match only). The pencil flow presents the sheet immediately and calls the newbeginBranchLoad(), which setsisLoadingBranches/isLoadingCurrentBranchsynchronously (no empty-picker flash on the first frame) and runsloadBranches()behind the sheet's existing loading state.configureForForkis synchronous too, seeding the form first and loading branches with the newapplyDefaultBaseBranch: falsemode — the late fetch fills the picker but can no longer overwrite fork's deliberatebaseBranch = nil(base = current HEAD) or the seeded branch name.loadBranchesis generation-guarded: if the user switches repositories while a slow fetch is in flight, the superseded load discards its results instead of stomping the newer repo's state.Note: in worktree mode, launching before the fetch settles now bases the worktree on current HEAD (the picker shows "Loading…" during that window). Previously that window was spent staring at a frozen click before the sheet appeared.
Test-infra repairs (found while validating)
The app-target test bundle (
app/AgentHubTests) had rotted unnoticed — nothing gates it headless:AgentHubscheme had no testables, soxcodebuild … -scheme AgentHub test(the command in CLAUDE.md) errored. Added theAgentHubTeststestable reference.AgentHubSessionGraph/AgentHubCLIKitimports in five test files that no longer compiled.CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM=) because the homebrew libgit2 dylib's Team ID doesn't match a dev-signed test host.Testing
MultiSessionLaunchBranchLoadTests(headless core gate) pin the contract: fork seeds synchronously, the load preserves the seeded base, and the default flow still applies a base branch. 2/2 passed../scripts/test.sh: all fast packages ✓; the AgentHubCore suite reported failures only in the documented timing-flaky families (DiffAvailabilityService, SessionNameRequestMonitor, WorktreeDeletionRequestMonitor, WorktreeLaunchRequestMonitor, GitHubCIFailureNotifier, workspace-attach suites — see TestQuarantine.md/Re-enable 18 quarantined AgentHubCore tests (headless failures + hangs) #380), none intersecting this diff.🤖 Generated with Claude Code