Files
t3code/apps/web
Theo BrowneandClaude Fable 5 590103ee7f Surface-derived workspace defaults, pinned worktree bases, and worktree registry
Implements the new-thread workspace model: every new thread starts from the
resolved default workspace mode instead of inheriting the previous thread's
choices, and worktree threads pin a fresh remote base with visible provenance.

Surface-derived defaults
- New `deriveThreadEnvModeFromSurface` setting (default on): attached
  surfaces (desktop app, loopback browser on a host-managed environment)
  default to the current checkout; detached surfaces (remote browser,
  mobile, relay/SSH) default to a fresh worktree. Explicit
  `defaultThreadEnvMode` still pins a mode globally when derivation is off,
  keeping the wire value decodable by older clients.
- Sticky per-draft inheritance retired: sidebar/new-thread actions no longer
  seed mode/branch/worktree from the active thread. `chat.newLocal` remains
  the explicit current-checkout exception (draft-only).
- Per-project override (`projectThreadEnvModeOverrides` client setting) via
  an explicit "Always … for this project" action in the workspace picker —
  the only sanctioned way a composer choice retrains the default.

Fresh worktree bases without a blocking fetch
- `WorktreeBasePlanner`: fetch within the 30s freshness window counts as
  fresh; concurrent fetches dedupe per repository; a failed fetch with a
  successful fetch within the last hour proceeds on the last-known remote
  commit (fail-visible, "stale" provenance); otherwise the bootstrap fails
  closed and never silently falls back to a local ref.
- Composer prefetch: worktree-mode drafts fire `vcs.prefetchRemote` on open
  so the send-time check almost always hits the fresh window.
- `newWorktreesStartFromOrigin` now defaults on.

Provenance and registry
- Bootstrap records a `worktree.base-pinned` thread activity (base ref, sha,
  provenance, fetch time); the branch toolbar renders the pinned fact
  ("Worktree · a1b2c3f") with provenance on hover.
- `WorktreeRegistry` persists thread↔worktree records to
  `stateDir/worktree-registry.json`, updated at bootstrap and on thread
  deletion — groundwork for lifecycle/GC tooling.
- Deterministic branch naming: worktree branches derive from the thread id
  (`t3code/<uuid-prefix>`), with collision suffixing server-side.

Composer UX
- Dirty-checkout disclosure both directions with one-click mode switch.
- Workspace picker labels choices as "this draft only".

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-13 19:57:26 -07:00
..
2026-06-29 22:57:48 +00:00