Skip to content

fix(tui): preserve absolute paths in complete.path handler#40501

Open
HeimdallStrategy wants to merge 1 commit into
NousResearch:mainfrom
HeimdallStrategy:fix/tui-absolute-path-completion
Open

fix(tui): preserve absolute paths in complete.path handler#40501
HeimdallStrategy wants to merge 1 commit into
NousResearch:mainfrom
HeimdallStrategy:fix/tui-absolute-path-completion

Conversation

@HeimdallStrategy
Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes a bug where the TUI's path completion (complete.path RPC handler) rewrites absolute paths (/proc, /etc, etc.) as cwd-relative paths (../../proc/11). The CLI-side _path_completions() in hermes_cli/commands.py already handled this correctly — the gateway just lacked the word.startswith("/") branch.

The fix is a 2-line addition in tui_gateway/server.py that preserves absolute paths verbatim, matching the existing handling of ~ and ./ prefixes.

Related Issue

Fixes # (no issue filed — user reported directly)

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✅ Tests (adding or improving test coverage)

Changes Made

  • tui_gateway/server.py: Added elif word.startswith("/"): text = full + suffix branch in the complete.path handler (line 6919), matching the existing ~ and ./ patterns
  • tests/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) plus import os

How to Test

  1. python -m pytest tests/gateway/test_complete_path_at_filter.py -v -o addopts=
  2. All 19 tests pass (4 new, 15 pre-existing)
  3. Manual: in Hermes TUI, type /proc and press Tab — completions should be /proc/1, /proc/2, etc., not ../../proc/1

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(tui):)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes
  • I've tested on my platform: Arch Linux

Documentation & Housekeeping

  • I've updated relevant documentation — N/A
  • I've updated cli-config.yaml.example — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — N/A
  • I've considered cross-platform impact — N/A (absolute-path handling is POSIX-only, same as existing branches)
  • I've updated tool descriptions/schemas — N/A

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) comp/gateway Gateway runner, session dispatch, delivery labels Jun 6, 2026
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.
@HeimdallStrategy HeimdallStrategy force-pushed the fix/tui-absolute-path-completion branch from f21d334 to 4e1ae6d Compare June 6, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants