This commit is contained in:
Nathan Flurry 2026-03-14 14:38:29 -07:00 committed by GitHub
parent 70d31f819c
commit 5ea9ec5e2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 2605 additions and 669 deletions

View file

@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { taskKey, historyKey, projectBranchSyncKey, projectKey, projectPrSyncKey, taskSandboxKey, workspaceKey } from "../src/actors/keys.js";
import { githubDataKey, historyKey, projectBranchSyncKey, projectKey, taskKey, taskSandboxKey, workspaceKey } from "../src/actors/keys.js";
describe("actor keys", () => {
it("prefixes every key with workspace namespace", () => {
@ -9,7 +9,7 @@ describe("actor keys", () => {
taskKey("default", "repo", "task"),
taskSandboxKey("default", "sbx"),
historyKey("default", "repo"),
projectPrSyncKey("default", "repo"),
githubDataKey("default"),
projectBranchSyncKey("default", "repo"),
];

View file

@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { shouldMarkSessionUnreadForStatus } from "../src/actors/task/workbench.js";
import { shouldMarkSessionUnreadForStatus, shouldRecreateSessionForModelChange } from "../src/actors/task/workbench.js";
describe("workbench unread status transitions", () => {
it("marks unread when a running session first becomes idle", () => {
@ -14,3 +14,46 @@ describe("workbench unread status transitions", () => {
expect(shouldMarkSessionUnreadForStatus({ thinkingSinceMs: Date.now() - 1_000 }, "running")).toBe(false);
});
});
describe("workbench model changes", () => {
it("recreates an unused ready session so the selected model takes effect", () => {
expect(
shouldRecreateSessionForModelChange({
status: "ready",
sandboxSessionId: "session-1",
created: false,
transcript: [],
}),
).toBe(true);
});
it("does not recreate a session once the conversation has started", () => {
expect(
shouldRecreateSessionForModelChange({
status: "ready",
sandboxSessionId: "session-1",
created: true,
transcript: [],
}),
).toBe(false);
});
it("does not recreate pending or anonymous sessions", () => {
expect(
shouldRecreateSessionForModelChange({
status: "pending_session_create",
sandboxSessionId: "session-1",
created: false,
transcript: [],
}),
).toBe(false);
expect(
shouldRecreateSessionForModelChange({
status: "ready",
sandboxSessionId: null,
created: false,
transcript: [],
}),
).toBe(false);
});
});