fix(tui): preserve absolute paths in complete.path handler#40501
Open
HeimdallStrategy wants to merge 1 commit into
Open
fix(tui): preserve absolute paths in complete.path handler#40501HeimdallStrategy wants to merge 1 commit into
HeimdallStrategy wants to merge 1 commit into
Conversation
The TUI gateway's complete.path RPC handler was missing a branch for
absolute-path inputs (word starts with '/'). Absolute completions were
rewritten as cwd-relative paths (e.g. '/proc' -> '../../proc/11'). The
CLI-side _path_completions() in hermes_cli/commands.py already handled
this correctly -- the gateway just lacked the same branch.
Fix: added `elif word.startswith('/'): text = full + suffix` branch in
tui_gateway/server.py, matching the existing ~ and ./ patterns.
Regression tests cover absolute, absolute+trailing-slash, and guard
tests for ./ and ~/ to confirm they still work.
f21d334 to
4e1ae6d
Compare
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.
What does this PR do?
Fixes a bug where the TUI's path completion (
complete.pathRPC handler) rewrites absolute paths (/proc,/etc, etc.) as cwd-relative paths (../../proc/11). The CLI-side_path_completions()inhermes_cli/commands.pyalready handled this correctly — the gateway just lacked theword.startswith("/")branch.The fix is a 2-line addition in
tui_gateway/server.pythat preserves absolute paths verbatim, matching the existing handling of~and./prefixes.Related Issue
Fixes # (no issue filed — user reported directly)
Type of Change
Changes Made
tui_gateway/server.py: Addedelif word.startswith("/"): text = full + suffixbranch in thecomplete.pathhandler (line 6919), matching the existing~and./patternstests/gateway/test_complete_path_at_filter.py: Added 4 regression tests (test_absolute_paths_are_absolute,test_absolute_path_with_trailing_slash,test_relative_paths_stay_relative,test_home_paths_preserve_tilde) plusimport osHow to Test
python -m pytest tests/gateway/test_complete_path_at_filter.py -v -o addopts=/procand press Tab — completions should be/proc/1,/proc/2, etc., not../../proc/1Checklist
Code
fix(tui):)pytest tests/ -qand all tests passDocumentation & Housekeeping
cli-config.yaml.example— N/ACONTRIBUTING.mdorAGENTS.md— N/A