swarm-ui: only the newest start's late stop ends a claude login
This commit is contained in:
parent
41cc2f5e8e
commit
c2f17799fc
3 changed files with 48 additions and 8 deletions
|
|
@ -6,7 +6,9 @@ import { test } from "node:test";
|
|||
import {
|
||||
afterCode,
|
||||
afterStart,
|
||||
beginStart,
|
||||
claudeLoginPath,
|
||||
isLatestStart,
|
||||
leavesLoginRunning,
|
||||
pastedCode,
|
||||
startOutlivedDialog,
|
||||
|
|
@ -49,10 +51,26 @@ test("only a login waiting for its code is stopped on close", () => {
|
|||
assert.equal(leavesLoginRunning({ step: "stored" }), false);
|
||||
});
|
||||
|
||||
test("a start that answers after the dialog closed is stopped, unless it failed", () => {
|
||||
assert.equal(startOutlivedDialog(false, null), true);
|
||||
assert.equal(startOutlivedDialog(true, null), false);
|
||||
assert.equal(startOutlivedDialog(false, { detail: "no minter" }), false);
|
||||
test("a start that answers after the dialog closed is stopped, unless it failed or was replaced", () => {
|
||||
assert.equal(startOutlivedDialog(false, null, true), true);
|
||||
assert.equal(startOutlivedDialog(true, null, true), false);
|
||||
assert.equal(
|
||||
startOutlivedDialog(false, { detail: "no minter" }, true),
|
||||
false,
|
||||
);
|
||||
assert.equal(startOutlivedDialog(false, null, false), false);
|
||||
});
|
||||
|
||||
test("only an agent's newest start counts as the latest", () => {
|
||||
const first = beginStart("login-test-a");
|
||||
assert.equal(isLatestStart("login-test-a", first), true);
|
||||
const second = beginStart("login-test-a");
|
||||
assert.equal(isLatestStart("login-test-a", first), false);
|
||||
assert.equal(isLatestStart("login-test-a", second), true);
|
||||
// Another agent's starts are counted on their own.
|
||||
const other = beginStart("login-test-b");
|
||||
assert.equal(isLatestStart("login-test-a", second), true);
|
||||
assert.equal(isLatestStart("login-test-b", other), true);
|
||||
});
|
||||
|
||||
test("a pasted code is trimmed, and a blank one is nothing", () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue