harness: a new PM run reads current launch state and open tasks before each turn, and old messages show their age, row 109 (#1603)
The broker gains a read-only state verb (launch state with the event that set it, open tasks capped). The runner fetches it before each turn and puts a "Current state" block at the top of the request; a failed read fails the turn. turnRequest() adds the message time. roles/pm.md gets one rule: the block is the truth for launch state and task status. Seat session, seat sandbox and cli launcher tests re-anchored to the new request shape. Built by Researcher, packet875c515e9. Filbert approved round 3, comment 28333, candidate manifest 0a62225e (11 paths). Sage gate on9774d70dbplus row109.patch: every package node suite and every scripts/test-*.sh green on the first run, skipped 0 in bus, harness and seat. Vikunja #259. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -654,7 +654,7 @@ export class Broker {
|
||||
if (!object(args)) fail('invalid-request');
|
||||
this.#secretCheck(args);
|
||||
return this.#store.transaction(() => {
|
||||
if (s.reader && !['inbox', 'agents', 'tasks', 'trail', 'decisions', 'credentials', 'replies', 'messages'].includes(request.verb))
|
||||
if (s.reader && !['inbox', 'agents', 'tasks', 'trail', 'decisions', 'credentials', 'replies', 'messages', 'state'].includes(request.verb))
|
||||
fail('read-only');
|
||||
const result = this.#dispatch(s, request.verb, args);
|
||||
this.#secretCheck(result);
|
||||
@@ -1086,6 +1086,23 @@ export class Broker {
|
||||
this.#agent(s);
|
||||
return this.#requirements;
|
||||
}
|
||||
// Row 109 (#1603): what a run needs to know before it plans. The business's launch state with
|
||||
// the time and id of the event that set it (`allowed`, no time and no id when none has), and
|
||||
// the open tasks as the tracker snapshot shows them: refs and titles, at most `cap` of them,
|
||||
// `total` counting every open task. A read for role, reader and human sessions; nothing is stored.
|
||||
case 'state': {
|
||||
keys(a, []);
|
||||
if (!s.human && !s.reader) this.#agent(s);
|
||||
const set = this.#store.get(
|
||||
"SELECT id,kind,at FROM events WHERE business=? AND kind IN ('launch.revoked','launch.restored') ORDER BY seq DESC LIMIT 1",
|
||||
s.business,
|
||||
);
|
||||
const open = this.#tasks(s.business, { done: false });
|
||||
return {
|
||||
launch: { state: set?.kind === 'launch.revoked' ? 'revoked' : 'allowed', at: set?.at ?? null, event: set?.id ?? null },
|
||||
tasks: { open: open.tasks.map(({ task_ref, title }) => ({ task_ref, title })), total: open.total, cap: TASK_PAGE },
|
||||
};
|
||||
}
|
||||
case 'inbox':
|
||||
case 'agents':
|
||||
case 'tasks':
|
||||
|
||||
Reference in New Issue
Block a user