Repository navigation
Conversation
Tip leaf from anomalyco#49691 (origin tip 1c0ad21), 3way-applied onto current dev.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
Independent exact-head verification (Claude lane): do not merge as is. It weakens the external-directory check. Head
Regression, reproduced on Linux. reads the outside file with no external-directory prompt at head. On base the prompt is raised. The double-quoted form behaves the same. Fix direction. Unescape only unquoted words, and inside double quotes only bash's own escape set. By reading only, not executed
Not run: Windows, e2e, the full suite. Nothing pushed. Cost: about 11 tool calls (a third of one agent that also covered #143 and #121). |
|
READY (Claude lane): quote-aware fix for the regression above, independently verified Branch What changed. The scan now takes each path argument from the parsed quoting instead of stripping every backslash: unquoted words get bash backslash removal, single-quoted segments are literal, double-quoted segments unescape only bash's own set, and mixed words apply each rule per segment. It uses the existing parse; there is no hand-written quote parser. cmd.exe is back to base behavior. PowerShell is untouched. Evidence
Verifier's findings, stated plainly
Not run: Windows (cmd, PowerShell, Git Bash), the full suite, the V2 bash tool. Cost: 27 worker tool calls plus 29 by the verifier. |
|
Do not use That branch (one commit on The verifier identified the cause as one condition that treats an escaped literal character as dynamic syntax, and confirmed a one-line change restores the prompts while keeping the earlier findings closed. Five mutants also survive that branch's tests. A corrected branch is in progress with a wider probe and a second adversarial verification. Until that reports, the safe state is still: do not promote this PR, and treat Cost: 17 worker tool calls plus 13 by the verifier. |
|
Stopping after three rounds: none of the fix branches should be promoted, and neither should this PR. This needs a design decision, not another patch.
What three rounds show. Each fix made the scan understand more of bash's quoting, and each time a different verifier found forms where understanding more means resolving further into a path the scan cannot actually follow (brace expansion, variable expansion, glob characters that exist as literal directory names). The older code prompted for some of those only because it gave up early on the raw text. The scan is lexical; bash is not. Patching spelling by spelling will not converge. Recommendation. Make the scan fail closed: when a path argument contains anything the scan cannot fully resolve, treat it as possibly external and prompt, instead of resolving the part it understands. That trades some extra prompts for no silent reads, and it is a product decision for the maintainers, since it changes how often users are asked. State to rely on today
Cost: round 3 used 30 worker tool calls plus 22 by the verifier (295,374 subagent tokens); round 2 used 17 plus 13. |
Issue for this PR
Fork-local verification of anomalyco#49691. No origin action.
Type of change
What does this PR do?
Bash leaves backslashes in unquoted tree-sitter word nodes. The shell tool previously resolved
/tmp/my\ project/xas a literal backslash path and requestedexternal_directorypermission for an in-project file. This change removes Bash backslash escapes before path resolution. PowerShell keeps its existing expansion path.How did you verify your code works?
At candidate
5029f6d374e767d4fca47f5d7f7e5b34714138fc, the focused regression passes. Replacing only the new unescape call with the old behavior fails because the tool emits anexternal_directoryrequest.Replaying the change onto current
dev055d95bb7e278c94baf06235a52cac79dd13ba67passes all 24 tests inpackages/opencode/test/tool/shell.test.ts. Package typecheck fails identically on cleandevand the candidate attest/provider/openai.test.ts:24; that unrelated baseline gate is not bypassed.Screenshots / recordings
Not applicable. This is shell permission classification with no UI change.
Checklist