fix: local drafter review round 1

- Refuse to run pi as root when DOCS_REVIEW_DRAFTER_USER is unset.
- Keep a record of the run: parse partial output on timeout, add the first
  redacted stderr line to failures, and report summed output and peak
  input tokens with turns in the log and step summary.
- Delete top-level .pi* entries from the sandbox before drafting and
  refuse a draft that recreates one.
- Probe: an HTTP error, redirect or non-JSON answer is a hard failure;
  only connection failures and an empty model list are soft. Refuse model
  ids starting with "-" and pass --model=<id>.
- README: mid-run model swap note, hard-failure cases, rewrap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-12 16:42:10 -05:00
1 parent 28b993cb23
commit 7095db060e
9 files changed
+330 -86

No files matched your search

+5 -1
View File
@@ -10,7 +10,8 @@ models.json pi would read), task_copy (file receiving the @file task), system_co
(file receiving the --append-system-prompt file), edit (path to append a line to,
relative to the working directory or absolute), write (text to append instead),
fail (end on an assistant error), exit_code (exit with this code), no_text (end
with an empty assistant message).
with an empty assistant message), list_file (file receiving the names at the top of the
working directory).
Stdin must be /dev/null: a real pi waits on an open stdin until EOF. When it is
not, this exits 3 without printing anything.
@@ -51,6 +52,9 @@ if config.get("argv_file"):
Path(config["argv_file"]).write_text(json.dumps(sys.argv), encoding="utf-8")
if config.get("cwd_file"):
Path(config["cwd_file"]).write_text(os.getcwd(), encoding="utf-8")
if config.get("list_file"):
Path(config["list_file"]).write_text("\n".join(sorted(os.listdir("."))),
encoding="utf-8")
if config.get("home_file"):
Path(config["home_file"]).write_text(os.environ.get("HOME", ""), encoding="utf-8")
if config.get("models_copy"):