An explicit options.startFromOrigin passed without envMode was overwritten
by the cross-project re-derivation. Guard on the option's presence.
Co-Authored-By: Claude Fable 5 <[email protected]>
- Share a single WorktreeRegistry instance between the deletion reactor and
the ws layer (previously two instances with divergent in-memory state).
- WorktreeRegistry: take the semaphore for reads too so a first-access disk
load can't clobber a concurrent mutation, and only update the in-memory
registry after the persist succeeds.
- WorktreeBasePlanner: claim the in-flight fetch slot synchronously so
concurrent pin/prefetch calls can't start duplicate fetches.
- Recognize uniquified retry suffixes (t3code/<hex>-N) as temporary worktree
branches so auto-rename still applies after a partial bootstrap retry.
- Re-derive startFromOrigin when a draft's mode flips via branch selection,
and when a stored draft is reused for a different project member; the
reused draft also re-derives its surface default instead of inheriting the
store's hard-coded local reset.
- Mobile waits for environment settings before auto-persisting a workspace
selection, so the pre-config fallback can't freeze the wrong default.
Co-Authored-By: Claude Fable 5 <[email protected]>
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]>