Skip to content

feat(git,session): add branch-selected worktree sessions - #331

Merged
AprilNEA merged 12 commits into
masterfrom
chenyu/code-430
Jul 30, 2026
Merged

feat(git,session): add branch-selected worktree sessions#331
AprilNEA merged 12 commits into
masterfrom
chenyu/code-430

Conversation

@lucas77778

Copy link
Copy Markdown
Member

Summary

Implements Linear CODE-425 and its five child issues:

  • add local-only git.branch.list, with the current branch first and remaining branches ordered by recent commit time
  • resolve non-current branch selections into serialized, daemon-managed worktrees with durable ownership records and typed missing-worktree failures
  • represent worktree workspaces explicitly and group their sessions under the parent project
  • add a Git-gated branch picker to the new Thread flow, including remembered defaults, i18n, and desktop E2E coverage
  • clean managed worktrees after durable session deletion only when branch/status/upstream/ahead checks prove removal safe; otherwise persist them as orphaned
  • reconcile ownership and disk state at daemon startup, including conservative two-level orphan discovery

Wire protocol versions are bumped in lockstep from 52 to 55 across the three schema-changing commits.

Verification

  • NODE_OPTIONS=--max-old-space-size=4096 devenv shell -- pnpm typecheck
  • devenv shell -- pnpm test — 246 files / 1,945 tests passed; 1 file / 1 test skipped
  • CODE-430 focused integration tests — 3 files / 28 tests passed
  • devenv shell -- pnpm format:check — 1,154 files passed
  • changed-file ESLint — no errors
  • daemon and desktop production builds passed
  • desktop new-session branch E2E passed under Xvfb with a real Git repository and isolated daemon

pnpm check:ci could not complete as a single command because whole-repository ESLint exhausts the available orb heap. Its format and typecheck stages pass, and ESLint passes for every changed TypeScript file.

Checklist

  • pnpm check:ci and pnpm test both pass (full tests pass; whole-repo ESLint is blocked by the documented orb heap limit above)
  • The affected surfaces were run and observed working
  • Wire message changes bump WIRE_PROTOCOL_VERSION
  • New code and assets are original work
  • Relevant behavior comments and Linear implementation records are updated

Copilot AI review requested due to automatic review settings July 30, 2026 04:02
@linear-code

linear-code Bot commented Jul 30, 2026

Copy link
Copy Markdown

CODE-430

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 30, 2026 05:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

lucas77778 commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

Master sync and acceptance evidence

Merge commit 42a5cc3 synchronizes the branch with master at 765cbcd. GitHub reports the PR as MERGEABLE; all CI and CodeQL checks pass.

Conflict resolution

Resolved and integrated both sides in:

  • apps/daemon/src/index.ts
  • apps/desktop/package.json
  • packages/client/workbench/src/surface/workbench.tsx
  • packages/foundation/schema/src/wire/message.ts
  • packages/presentation/ui/src/shell/new-session-surface.tsx
  • packages/presentation/ui/src/shell/__tests__/new-session-surface.test.tsx

The merged result preserves master's channel-aware daemon state, simulator consent, browser tooling, controlled workspace catalogs, and Pi coverage while retaining CODE-425 worktree storage/injection and branch selection. Because the combined wire surface contains both master's changes and CODE-425 variants, the wire protocol moves from 62 to 63, including the desktop E2E fixture.

The real Electron E2E also sets LINKCODE_CHANNEL=development for its daemon so the unpackaged desktop and daemon discover the same isolated runtime.json after the channel-aware state change from master.

Verification

  • Targeted CODE-425 suite: 70 passed
  • Full Vitest suite: 2142 passed, 1 skipped (267 files passed, 1 skipped)
  • Root TypeScript project build/typecheck: passed
  • Biome format check: 1224 files, no changes required
  • Changed TypeScript/TSX/MTS ESLint scope: 0 errors
  • Daemon and desktop production builds: passed
  • Real daemon + Electron + Git fixture E2E: PASS desktop new-session branch picker
  • Full-repository ESLint could not complete locally in the orb because Node exhausted its heap even at 4 GiB; no lint failure was suppressed. The GitHub TypeScript job subsequently passed formatting, lint, typecheck, tests, and daemon process acceptance in its clean environment.

Acceptance video

Watch/download the 10.7-second acceptance recording (MP4, 1280×800, H.264)

The recording drives the real built Electron app against a real daemon and temporary Git repository: it adds the project, opens the branch picker, shows feature/code-428 with the isolated-worktree explanation, selects it, and verifies the context bar reflects the branch.

@lucas77778
lucas77778 requested review from AprilNEA and Zerlight July 30, 2026 05:46

@AprilNEA AprilNEA left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

squash migration files

Copilot AI review requested due to automatic review settings July 30, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 30, 2026 11:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@lucas77778
lucas77778 requested a review from AprilNEA July 30, 2026 11:59
@AprilNEA
AprilNEA merged commit 1c00df3 into master Jul 30, 2026
10 checks passed
@AprilNEA
AprilNEA deleted the chenyu/code-430 branch July 30, 2026 12:50
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.

3 participants