Skip to content

feat: expose pane UUID as WARP_SESSION_ID env var (closes #8611)#10570

Open
JulienCr wants to merge 1 commit intowarpdotdev:masterfrom
JulienCr:feature/issue-8611-session-id
Open

feat: expose pane UUID as WARP_SESSION_ID env var (closes #8611)#10570
JulienCr wants to merge 1 commit intowarpdotdev:masterfrom
JulienCr:feature/issue-8611-session-id

Conversation

@JulienCr
Copy link
Copy Markdown

@JulienCr JulienCr commented May 9, 2026

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 exported WARP_SESSION_ID whose value is the same UUID the deep link expects, so open "warp://session/$WARP_SESSION_ID" from inside the shell focuses the calling 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 when Warp launches wsl.exe directly as a tab shell.
  • 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, matches the Uuid Display impl) 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. The OSC payload's session_id JSON field is unchanged (still a u64); the block-ID format precmd-$_WARP_BOOT_ID-N keeps its semantics. This frees the user-facing WARP_SESSION_ID name to mean "this pane's persistent UUID".

Linked Issue

Closes #8611

  • The linked issue is labeled ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below.

Testing

Automated

  • 3 new unit tests for decode_session_uuid (hyphenated, unhyphenated, length / invalid-char rejection).
  • The two existing wsl_env_allowlist tests updated to assert WARP_SESSION_ID/u is present with and without the HOANotifications flag.
  • 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.exe children of warp-oss.exe to confirm per-pane WARP_SESSION_ID injection without disturbing the running session:

PID 101028 (pwsh.exe) WARP_SESSION_ID = 3347c049-db8e-4c5d-9e17-bb0ff705987a
PID 121400 (pwsh.exe) WARP_SESSION_ID = 6572f6bf-ad94-4437-88d2-d818bf5cd6a0
PID 116324 (pwsh.exe) WARP_SESSION_ID = 914e0105-07e8-4ff4-a8fb-4023278611f7

Three distinct hyphenated UUIDs, one per pane.

Cycled warposs://session/<uuid> deep links across the three tabs:

warp-oss processes before: 2
[1] focusing PID 101028 / UUID 3347c049-... (hyphenated)
[2] focusing PID 121400 / UUID 6572f6bf-...
[3] focusing PID 116324 / UUID 914e0105-... (hyphenated)
[4] focusing PID 101028 / UUID 3347c049db8e4c5d9e17bb0ff705987a (UNHYPHENATED 32-hex)
warp-oss processes after: 2 (delta = 0)

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 WSLENV is covered by unit tests; native-WSL-tab end-to-end was not exercised locally on this build (a pwsh tab where the user types wsl is a different code path that doesn't get WSLENV injected by Warp — out of scope for this PR).

  • I have manually tested my changes locally.

Agent Mode

  • Warp Agent Mode — this PR was co-authored with Claude Code (Anthropic). Manually verified end-to-end on Windows.

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/.

…<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>
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 9, 2026

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 @cla-bot check to trigger another check.

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 9, 2026

@JulienCr

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 9, 2026
@JulienCr
Copy link
Copy Markdown
Author

JulienCr commented May 9, 2026

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label May 9, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 9, 2026

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session ID Environment Variable and Deep Link Support

1 participant