fix(env): translate PEBREL_HOOK_EXE across the WSL boundary - #290
Open
AnxForever wants to merge 1 commit into
Open
AnxForever wants to merge 1 commit into
AnxForever wants to merge 1 commit into
Conversation
WSLENV_ENTRIES carries /p for PEBREL_CLI and PEBREL_BIN_DIR but missed the hook path, so a WSL pane received no PEBREL_HOOK_EXE at all, and the only value a user could copy from (the process-wide Windows one) is a D:\ literal — the exact failure mode the doc comment above the list warns about: 在 Linux 侧谁也执行不了. Add PEBREL_HOOK_EXE/p and NEBULA_HOOK_EXE/p, and cover the new entry in wslenv_entries_match_variables so a future rename fails the test instead of silently dropping WSL reachability. docs/runtime-control-api.md lists the translated entries; add the hook path there as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Result / 用户结果
PEBREL_HOOK_EXE, and its legacy aliasNEBULA_HOOK_EXE, now reach WSL panes as a/mnt/...path. They are translated the same way asPEBREL_CLIandPEBREL_BIN_DIR.Before this change the variable did not cross
WSLENVat all. Inside a WSL pane:The only value a user could find was the process-wide Windows one,
D:/tools/Pebrel/runtime/pebrel-hook.exe, and Linux cannot execute that. A Claude Code hook wired with it on the WSL side fails on every event:Only
SessionStartshows the error.PostToolUse,UserPromptSubmit,Stopand the other events fail silently. The same hooks work when the path is/mnt/d/tools/Pebrel/runtime/pebrel-hook.exe, which is the value this change exports.Design / 设计边界
agent_env.rsis the one place that decides what crosses into WSL throughWSLENV. This addsPEBREL_HOOK_EXE/pandNEBULA_HOOK_EXE/ptoWSLENV_ENTRIES, next toPEBREL_CLI/pandPEBREL_BIN_DIR/p./p, the guest shell gets aD:\…literal that nothing on the Linux side can execute.HOOK_EXE_ENVexists so that plugins can shell out to the hook bridge. It has the same process-wide scope as the other two paths (ai_hook.rs), so it belongs in the same table.WSLENV, and the notify pipe is reachable from WSL. Injecting a hook payload from a WSL pane flipspebrel agent listtostate_source: hook. The exported path was the only missing piece.WSLENV_ENTRIESis#[cfg(windows)], so other platforms are unaffected, and the existing merge still preserves entries that are already inWSLENV.docs/runtime-control-api.mdlists the translated entries; this adds the hook path to that list.Evidence / 验证依据
All checks ran on Windows x64 with the pinned toolchain (Rust 1.97.1):
cargo test --locked -p nebula --features gpui-test-support wslenv_entries_match_variables: passes.cargo test --locked -p nebula --features gpui-test-support, run on a v1.9.1-based branch that carries this commit: 2024 passed, 0 failed.cargo fmt --all -- --check: clean. I ran it with--config newline_style=Autobecause this Windows checkout uses CRLF.python3 scripts/check_architecture.py --base origin/main: exit 0.#[cfg(windows)]. I also haven't done an end-to-end check in a live WSL pane with a build of this exact branch.Required Review / 必须确认
CONTRIBUTING.md,docs/architecture.md, anddocs/project-constraints.md.python3 scripts/check_architecture.py --base <PR-base-commit>passes; budgets were not inflated to fit the change.