Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix: align continuation regression checks and error codes
cauliflowere459653fa7fa
diff --git a/apps/desktop/test/background-tasks-dock-render.test.mjs b/apps/desktop/test/background-tasks-dock-render.test.mjsindex d95135334..3cba37ae0 100644--- a/apps/desktop/test/background-tasks-dock-render.test.mjs+++ b/apps/desktop/test/background-tasks-dock-render.test.mjs@@ -221,12 +221,20 @@ test("the working step sweeps only while its session runs, so an idle window sto});-test("pending completion displays its status and offers cancellation without dismissing the job", async () => {+test("task actions distinguish stopping, dismissing, and cancelling continuation", async () => {await withDockRender(({ render }) => {- const pending = { ...task("pending", "exited", 0), continuation: "pending" };- const html = render({ tasks: [pending], sessionTasks: [pending] });- assert.match(html, /Waiting to resume/);- assert.match(html, /Cancel continuation/);- assert.doesNotMatch(html, />Remove</);+ for (const state of ["running", "exited", "failed", "stopped"]) {+ for (const continuation of [undefined, "pending", "cancelled"]) {+ const row = { ...task("actions", state), continuation };+ const html = render({ tasks: [row], sessionTasks: [row] });+ const context = `${state}, continuation=${continuation}`;+ assert.equal(/>Stop<\/button>/.test(html), state === "running", context);+ assert.equal(/>Dismiss<\/button>/.test(html), state !== "running" && continuation !== "pending", context);+ assert.equal(/>Cancel continuation<\/button>/.test(html), continuation === "pending", context);+ if (state !== "running" && continuation === "pending") {+ assert.match(html, /Waiting to resume/, context);+ }+ }+ }});});diff --git a/apps/desktop/test/background-tasks-row-toggle.test.mjs b/apps/desktop/test/background-tasks-row-toggle.test.mjsindex 6b6a7845c..0500ec00d 100644--- a/apps/desktop/test/background-tasks-row-toggle.test.mjs+++ b/apps/desktop/test/background-tasks-row-toggle.test.mjs@@ -36,23 +36,11 @@ test("stop and remove stay outside the toggle surface", () => {const toggleEnd = dock.indexOf('className="task-main"');const bandAt = dock.indexOf('className="task-band"');const stopAt = dock.indexOf('"task-action is-stop"');- const removeAt = dock.indexOf('className="task-action"');+ const removeAt = dock.indexOf("onRemove(task.id)");assert.ok(bandAt > 0 && bandAt < toggleEnd, "the band must wrap the row body");assert.ok(stopAt > toggleEnd && removeAt > toggleEnd, "actions must follow the body");});-test("a running task offers stop and never remove", () => {- // The two actions are chosen by state in one branch: the stop control gates on- // `running`, and the remove control lives in the other arm.- assert.match(dock, /className="task-action is-stop"\s+onClick=\{\(\) => onStop\(task\.id\)\}/);- assert.match(dock, /className="task-action"\s+onClick=\{\(\) => onRemove\(task\.id\)\}/);- assert.match(dock, /backgroundTasks\.dismiss/);- assert.ok(- dock.indexOf('"task-action is-stop"') < dock.indexOf('className="task-action"'),- "the stop control comes from the running arm",- );-});-test("the row styles keep the body clickable and focus-visible", () => {assert.match(composerStyles, /\.task-main\s*\{[^{}]*flex: 1 1 auto/);assert.match(composerStyles, /\.task-main\s*\{[^{}]*cursor: pointer/);diff --git a/docs/spec/03-runtime/08-error-codes.md b/docs/spec/03-runtime/08-error-codes.mdindex 494f2e613..f6d0ebaf1 100644--- a/docs/spec/03-runtime/08-error-codes.md+++ b/docs/spec/03-runtime/08-error-codes.md@@ -53,6 +53,7 @@ registered; reserved codes in §3.7 remain intentionally absent from| `INVALID_ARGUMENT` | no | request schema/args invalid, including a native-tool path of the wrong file/directory kind || `INVALID_PARAMS` | no | host-core RPC parameter validation failed (numeric `1002`); the sidecar and renderer surface it unchanged || `UNAUTHORIZED` | no | capability/auth boundary rejected call |+| `PERMISSION_DENIED` | no | session ownership, permission mode, or continuation eligibility rejects the operation; do not retry without a change in authorization or state || `NOT_FOUND` | no | entity not found || `SESSION_NOT_FOUND` | no | a session-scoped RPC (including `tools.execute`) named a session the host does not have; an unknown id never inherits the global workspace || `CONFLICT` | maybe | state conflict / busy resource |diff --git a/packages/shared/src/errors.ts b/packages/shared/src/errors.tsindex 3ec18a6d4..eeecb6e80 100644--- a/packages/shared/src/errors.ts+++ b/packages/shared/src/errors.ts@@ -35,6 +35,7 @@ export const ErrorCodes = {INTERNAL: "INTERNAL",INVALID_ARGUMENT: "INVALID_ARGUMENT",UNAUTHORIZED: "UNAUTHORIZED",+ PERMISSION_DENIED: "PERMISSION_DENIED",NOT_FOUND: "NOT_FOUND",/** The operation has no implementation on this surface (spec 16 §9). */UNSUPPORTED: "UNSUPPORTED",