You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(sandbox): repair record_cli defects found reviewing #73
Three blockers, all reproduced against the branch before changing anything.
1. `tool` was interpolated unescaped into generated shim source. The validator
only rejected path separators, so `tool: 'a"""b'` validated and produced a
shim that fails to compile; a crafted name reached executable position.
Constrained the field to `^[A-Za-z0-9._+-]+$` and covered quote/newline/space
cases in the tests, which had only probed path-shaped names.
2. The recorder log was seeded only `if not log_path.exists()`, so its sole
effect was PRESERVING a previous run's log. Under DIRECT_WRITE (the docker
default, which deliberately does not clear the target dir) a stale record
scored the current run: a `min_count: 1` criterion returned 1.0 with zero
agent activity. The log is now truncated unconditionally and the recorder
directory wiped before regeneration, so a shim for a tool no longer declared
cannot linger on PATH.
3. The collision guard built its message with `clash.relative_to(sandbox_dir)`,
comparing a resolved path against an unresolved root. Wherever the sandbox
traverses a symlink (macOS /var, a symlinked --run-dir on Linux) that raised
ValueError instead of the intended RuntimeError, so the friendly error never
existed and the branch was red on macOS. The message no longer computes a
relative path, and the path-prepend test compares resolved to resolved --
it had passed only because Windows and Linux tempdirs are not symlinked.
Also: parse_log had no production callers while the checker re-implemented the
same JSON-Lines loop, so it now returns (usable, unusable_count) and is the
single reader. The module is renamed cli_recorder -> invocation_log: it owns
both halves now, and CE004's prefix match reads `coder_eval.cli_recorder` as the
cli layer. Fixed the guide's `log:` comment, which said "(required)" a line
above the paragraph documenting its default.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments