haigou-web commented on PR #886: URL: https://github.com/apache/burr/pull/886#issuecomment-6944601125
Both open threads in `examples/coding-agent/tools.py` are addressed, but I cannot push to `Agentic-JJ-Web3/burr` (403 for `haigou-web`), so the commit is on a branch in my fork instead: **https://github.com/haigou-web/burr/tree/fix/coding-agent-harness-tools-hardening** — `6fcc1a6`, 3 files, +137/−20, rebased onto the current head `2b30eb2`. **1. `write_file` truncating before validating** — `contents` is now type-checked before anything is opened: ```python if not isinstance(contents, str): return {"error": f"contents must be a string, got {type(contents).__name__}"} ``` The `open(..., "w")` that truncates the destination is only reached once the argument is known good. **2. Timed-out children outliving the shell** — `run_bash` now starts the command in its own process group (`start_new_session=True` on POSIX, `CREATE_NEW_PROCESS_GROUP` on Windows) and `_kill_tree` signals the whole group on timeout (`os.killpg(..., SIGKILL)`, `taskkill /F /T` on Windows). Both have regression tests: `test_write_file_rejects_non_string_without_truncating` and `test_timeout_kills_child_processes`. `pytest examples/coding-agent/test_coding_agent.py` → **10 passed, 2 failed**. The 2 failures are the pre-existing Windows-only ones (`pwd` does not exist in `cmd`, and symlink creation needs admin rights); I confirmed they fail identically on `d5984d2` via a clean worktree, so they are unrelated to this change and pass on Linux CI. Happy to open this as a stacked PR against `docs/coding-agent-harness-example` if you prefer that over cherry-picking — say which and I will do it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
