Let a user stop a bot, and say the app is still alpha

The thinking row and the header menu both carry Stop while a bot has work
open for the user anywhere: every pending or processing job of that bot in
their conversations is failed as stopped, its task closed, a Stopped step
recorded and one closing message posted per session, so the thread stops
waiting and the bot goes idle. The handler running the job is aborted from
this process through a registry, so a job stuck waiting on a model stops at
once instead of on its next heartbeat, and a late face change after the
abort is dropped.

The release stage is now said in the app too: Settings > General reports
"Cobble v0.1.5 (alpha)" next to development, and the README and RELEASING.md
say what alpha means for installs.
This commit is contained in:
2026-10-23 10:19:41 +01:00
parent 5beb5f3de4
commit fcad4b49d6
30 changed files with 1279 additions and 57 deletions
+58
View File
@@ -0,0 +1,58 @@
import { describe, expect, test } from "bun:test";
import { abortRunningJob, registerJobAbort, unregisterJobAbort } from "./job-abort-registry";
describe("job-abort-registry", () => {
test("aborts the job this process is running", () => {
let aborted = false;
registerJobAbort({ job_id: 101, abort: () => (aborted = true) });
expect(abortRunningJob({ job_id: 101 })).toBe(true);
expect(aborted).toBe(true);
unregisterJobAbort({ job_id: 101 });
});
test("a job running in another process is not here, so it isn't reported as aborted", () => {
expect(abortRunningJob({ job_id: 202 })).toBe(false);
});
test("a finished job is cleaned up, so its id can't abort a later one", () => {
let aborted = false;
registerJobAbort({ job_id: 303, abort: () => (aborted = true) });
unregisterJobAbort({ job_id: 303 });
expect(abortRunningJob({ job_id: 303 })).toBe(false);
expect(aborted).toBe(false);
});
test("a numeric string id reaches the same entry, since a route may send one", () => {
let aborted = false;
registerJobAbort({ job_id: 404, abort: () => (aborted = true) });
expect(abortRunningJob({ job_id: "404" })).toBe(true);
expect(aborted).toBe(true);
unregisterJobAbort({ job_id: 404 });
});
test("unregistering a job nobody registered is harmless", () => {
expect(() => unregisterJobAbort({ job_id: 505 })).not.toThrow();
});
test("only one job is aborted at a time", () => {
const aborted: number[] = [];
registerJobAbort({ job_id: 606, abort: () => aborted.push(606) });
registerJobAbort({ job_id: 707, abort: () => aborted.push(707) });
abortRunningJob({ job_id: 606 });
expect(aborted).toEqual([606]);
unregisterJobAbort({ job_id: 606 });
unregisterJobAbort({ job_id: 707 });
});
});