fix: a run started a moment ago is never judged dead — another dashboard's tmux list may predate it
Only the process that starts a pane writes it into its own cached tmux list (noteSession); a second dashboard on the same database (a dev server) holds a member list up to 15 s old, so its heal beat ended a Codex pane seconds after it started and the proxy gateway answered 401. reconcileOrphans and healRunId skip a run younger than 20 s (dashboard-runs.isYoungRun). Tests: dashboard-runs (young vs old).
This commit is contained in:
@@ -22,8 +22,17 @@ before(() => {
|
||||
});
|
||||
after(() => fs.rmSync(ROOT, { recursive: true, force: true }));
|
||||
|
||||
// Long enough ago that no reconcile treats the run as just started.
|
||||
const start = (id, extra = {}) =>
|
||||
runs.recordRun({ id, mode: "interactive", cwd: "/r", status: "running", laneId: 4, ...extra });
|
||||
runs.recordRun({
|
||||
id,
|
||||
mode: "interactive",
|
||||
cwd: "/r",
|
||||
status: "running",
|
||||
laneId: 4,
|
||||
startedAt: Date.parse("2026-01-01T00:00:00Z"),
|
||||
...extra,
|
||||
});
|
||||
|
||||
describe("dashboard-runs", () => {
|
||||
it("keeps the previous run of a pane as history when the pane starts again", () => {
|
||||
@@ -77,6 +86,14 @@ describe("dashboard-runs", () => {
|
||||
assert.ok(runs.getRun("agenthub-lane-11"), "another tool's row stays");
|
||||
});
|
||||
|
||||
it("never ends a run started a moment ago: another process's tmux list may predate it", () => {
|
||||
start("agenthub-lane-30", { laneId: 30, startedAt: Date.now() - 2000 });
|
||||
start("agenthub-lane-31", { laneId: 31, startedAt: Date.now() - 60_000 });
|
||||
runs.reconcileOrphans(() => false);
|
||||
assert.equal(runs.getRun("agenthub-lane-30").status, "running");
|
||||
assert.equal(runs.getRun("agenthub-lane-31").status, "abandoned");
|
||||
});
|
||||
|
||||
it("flags as abandoned only the running rows whose pane is gone", () => {
|
||||
start("agenthub-lane-5", { laneId: 5 });
|
||||
start("agenthub-lane-6", { laneId: 6 });
|
||||
|
||||
@@ -31,7 +31,15 @@ const { healAllRunIds } = require("../routes/lanes");
|
||||
after(() => fs.rmSync(ROOT, { recursive: true, force: true }));
|
||||
|
||||
const start = (id, laneId, cwd) =>
|
||||
runs.recordRun({ id, mode: "interactive", cwd, status: "running", laneId, sessionId: `s-${id}` });
|
||||
runs.recordRun({
|
||||
id,
|
||||
mode: "interactive",
|
||||
cwd,
|
||||
status: "running",
|
||||
laneId,
|
||||
sessionId: `s-${id}`,
|
||||
startedAt: Date.parse("2026-01-01T00:00:00Z"),
|
||||
});
|
||||
|
||||
describe("a server without S3 on an S3 machine's database", () => {
|
||||
it("never ends a member's run, and still ends its own", () => {
|
||||
|
||||
Reference in New Issue
Block a user