fix(skills): ~ and $HOME in skill config defaults resolve against the tool HOME (#12260, salvage #58227) - #109194
Merged
Merged
Conversation
૮ >ﻌ< ა ci reviewran on 93b7503 — fix(skills): literal HOME replacement;
|
…iable `re.sub` with the home path as a template string parsed backslashes as escapes (re.error dropped the whole injected config block); use a callable. The early `~/…` return also skipped `expandvars`, leaving `~/$LEAF` half resolved. Prefix-substitute and fall through to normal expansion instead.
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.
Skill config defaults such as
~/wikior$HOME/wikinow expand against the HOME Hermes injects into tool subprocesses (get_subprocess_home()), so the path injected into the prompt is the path the tools actually read.Fixes #12260
Changes
agent/skill_utils.py: new_expand_skill_config_path()handles~,~/…,~\…,$HOMEand${HOME}against the subprocess home when one is configured, then falls back to normalexpanduser/expandvars(other variables unchanged).resolve_skill_config_valuescalls it for any value containing~or$.Validation
~/scratch<process HOME>/scratch/data/home/scratch$HOME/wiki,${HOME}/notes/data/home/wiki,/data/home/notes${PROJECT_ROOT}/cache/proj/cache/proj/cache(unchanged)scripts/run_tests.sh tests/agent/test_skill_utils.py→ 24 passed; new test red on base.Credit
Cherry-picked from #58227 by @tianma-if, the only candidate that also handles
$HOME/${HOME}(the gap the reporter identified in #12273/#12284/#12331/#12736).Root cause:
os.path.expanduseranswers for the control process, not for the tools the value is meant for.Infographic