feat: local drafter (pi against an OpenAI-compatible server on your own hardware)
tests / unittest (push) Failing after 28s

drafter: local runs the pi agent against the model already loaded on a self-hosted server,
as an unprivileged user, in the same sandbox as the Claude drafter. It fails soft when the
server is unreachable or has no model loaded. Both drafters now refuse to continue if
git metadata changed during drafting, and strip project pi configuration from the sandbox.
Tested live against a self-hosted server: one run, 12 turns, docs PR opened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jaredandClaude Opus 5.5 committed 2026-11-12 17:12:42 -05:00
1 parent 9dea56ce98
commit 1ef68f12fb
14 files changed
+1303 -42

No files matched your search

+11 -2
View File
@@ -107,6 +107,12 @@ class DraftResult:
turns: int | None
text: str
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:
@@ -207,6 +213,9 @@ def render_pr_body(
if stage1:
parts.append("### Flags from stage 1\n\n" + "\n\n".join(stage1))
turns = "unknown" if result.turns is None else result.turns
cost = "unknown" if result.cost_usd is None else f"{result.cost_usd:.2f}"
parts.append(f"Drafted by Claude Code: {turns} turns, ${cost} estimated.")
if result.drafted_by is not None:
parts.append(f"Drafted by {result.drafted_by}: {turns} turns.")
else:
cost = "unknown" if result.cost_usd is None else f"{result.cost_usd:.2f}"
parts.append(f"Drafted by Claude Code: {turns} turns, ${cost} estimated.")
return "\n\n".join(parts) + "\n"