fix: refresh queue read views from terminal commands

This commit is contained in:
Codex
2026-06-10 08:02:01 +08:00
parent 65b670f4f0
commit 461c775f05
2 changed files with 51 additions and 5 deletions
+10 -1
View File
@@ -107,6 +107,15 @@ process.exit(1);
(error) => error instanceof Error && error.message.includes("not pending"),
);
await client.patch(`/api/v1/commands/${dispatched.command.id}/status`, { terminalStatus: "completed", failureKind: null, failureMessage: null });
const autoShown = await client.get(`/api/v1/queue/tasks/${created.id}`) as QueueTaskRecord;
assert.equal(autoShown.state, "completed");
assert.equal(autoShown.latestAttempt?.state, "completed");
assert.equal(autoShown.latestAttempt?.runId, dispatched.run.id);
const commander = await client.get("/api/v1/queue/commander?queue=dev&readerId=queue-q2-self-test") as { items?: QueueTaskRecord[]; stats?: JsonRecord };
const commanderTask = commander.items?.find((item) => item.id === created.id);
assert.equal(commanderTask?.state, "completed");
assert.equal(commanderTask?.latestAttempt?.state, "completed");
assert.equal(((commander.stats?.byState as JsonRecord).completed), 1);
const refreshed = await client.post(`/api/v1/queue/tasks/${created.id}/refresh`, {}) as QueueTaskRecord;
assert.equal(refreshed.state, "completed");
assert.equal(refreshed.latestAttempt?.state, "completed");
@@ -202,7 +211,7 @@ process.exit(1);
assert.ok(JSON.stringify(cancelManifest).includes(cancelDispatched.run.id));
assertNoSecretLeak(dispatched);
assertNoSecretLeak(cancelled);
return { name: "queue-q2-dispatch", tests: ["queue-dispatch-run-command-runner-job", "queue-refresh-from-core-status", "queue-dispatch-no-repeat", "queue-unidesk-ssh-endpoint-auto-env", "queue-cancel-propagates-to-run-command-session"] };
return { name: "queue-q2-dispatch", tests: ["queue-dispatch-run-command-runner-job", "queue-read-views-refresh-terminal-state", "queue-refresh-from-core-status", "queue-dispatch-no-repeat", "queue-unidesk-ssh-endpoint-auto-env", "queue-cancel-propagates-to-run-command-session"] };
} finally {
await new Promise<void>((resolve) => server.server.close(() => resolve()));
}