Skip to content

fix: open launched checkout on first local load - #86

Merged
flexdinesh merged 1 commit into
mainfrom
fix-initial-repo-selection
Oct 22, 2026
Merged

flexdinesh merged 1 commit into
mainfrom
fix-initial-repo-selection

Conversation

@flexdinesh

Copy link
Copy Markdown
Owner

Fixes / opening the wrong worktree after diffx . in a linked worktree.

Cause: local scope widens as each checkout finishes collecting (4 parallel workers). / opened the most active head among whichever checkouts had finished first, then never replaced it. That's often a small, older worktree.

  • Behavior owner and resulting change:
    • serverapp.Published.Newest: changed heads first, then the deepest checkout whose root contains the launch path (current request's TriggerRoot), then activity. Uses the request metadata because reused observations keep their first run's metadata.
    • POST /api/v2/collections returns defaultContextId. / waits for local startup collection (existing skeleton), then opens it. /streams/{id} still opens immediately.
    • collector discovery canonicalizes symlinked input paths so they compare against Git's canonical checkout roots.
  • Contracts/invariants affected; local/remote implications:
    • CollectionResult adds the required field defaultContextId (local-only route). Bare /mcp default follows the same rule. Remote is unaffected.
    • Clean launch checkout falls back to the most active changed head.
  • Validation results; remaining risks:
    • mise run check: pass (Go, contracts, 91 browser tests).
    • New tests: Go launch preference (incl. reused observation, nested worktree, name-prefix sibling), symlinked input; browser root waits for default (verified failing without the fix).
    • Real-binary smoke: diffx . in a linked worktree returned that worktree as default over a more active main checkout.
    • Risk: fresh / loads now wait for full local collection instead of the first finished checkout.
  • Intentional architecture/design changes and rationale: docs/system.md, docs/development.md, usage.md updated. The launch path expresses which checkout the user is working in.
  • UI evidence: no visual changes; reuses the existing collecting skeleton.

Root URL opened whichever checkout finished collecting first. Wait for
startup collection and open its default, preferring the checkout that
contains the launch path, then most recent activity.
@flexdinesh
flexdinesh marked this pull request as ready for review October 22, 2026 04:26
@flexdinesh
flexdinesh enabled auto-merge (squash) October 22, 2026 04:26
@flexdinesh
flexdinesh merged commit 8cba71e into main Oct 22, 2026
2 checks passed
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