mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 15:47:36 +01:00
* fix(inject): a read-only probe ends Done on the builder it asked for, and a refusal by choice is not a failure Found by a review of the probe path end to end (2026-11-12): - Every run's status went through the feedback-fix mapper, which calls a run that finished well with no pull request "Needs you, nothing shipped". A git status probe ended there. Only a feedback fix owes a change; any other run that finished well with nothing pushed is Done, cause finished_no_change (canonicalStatus expectsChange, from run-track-load). - Neither POST /api/inject nor MCP loki_dispatch could ask for the cloud builder: zod drops unknown keys, so builderChannel vanished without a word. Both take it now (builderChannel / builder). - A fresh session refused for lack of a free lane was closed as a failing run and advanced the escalation ladder; four of them paged the owner with no agent ever run. That refusal no longer counts. scripts/test/probe-path.ts. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtHxn2FxY2x8pJ83Xj * test: two text pins follow the new shape of the inject route and the refusal close busy-placement read the inject route's call on one line; refused-dispatch- closes-run read closeRunUndelivered with a one-key options object. Both still assert the same thing: the route passes session on, and a refused dispatch closes its run quietly before the failure is reported. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtHxn2FxY2x8pJ83Xj --------- Co-authored-by: Claude <noreply@anthropic.com>
20 lines
1.0 KiB
TypeScript
20 lines
1.0 KiB
TypeScript
/**
|
|
* A dispatch the builder refused must not leave its run WAITING. Case from the
|
|
* live site (2026-10-15): an account with no builder collected six "waiting"
|
|
* runs, each one a dispatch that had already failed in front of the person.
|
|
*/
|
|
import { readFileSync } from "fs";
|
|
import { join } from "path";
|
|
|
|
const src = readFileSync(join(__dirname, "../../src/lib/inject-core.ts"), "utf8");
|
|
const failure = src.indexOf("if (!result.ok) {");
|
|
// Quietly (notify: false): the reply already says it failed.
|
|
const tail = src.slice(failure);
|
|
const call = tail.search(/closeRunUndelivered\(runId, userId, result\.error, \{\s*notify: false,/);
|
|
const close = call < 0 ? -1 : failure + call;
|
|
const report = src.indexOf("return recordInjectFailure(userId, result, outcome);", failure);
|
|
if (failure < 0 || close < 0 || report < 0 || !(close < report)) {
|
|
throw new Error("✗ a refused dispatch closes its run before reporting the failure");
|
|
}
|
|
console.log(" ✓ a refused dispatch closes its run (quietly — the reply already says it failed)");
|