mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 14:28:41 +01:00
Traced 2026-11-12. On the cloud builder tab-inject queues a task that the claim gate holds while an earlier run of the project is open (so it never types into an agent mid-task), but it answered only ok, and the walk said a running session gets the prompt typed into it. A prompt for a plain shell was queued and answered 200, then refused by the runner. - tab-inject: a task held behind an open run answers heldBehind (runId, startedAt, label) and a message, read with findQueueBlockers, the gate's own predicate; a prompt for a shell is 403 before anything is queued - LOOP-WALK: 'give it a task' says it waits its turn; 'type into it' says how to send a message mid-task (bracketed paste, then Enter); open-tabs names are lowercase; the shell refusals are the real statuses - scripts/test/session-walk-truth pins the routes and the text together Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy Co-authored-by: Claude <noreply@anthropic.com>
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
/**
|
|
* The Session walk (docs/foundation/LOOP-WALK.md) says what the routes do.
|
|
*
|
|
* Traced 2026-11-12: the walk said a running session "gets the prompt typed
|
|
* into it", while on the cloud builder tab-inject queues a task that waits
|
|
* behind the project's open run, and answered only `ok`; a prompt for a plain
|
|
* shell was queued and answered 200, then refused by the runner.
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
|
|
const read = (p: string) => fs.readFileSync(p, "utf8");
|
|
const inject = read("src/app/api/control/tab-inject/route.ts");
|
|
|
|
assert.ok(
|
|
inject.indexOf("isShellTab(tab)") > -1 &&
|
|
inject.indexOf("isShellTab(tab)") < inject.indexOf("stageAttachmentsForAgent("),
|
|
"a prompt for a shell is refused before anything is staged or queued",
|
|
);
|
|
assert.match(inject, /status: 403/);
|
|
|
|
assert.match(
|
|
inject,
|
|
/findQueueBlockers\(\[runId\]\)/,
|
|
"the hold is read from the gate's own predicate",
|
|
);
|
|
assert.match(inject, /waitingOn: \{/, "the same fields as /api/inject");
|
|
assert.match(inject, /queuedBehindSentence\(blocker\)/, "and the same sentence");
|
|
assert.equal(
|
|
(inject.match(/await withHold\(/g) ?? []).length,
|
|
3,
|
|
"the dispatch, queued and repo-only answers all say when they wait",
|
|
);
|
|
assert.match(
|
|
inject,
|
|
/body\.mode === "pty"/,
|
|
"a prompt typed into a live PTY here waits for nothing",
|
|
);
|
|
|
|
const walk = read("docs/foundation/LOOP-WALK.md");
|
|
assert.doesNotMatch(walk, /gets the prompt\s+typed into it/, "the old claim is gone");
|
|
assert.match(walk, /waitingOn/);
|
|
assert.doesNotMatch(walk, /heldBehind/);
|
|
assert.match(walk, /\\u001b\[200~/, "how to type a message mid-task");
|
|
assert.match(walk, /in lowercase/, "open-tabs names are lowercased by the runner");
|
|
assert.match(
|
|
read("desktop/src/main/pty-runtime.ts"),
|
|
/runner:\$\{tab\.toLowerCase\(\)\}/,
|
|
"if the runner stops lowercasing, the walk's note goes",
|
|
);
|
|
|
|
console.log("session-walk-truth ok");
|