2.1 KiB
Handoff Environment Selection: PWD-Based Overlap at Activation
Linear: APP-4427
Summary
When a user enters & handoff compose mode or uses /handoff, auto-select the cloud environment that matches the repo they're currently working in — at activation time, not after pressing Enter. This replaces the current two-layer system where the environment visibly shifts after the handoff is dispatched.
Figma: none provided
Behavior
-
When the user types
&or runs/handoff(no query), the system checks the terminal's current working directory for a git repo (walk up to.git, readoriginremote URL, parse<owner>/<repo>). -
If a git repo is found and at least one cloud environment's
github_reposcontains that repo, select the environment with the most overlap (breaking ties by most-recently-used). The user can still override this from the environment dropdown. -
If no git repo is found, or no environment matches the repo, fall back to the existing default: saved
last_selected_environment_idsetting, then most-recently-used environment. -
The environment chip in the footer reflects the selected environment immediately (or near-immediately after the async git check completes).
-
When the user presses Enter, the compose state's current
selected_environment_idis passed directly to the new cloud pane. The environment does not change during the transition from compose mode to the cloud pane. -
For
/handoff query(auto-submit path), the environment isNone(compose state isn't active), so the cloud pane falls back to its own default selection. -
The pwd-based check uses the same
find_git_root/git_origin_url/parse_github_repo/pick_handoff_overlap_envutilities as the existing touched-workspace pipeline — just scoped to a single directory instead of the full conversation history. -
The async git check should complete quickly (single local git command with the existing 5-second timeout). If the check hasn't completed when the user presses Enter, the current selection (from the fallback defaults) is used.