fix(exec): fail invalid explicit workdir before running#94441
Conversation
|
Thanks for the clean fix — the bug is well understood, the layer is right, and the explicit-vs-default workdir distinction matches exactly what the issue asks for. Approve. A few non-blocking suggestions if you want a polish pass before merge; otherwise ship it. What works:
Minor suggestions (non-blocking):
Verdict: Approve. Nice, minimal, well-tested fix. Ship it. |
|
Codex review: needs real behavior proof before merge. Reviewed June 25, 2026, 5:19 PM ET / 21:19 UTC. Summary PR surface: Source +703, Tests +1955, Generated 0, Other +3. Total +2661 across 30 files. Reproducibility: yes. Source inspection on current main shows local exec derives an explicit/default cwd, calls resolveWorkdir, stats the literal input, and falls back with a warning before command execution, matching the linked report. Review metrics: 2 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land one canonical exec workdir fix that fails explicit invalid workdirs before execution, preserves or explicitly approves upgrade behavior for defaults, and documents any public sandbox SDK validation seam. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows local exec derives an explicit/default cwd, calls resolveWorkdir, stats the literal input, and falls back with a warning before command execution, matching the linked report. Is this the best way to solve the issue? No, not yet. The explicit fail-fast direction is a strong candidate, but current head also changes omitted/configured defaults and exports a public sandbox SDK lifecycle without enough docs, upgrade proof, or current-head real behavior proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 13ecca5408cb. Label changesLabel justifications:
Evidence reviewedPR surface: Source +703, Tests +1955, Generated 0, Other +3. Total +2661 across 30 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
04da69f to
3440c06
Compare
|
Merged via squash.
|
* fix(exec): fail invalid explicit workdir before running * test(exec): tighten invalid workdir regression * fix(exec): clarify invalid workdir recovery * refactor(exec): centralize workdir resolution * test(exec): update invalid workdir assertion * fix(exec): harden backend workdir contract * fix(exec): map missing backend host workdirs * fix(exec): reject control commands before workdir prep * fix(exec): defer env hook until backend cwd validation * chore(sdk): refresh plugin api baseline * test(agents): drop redundant definition assertions * test(exec): use real config workdirs * test(exec): use tracked temp dirs * test(openshell): keep temp setup local * test: update temp-dir route fixture --------- Co-authored-by: jesse-merhi <[email protected]>
* fix(exec): fail invalid explicit workdir before running * test(exec): tighten invalid workdir regression * fix(exec): clarify invalid workdir recovery * refactor(exec): centralize workdir resolution * test(exec): update invalid workdir assertion * fix(exec): harden backend workdir contract * fix(exec): map missing backend host workdirs * fix(exec): reject control commands before workdir prep * fix(exec): defer env hook until backend cwd validation * chore(sdk): refresh plugin api baseline * test(agents): drop redundant definition assertions * test(exec): use real config workdirs * test(exec): use tracked temp dirs * test(openshell): keep temp setup local * test: update temp-dir route fixture --------- Co-authored-by: jesse-merhi <[email protected]>
Summary
workdiris unavailable instead of falling back to another directory.Closes #94434
Real behavior proof
exec.workdirno longer falls back to another directory and no longer executes the command from the wrong location.60a5c0456baea74b07a8852abb8fccd4c1ad6c50, Linux6.17.0-121035-tuxedo, Nodev22.22.1,host=gateway,security=full,ask=off.node --import tsx --input-type=modulescript that imported the actualcreateExecToolfromsrc/agents/bash-tools.exec.ts, calledtool.execute(...)with an explicit missingworkdir, and used a command that would write a marker file if it executed.{ "timestamp": "2026-06-18T06:47:19.941Z", "commit": "60a5c0456baea74b07a8852abb8fccd4c1ad6c50", "openclawVersion": "2026.6.2", "platform": "linux 6.17.0-121035-tuxedo", "nodeVersion": "v22.22.1", "host": "gateway", "requestedWorkdir": "/tmp/openclaw-exec-proof-UJ3k3G/missing-workdir", "workdirExistsBeforeCall": false, "commandWouldCreateMarker": "/tmp/openclaw-exec-proof-UJ3k3G/should-not-exist.txt", "resultStatus": "failed", "resultExitCode": null, "markerExistsAfterCall": false, "toolText": "workdir \"/tmp/openclaw-exec-proof-UJ3k3G/missing-workdir\" not found: command was not executed. workdir is treated as a literal path; shell expansions such as \"~\" are not applied. Use an existing path or omit workdir." }status=failed, reportedworkdir "..." not found: command was not executed, andmarkerExistsAfterCall=false, proving the command did not run from any fallback directory.Tests
corepack pnpm exec vitest run --config test/vitest/vitest.agents.config.ts src/agents/bash-tools.exec.path.test.tscorepack pnpm exec oxfmt --check --threads=1 src/agents/bash-tools.shared.ts src/agents/bash-tools.exec.ts src/agents/bash-tools.exec.path.test.tscorepack pnpm tsgo:core && corepack pnpm tsgo:test:src