Repository navigation
Warn when a model without delim reads ${...} text as variables - #104
Merged
Merged
Conversation
A model with neither "delim" nor "var_delim" reads both $(x) and ${x}
(DEFAULT_VAR_DELIM), so shell text such as ${HOME} next to $(x) variables
was silently listed by fzi() as a variable (and substituted if a variable
of that name was given).
- fz.interpreter: find_default_delim_brace_variables() returns the names
seen only as ${name} when the model sets no delimiter, and whether the
input also uses $(name); warn_default_delim_brace_variables() logs one
warning (stderr) per input path and set of names per process.
- fzi() (hence fzc()/fzr()/fzd()) warns only when ${...}-only names sit next
to $(...) variables: a template that uses only ${x} on purpose, or a
model with an explicit delim, never warns. Results are unchanged.
- fzc()/fzr(): the "input_variables is required" error names the
${...}-only variables and suggests "delim": "()".
- tests/test_default_delim_warning.py (10 tests, including CLI stdout
staying JSON); NEWS, doc/limitations.md, skill failure table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjXvVRjM6aMvKvvSFoxpZ6
test_cli_stdout_stays_json read the child's output with the platform default encoding; on Windows (cp1252) the warning's emoji cannot be decoded, the reader thread failed and stderr was None. Decode as UTF-8 and make the child write UTF-8 (PYTHONIOENCODING). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RjXvVRjM6aMvKvvSFoxpZ6
yannrichet
pushed a commit
that referenced
this pull request
Nov 6, 2026
This was referenced Nov 6, 2026
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.
Pull Request
Description
A model that sets neither
delimnorvar_delimreads both$(x)and${x}as variables (DEFAULT_VAR_DELIM = "(){}", a 2.0 behavior change). Shell text such as${HOME}next to$(x)variables was therefore silently listed byfzi()as a variable, and substituted if a variable of the same name was given. This PR makes that situation visible without changing any result.Reproduced on
mainbefore the change:Related Issues
Fixes #101
Type of Change
Changes Made
fz/interpreter.py:find_default_delim_brace_variables(input_path, model, varprefix, exclude_paths)returns the names seen only as${name}when the model sets no delimiter, and whether the input also uses$(name).warn_default_delim_brace_variables()logs one warning (stderr, vialog_warning) per input path and set of names, per process. This de-duplication avoids repeating it on everyfzditeration.default_delim_hint()builds the hint added to the error message.fz/core.py:fzi()warns only when${...}-only names sit next to$(...)variables. Sincefzc(),fzr()andfzd()all callfzi(), they warn too.fzc()andfzr(), theinput_variables is requirederror now names the${...}-only variables and suggests"delim": "()".doc/limitations.md, and a row in the skill's failure table (skills/fz/SKILL.md).Choices made to limit false positives (points left open in the issue)
${x}(the 1.2 CLI convention), for a name that appears in both forms, or for a model with an explicitdelim/var_delim. That last case is the documented way to silence it.FZ_WARN_DEFAULT_DELIMwas suggested in the issue): settingdelimis enough, and it avoids growing the configuration surface.${...}name absent frominput_variables. A${HOME}with no value is left unchanged in the compiled file, so that case alone causes no wrong result.Testing Performed
Automated Tests
tests/test_default_delim_warning.py, 10 tests:delim="()",delim="{}"orvar_delim="(){}";${x}, or the same name in both forms;${...}-only variables, and no hint appears whendelimis set;fz input --format jsonstdout stays valid JSON while the warning goes to stderr.fz/(they reference the new helpers).ci.yml--ignorelist):5 failed, 1069 passed, 86 skipped. The 5 failures are the same pre-existing environmental ones as onmain: 3 permission tests that fail when run as root, and 2yqtests that fail because the installedyqis not the expected implementation.test_default_delim_warning,test_skill_staticandtest_manifestpass together (27 tests).Manual Testing
Additional Notes
FZ_LOG_LEVELdefaults toERROR, so this warning, like all other fz warnings (legacy cache, timeout), only shows withFZ_LOG_LEVEL=WARNINGor lower. The hint in the error message is always visible. Showing this warning at the default level would require either an exception to the logging policy or a change of default level. That is not done here and is left to the maintainer.delim,fzi()scans the input twice more (()form and{}form). There is no extra cost whendelimis set.Generated by Claude Code