fix(lanes): bridge routes/lanes.js to pty-run.js

Replace run-spawner imports and APIs with pty-run:
- Import pty-run instead of run-spawner
- Delete setRunExitHandler registration, replace with read-time self-heal in payload()
- Remove mode validation (mode no longer exists in pty-run)
- Update spawnRun call to use new parameter names (initialPrompt, not prompt/mode)
- Replace "message" action with explicit 400 EUNSUPPORTED response
- Fix stopLaneRun to poll on status !== "gone" instead of !actualExitedAt

Adapt tests to tmux-based run model:
- Delete tests about mode-specific behavior (removed feature)
- Rewrite lane release tests using tmux.__setExecImpl mocks instead of withFakeClaude
- Update assertions to check status === "gone" instead of specific exit codes
- Update ERUNTIMEOUT test to mock tmux sessions instead of child processes

All lane-related tests pass; only pre-existing port conflicts in lane-detect.test.js remain.
This commit is contained in:
2026-08-12 10:53:23 +07:00
parent 24f13911fe
commit 82bf803c2e
3 changed files with 134 additions and 287 deletions
+3 -5
View File
@@ -645,14 +645,12 @@ describe("lane actions", () => {
await request("DELETE", `/api/lanes/${c.body.lane.id}`);
});
it("message on a lane with a recorded-but-not-live run returns 409", async () => {
it("message on a lane is no longer supported via REST", async () => {
const c = await request("POST", "/api/lanes", { cwd: "/tmp/lane-action-e" });
const id = c.body.lane.id;
// Patch the lane with a bogus run_id (never existed, so not live).
await request("PATCH", `/api/lanes/${id}`, { run_id: "nonexistent-run" });
const r = await request("POST", `/api/lanes/${id}/message`, { text: "hello" });
assert.equal(r.status, 409);
assert.equal(r.body.error.code, "ENORUN");
assert.equal(r.status, 400);
assert.equal(r.body.error.code, "EUNSUPPORTED");
await request("DELETE", `/api/lanes/${id}`);
});
});