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

+4
View File
@@ -109,6 +109,10 @@ class DraftResult:
error: str | None
# Who drafted, for the PR body; None means Claude Code, which reports a cost.
drafted_by: str | None = None
# Tokens from the local drafter's event stream: the largest input (the peak
# context) and the summed output. Claude reports a cost instead.
input_tokens: int | None = None
output_tokens: int | None = None
def parse_claude_output(stdout: str, returncode: int) -> DraftResult: