Run every command on the build VM over SSH (M1.3) #93

Merged
dongar merged 5 commits from ssh-execution into main 2026-10-02 22:44:22 +00:00
4 changed files with 34 additions and 17 deletions
Showing only changes of commit 4f152af170 - Show all commits

No files matched your search

+1 -1
View File
@@ -134,7 +134,7 @@ class LLMExecutor:
result = self._delegate.run( result = self._delegate.run(
transcript.as_actor("helper"), transcript.as_actor("helper"),
brief=brief, brief=brief,
branch=f"delegation/milestone-{milestone}-{failures}", branch=f"delegation-milestone-{milestone}-{failures}",
) )
if result.usable: if result.usable:
return None return None
+4 -2
View File
@@ -55,8 +55,10 @@ class MilestonePublisher:
def branch_for(self, task_id: str, milestone: int) -> str: def branch_for(self, task_id: str, milestone: int) -> str:
# Namespaced by task so re-running a project against the same repo # Namespaced by task so re-running a project against the same repo
# cannot collide with an earlier run's branch. # cannot collide with an earlier run's branch. Flat, with no "/":
return f"{task_id}/milestone-{milestone}" # git stores branch names as paths, so a branch named after the task
# (which a model did make, live) would block "<task>/milestone-1".
return f"{task_id}-milestone-{milestone}"
def publish( def publish(
self, self,
+27 -12
View File
@@ -124,14 +124,29 @@ def test_publish_commits_pushes_and_opens_a_pr(
task_id="demo-abc", milestone=2, project="demo", plan="the plan" task_id="demo-abc", milestone=2, project="demo", plan="the plan"
) )
assert git.pushed == ["demo-abc/milestone-2"] assert git.pushed == ["demo-abc-milestone-2"]
assert client.opened[0]["head"] == "demo-abc/milestone-2" assert client.opened[0]["head"] == "demo-abc-milestone-2"
assert client.opened[0]["base"] == "main" assert client.opened[0]["base"] == "main"
assert "the plan" in client.opened[0]["body"] assert "the plan" in client.opened[0]["body"]
assert result.pull_request is not None assert result.pull_request is not None
assert "opened PR #1" in result.note assert "opened PR #1" in result.note
def test_a_branch_named_after_the_task_does_not_block_publishing(
store: StateStore, tmp_path: Path
) -> None:
# Live run 3: the executor ran `git checkout -b <task id>` itself. With
# "<task>/milestone-1" as the harness's branch, git refused it, since a
# branch name can't also be a directory of other branch names.
git = FakeGit(tmp_path / "work")
git.repo.checkout_new_branch("demo-abc")
result = build(store, git, FakeGitea()).publish(
task_id="demo-abc", milestone=1, project="demo", plan="p"
)
assert result.pull_request is not None
assert git.pushed == ["demo-abc-milestone-1"]
def test_intent_is_recorded_then_committed(store: StateStore, tmp_path: Path) -> None: def test_intent_is_recorded_then_committed(store: StateStore, tmp_path: Path) -> None:
build(store, FakeGit(tmp_path / "work"), FakeGitea()).publish( build(store, FakeGit(tmp_path / "work"), FakeGitea()).publish(
task_id="t", milestone=1, project="demo", plan="p" task_id="t", milestone=1, project="demo", plan="p"
@@ -150,7 +165,7 @@ def test_failure_after_intent_leaves_it_pending_for_reconciliation(
[pending] = store.pending_intents() [pending] = store.pending_intents()
assert pending.kind == OPEN_PR_INTENT assert pending.kind == OPEN_PR_INTENT
assert pending.payload["branch"] == "t/milestone-1" assert pending.payload["branch"] == "t-milestone-1"
assert pending.payload["sha"] assert pending.payload["sha"]
@@ -171,7 +186,7 @@ def test_nothing_to_commit_is_reported_not_raised(
def test_branch_is_namespaced_by_task(store: StateStore, tmp_path: Path) -> None: def test_branch_is_namespaced_by_task(store: StateStore, tmp_path: Path) -> None:
publisher = build(store, FakeGit(tmp_path / "work"), FakeGitea()) publisher = build(store, FakeGit(tmp_path / "work"), FakeGitea())
assert publisher.branch_for("greet-9f2", 3) == "greet-9f2/milestone-3" assert publisher.branch_for("greet-9f2", 3) == "greet-9f2-milestone-3"
def test_reconciler_settles_an_intent_left_by_a_crash( def test_reconciler_settles_an_intent_left_by_a_crash(
@@ -183,9 +198,9 @@ def test_reconciler_settles_an_intent_left_by_a_crash(
client = FakeGitea() client = FakeGitea()
publisher = build(store, FakeGit(tmp_path / "work"), client) publisher = build(store, FakeGit(tmp_path / "work"), client)
intent_id = store.begin_intent( intent_id = store.begin_intent(
OPEN_PR_INTENT, {"branch": "t/milestone-1"}, cause="crash simulation" OPEN_PR_INTENT, {"branch": "t-milestone-1"}, cause="crash simulation"
) )
client.existing.append("t/milestone-1") client.existing.append("t-milestone-1")
reconcilers = publisher.reconcilers() reconcilers = publisher.reconcilers()
assert set(reconcilers) == {OPEN_PR_INTENT} assert set(reconcilers) == {OPEN_PR_INTENT}
@@ -205,8 +220,8 @@ def test_work_the_executor_committed_itself_is_published(
task_id="t", milestone=1, project="demo", plan="p" task_id="t", milestone=1, project="demo", plan="p"
) )
assert result.pull_request is not None assert result.pull_request is not None
assert git.pushed == ["t/milestone-1"] assert git.pushed == ["t-milestone-1"]
assert git.remote["t/milestone-1"] == git.head_sha() assert git.remote["t-milestone-1"] == git.head_sha()
def test_a_followup_the_executor_committed_itself_is_pushed( def test_a_followup_the_executor_committed_itself_is_pushed(
@@ -219,7 +234,7 @@ def test_a_followup_the_executor_committed_itself_is_pushed(
git.repo.commit_all("Address review") git.repo.commit_all("Address review")
sha = publisher.push_followup(task_id="t", milestone=1, message="m") sha = publisher.push_followup(task_id="t", milestone=1, message="m")
assert sha == git.head_sha() assert sha == git.head_sha()
assert git.pushed == ["t/milestone-1", "t/milestone-1"] assert git.pushed == ["t-milestone-1", "t-milestone-1"]
# Nothing new since that push: no second push, and it says so. # Nothing new since that push: no second push, and it says so.
assert publisher.push_followup(task_id="t", milestone=1, message="m") is None assert publisher.push_followup(task_id="t", milestone=1, message="m") is None
assert len(git.pushed) == 2 assert len(git.pushed) == 2
@@ -239,15 +254,15 @@ def test_publishing_again_adopts_the_open_pr_instead_of_opening_another(
assert len(client.opened) == 1 assert len(client.opened) == 1
assert result.pull_request is not None and result.pull_request.number == 1 assert result.pull_request is not None and result.pull_request.number == 1
assert "already open" in result.note assert "already open" in result.note
assert git.pushed == ["t/milestone-1", "t/milestone-1"] # updated it assert git.pushed == ["t-milestone-1", "t-milestone-1"] # updated it
assert store.pending_intents() == [] assert store.pending_intents() == []
def test_a_closed_pr_is_not_adopted(store: StateStore, tmp_path: Path) -> None: def test_a_closed_pr_is_not_adopted(store: StateStore, tmp_path: Path) -> None:
git = FakeGit(tmp_path / "work") git = FakeGit(tmp_path / "work")
client = FakeGitea() client = FakeGitea()
client.existing.append("t/milestone-1") client.existing.append("t-milestone-1")
client.closed.add("t/milestone-1") client.closed.add("t-milestone-1")
publisher = build(store, git, client) publisher = build(store, git, client)
assert publisher.published_pull_request("t", 1) is None assert publisher.published_pull_request("t", 1) is None
publisher.publish(task_id="t", milestone=1, project="demo", plan="p") publisher.publish(task_id="t", milestone=1, project="demo", plan="p")
@@ -121,7 +121,7 @@ class Publisher:
return {"open_pr": lambda intent: intent.payload["branch"] in self._gitea.prs} return {"open_pr": lambda intent: intent.payload["branch"] in self._gitea.prs}
def publish(self, **kwargs: Any) -> PublishResult: def publish(self, **kwargs: Any) -> PublishResult:
branch = f"{kwargs['task_id']}/milestone-{kwargs['milestone']}" branch = f"{kwargs['task_id']}-milestone-{kwargs['milestone']}"
self.attempts += 1 self.attempts += 1
intent = self._store.begin_intent("open_pr", {"branch": branch}, cause="t") intent = self._store.begin_intent("open_pr", {"branch": branch}, cause="t")
if branch in self._gitea.prs: if branch in self._gitea.prs:
@@ -135,7 +135,7 @@ class Publisher:
) )
def published_pull_request(self, task_id: str, milestone: int) -> Any: def published_pull_request(self, task_id: str, milestone: int) -> Any:
branch = f"{task_id}/milestone-{milestone}" branch = f"{task_id}-milestone-{milestone}"
if branch in self._gitea.prs: if branch in self._gitea.prs:
return PullRequest(number=20, state="open", head=branch, url="u") return PullRequest(number=20, state="open", head=branch, url="u")
return None return None