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

+29 -2
View File
@@ -66,11 +66,38 @@ def remove_symlinks(root: Path) -> tuple[str, ...]:
return tuple(sorted(removed))
PI_CONFIG_PREFIX = ".pi"
def is_pi_config(rel: str) -> bool:
"""True for a path under a top-level entry named .pi*: pi's project settings,
extensions and model config, or a config file beside them."""
return Path(rel).parts[0].startswith(PI_CONFIG_PREFIX) if rel else False
def pi_config_entries(root: Path) -> tuple[str, ...]:
"""Top-level names under root that start with .pi."""
return tuple(sorted(n for n in os.listdir(root) if n.startswith(PI_CONFIG_PREFIX)))
def remove_pi_config(root: Path) -> tuple[str, ...]:
"""Delete every top-level .pi* entry, so a pull request's pi settings or model
config cannot load whatever flags pi is given. Returns the removed names."""
removed = pi_config_entries(root)
for name in removed:
path = root / name
if path.is_dir() and not path.is_symlink():
shutil.rmtree(path)
else:
path.unlink()
return removed
class CopyRefused(RuntimeError):
"""A change cannot be copied back safely; the message names the path."""
def _digest(path: Path) -> str:
def digest(path: Path) -> str:
"""A content hash; a symlink hashes its target text and is marked as a link."""
if path.is_symlink():
return "link:" + os.readlink(path)
@@ -89,7 +116,7 @@ def snapshot(root: Path) -> dict[str, str]:
names = list(filenames) + [d for d in dirnames if (base / d).is_symlink()]
for name in names:
path = base / name
out[path.relative_to(root).as_posix()] = _digest(path)
out[path.relative_to(root).as_posix()] = digest(path)
return out