feat: expose pane UUID as WARP_SESSION_ID env var (closes #8611)#10570
feat: expose pane UUID as WARP_SESSION_ID env var (closes #8611)#10570JulienCr wants to merge 1 commit intowarpdotdev:masterfrom
Conversation
…<id> deep link Closes warpdotdev#8611 Today the `warp://session/<uuid>` deep link already exists and focuses a pane by its persistent UUID, but there is no way for a process running inside the shell to know which UUID belongs to its pane. The bootstrap-generated shell variable that previously occupied the name `WARP_SESSION_ID` was a per-shell timestamp +random value used internally for block IDs and the OSC `session_id` field; it was never exported and was distinct from the pane UUID the deep link expects. This change reconciles the two so a script inside the shell can do: open "warp://session/$WARP_SESSION_ID" and focus its own pane. Changes - `PaneGroup::create_session` now takes the pane UUID and injects `WARP_SESSION_ID = <uuid hyphenated>` into the spawned process env via `entry().or_insert_with`, so caller-supplied overrides still win. All five call sites pass the UUID they were already generating. - The Windows `wsl_env_allowlist()` adds `WARP_SESSION_ID/u` so wsl.exe forwards the variable into WSL distros. - `decode_uuid_hex` is replaced by `decode_session_uuid` using `Uuid::parse_str`, which accepts both the 36-character hyphenated form (what `WARP_SESSION_ID` exposes) and the existing 32-character unhyphenated hex. - The bootstrap scripts' internal `WARP_SESSION_ID` shell variable is renamed to `_WARP_BOOT_ID` across bash/zsh/fish init/init_subshell/body files. This preserves the OSC protocol (`session_id` JSON field is unchanged, still a u64) and the block-ID format (`precmd-$_WARP_BOOT_ID-N`), while freeing the user-facing `WARP_SESSION_ID` name to mean "this pane's persistent UUID". - Tests cover both UUID forms in the URI parser and confirm `WSLENV` includes `WARP_SESSION_ID/u` with and without the HOA notifications flag. CHANGELOG-NEW-FEATURE: External tools can now read \`WARP_SESSION_ID\` (a UUID) from any Warp shell, including WSL, and focus that pane via \`warp://session/<uuid>\`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @JulienCr on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment |
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
There was a problem hiding this comment.
Overview
This PR exposes the persistent pane UUID to spawned shells as WARP_SESSION_ID, renames the bootstrap-internal numeric session variable to _WARP_BOOT_ID, updates WSL propagation, and broadens session deep-link parsing to accept hyphenated UUIDs.
Concerns
- Manual testing is described, but this is manually testable user-facing terminal/deep-link behavior and the PR does not include a screenshot or screen recording, nor a justification for why visual evidence cannot be provided. Repository review guidance requires that evidence for behavioral changes that can be manually tested.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Description
Reconciles the bootstrap-internal session id with the persistent pane UUID so a process running inside a Warp shell can identify (and deep-link to) its own pane via
warp://session/<uuid>(warposs://on the OSS channel).The
warp://session/<uuid>deep link itself landed in #9655. This PR ships the env-var half of #8611: an exportedWARP_SESSION_IDwhose value is the same UUID the deep link expects, soopen "warp://session/$WARP_SESSION_ID"from inside the shell focuses the calling pane.Changes
PaneGroup::create_sessionnow takes the pane UUID and injectsWARP_SESSION_ID = <uuid hyphenated>into the spawned process env viaentry().or_insert_with, so caller-supplied overrides still win. All five call sites pass the UUID they were already generating.wsl_env_allowlist()addsWARP_SESSION_ID/usowsl.exeforwards the variable into WSL distros when Warp launcheswsl.exedirectly as a tab shell.decode_uuid_hexis replaced bydecode_session_uuidusingUuid::parse_str, which accepts both the 36-character hyphenated form (whatWARP_SESSION_IDexposes, matches theUuidDisplay impl) and the existing 32-character unhyphenated hex.WARP_SESSION_IDshell variable is renamed to_WARP_BOOT_IDacross bash/zsh/fish init/init_subshell/body files. The OSC payload'ssession_idJSON field is unchanged (still a u64); the block-ID formatprecmd-$_WARP_BOOT_ID-Nkeeps its semantics. This frees the user-facingWARP_SESSION_IDname to mean "this pane's persistent UUID".Linked Issue
Closes #8611
ready-to-implement.Testing
Automated
decode_session_uuid(hyphenated, unhyphenated, length / invalid-char rejection).wsl_env_allowlisttests updated to assertWARP_SESSION_ID/uis present with and without theHOANotificationsflag.cargo fmt --check,cargo clippy -p warp --all-targets --tests -- -D warnings, and the full pane_group test set (54 tests) pass locally on Windows.Manual (Windows, debug build with
--features release_bundle)Read PEB of three
pwsh.exechildren ofwarp-oss.exeto confirm per-pane WARP_SESSION_ID injection without disturbing the running session:Three distinct hyphenated UUIDs, one per pane.
Cycled
warposs://session/<uuid>deep links across the three tabs:Each invocation shifted focus to the matching pane and stayed a single instance (named-pipe URI forwarding via
SingleInstanceManager). Both UUID forms decoded to the same target.WSL propagation via
WSLENVis covered by unit tests; native-WSL-tab end-to-end was not exercised locally on this build (apwshtab where the user typeswslis a different code path that doesn't getWSLENVinjected by Warp — out of scope for this PR).Agent Mode
CHANGELOG-NEW-FEATURE: External tools can read WARP_SESSION_ID (a UUID) from any Warp shell to deep-link to that pane via warp://session/.