feat: local drafter (pi against an OpenAI-compatible server on your own hardware)
tests / unittest (push) Failing after 28s
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:
1 parent
9dea56ce98
commit
1ef68f12fb
14 files changed
+1303
-42
No files matched your search
@@ -41,6 +41,7 @@ class ParseInputsTest(unittest.TestCase):
|
||||
{
|
||||
"INPUT_DOCS": "a.md",
|
||||
"INPUT_DRAFTER": "Local",
|
||||
"INPUT_LOCAL_URL": " http://model-host:8888/v1/ ",
|
||||
"INPUT_TRACKING_ISSUE": " 42 ",
|
||||
"INPUT_DOC_GUIDE": "docs/guide.md",
|
||||
"INPUT_MODEL": "m",
|
||||
@@ -51,6 +52,7 @@ class ParseInputsTest(unittest.TestCase):
|
||||
}
|
||||
)
|
||||
self.assertEqual(i.drafter, "local")
|
||||
self.assertEqual(i.local_url, "http://model-host:8888/v1")
|
||||
self.assertEqual(i.tracking_issue, 42)
|
||||
self.assertEqual(i.doc_guide, "docs/guide.md")
|
||||
self.assertEqual((i.model, i.workstream), ("m", "model"))
|
||||
@@ -90,6 +92,27 @@ class ParseInputsTest(unittest.TestCase):
|
||||
with self.assertRaisesRegex(ValueError, "tracking_issue"):
|
||||
parse_inputs({"INPUT_DOCS": "a.md", "INPUT_TRACKING_ISSUE": "abc"})
|
||||
|
||||
def test_local_url_required_for_local(self):
|
||||
for url in (None, "", " "):
|
||||
with self.assertRaisesRegex(ValueError, "local_url"):
|
||||
parse_inputs({"INPUT_DOCS": "a.md", "INPUT_DRAFTER": "local",
|
||||
"INPUT_LOCAL_URL": url})
|
||||
|
||||
def test_local_url_must_be_http(self):
|
||||
for url in ("ftp://h/v1", "file:///etc/passwd", "model-host:8888/v1", "http://",
|
||||
"http:///v1"):
|
||||
with self.assertRaisesRegex(ValueError, "local_url"):
|
||||
parse_inputs({"INPUT_DOCS": "a.md", "INPUT_DRAFTER": "local",
|
||||
"INPUT_LOCAL_URL": url})
|
||||
i = parse_inputs({"INPUT_DOCS": "a.md", "INPUT_DRAFTER": "local",
|
||||
"INPUT_LOCAL_URL": "https://h/v1"})
|
||||
self.assertEqual(i.local_url, "https://h/v1")
|
||||
|
||||
def test_local_url_ignored_for_other_drafters(self):
|
||||
i = parse_inputs({"INPUT_DOCS": "a.md", "INPUT_DRAFTER": "claude",
|
||||
"INPUT_LOCAL_URL": "ftp://x"})
|
||||
self.assertIsNone(i.local_url)
|
||||
|
||||
|
||||
class PatternTest(unittest.TestCase):
|
||||
def test_expand_sorted_deduplicated_posix(self):
|
||||
|
||||
Reference in new issue
Block a user