fix(cli): zsh completion fails under eval in .zshrc (#6122)#9618
Closed
mecampbellsoup wants to merge 1 commit into
Closed
fix(cli): zsh completion fails under eval in .zshrc (#6122)#9618mecampbellsoup wants to merge 1 commit into
eval in .zshrc (#6122)#9618mecampbellsoup wants to merge 1 commit into
Conversation
) The generated zsh completion script ended with `_hermes "$@"`, which invokes `_arguments` outside any completion context when the script is loaded via `eval "$(hermes completion zsh)"` in `.zshrc`. This raises: _arguments:comparguments:327: can only be called from completion function on every shell startup. Replace the direct call with `compdef _hermes hermes` so zsh registers the function with its completion system and calls it only during completion. Add a regression test. Verified: - Old script (tail `_hermes "$@"`) reproduces the error in `zsh -f` - New script (tail `compdef _hermes hermes`) loads cleanly Closes NousResearch#6122
RuckVibeCodes
left a comment
There was a problem hiding this comment.
[gus-first-pass] fix(cli): zsh completion fails under eval in .zshrc - Simple fix, good explanation.
Collaborator
This was referenced Apr 30, 2026
Closed
Contributor
|
Fixed via PR #25075 (#25075). Same root cause you identified for #6122. The patch targeted |
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.
Summary
Fixes #6122. The generated zsh completion script ends with
_hermes "$@", which invokes_argumentsoutside any completion context when the script is loaded the documented way:Shell startup then errors:
Replace the direct call with
compdef _hermes hermesso zsh registers the function with its completion system and invokes it only during completion.Verification
zsh -fby generating the pre-fix script and loading it viaeval— errors as reported.hermes <TAB>works.test_zsh_completion_registers_via_compdef_not_direct_call) that asserts the generated script usescompdef _hermes hermesand does not contain_hermes "$@".Test plan
pytest tests/hermes_cli/test_profiles.py -k zsh_completion— 3 passedeval "$(python -c 'from hermes_cli.profiles import generate_zsh_completion; print(generate_zsh_completion())')"inzsh -f— no errorCloses #6122