@codyswann/lisa 4.98.1 → 4.98.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +27 -8
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +50 -13
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/answer-record.mjs +97 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-answer-record.mjs +71 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-cycle.mjs +1 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-human.mjs +3 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +30 -4
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/human-needed.mjs +26 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/ledger-questions.mjs +16 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +7 -1
- package/plugins/lisa/skills/lisa-session-manager/SKILL.md +50 -13
- package/plugins/lisa/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa/skills/lisa-session-manager/scripts/answer-record.mjs +97 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-answer-record.mjs +71 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-cycle.mjs +1 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-human.mjs +3 -2
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +30 -4
- package/plugins/lisa/skills/lisa-session-manager/scripts/human-needed.mjs +26 -1
- package/plugins/lisa/skills/lisa-session-manager/scripts/ledger-questions.mjs +16 -3
- package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +7 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +50 -13
- package/plugins/lisa-agy/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/answer-record.mjs +97 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-answer-record.mjs +71 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-cycle.mjs +1 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-human.mjs +3 -2
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +30 -4
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/human-needed.mjs +26 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/ledger-questions.mjs +16 -3
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +7 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +50 -13
- package/plugins/lisa-copilot/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/answer-record.mjs +97 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-answer-record.mjs +71 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-cycle.mjs +1 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-human.mjs +3 -2
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +30 -4
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/human-needed.mjs +26 -1
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/ledger-questions.mjs +16 -3
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +7 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +50 -13
- package/plugins/lisa-cursor/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/answer-record.mjs +97 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-answer-record.mjs +71 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-cycle.mjs +1 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-human.mjs +3 -2
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +30 -4
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/human-needed.mjs +26 -1
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/ledger-questions.mjs +16 -3
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +7 -1
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +50 -13
- package/plugins/lisa-devin/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/answer-record.mjs +97 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-answer-record.mjs +71 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-cycle.mjs +1 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-human.mjs +3 -2
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +30 -4
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/human-needed.mjs +26 -1
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/ledger-questions.mjs +16 -3
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +7 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/skills/lisa-session-manager/SKILL.md +50 -13
- package/plugins/src/base/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/src/base/skills/lisa-session-manager/scripts/answer-record.mjs +97 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-answer-record.mjs +71 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-cycle.mjs +1 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-human.mjs +3 -2
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +30 -4
- package/plugins/src/base/skills/lisa-session-manager/scripts/human-needed.mjs +26 -1
- package/plugins/src/base/skills/lisa-session-manager/scripts/ledger-questions.mjs +16 -3
- package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +7 -1
package/package.json
CHANGED
|
@@ -195,7 +195,7 @@
|
|
|
195
195
|
"qs": "^6.16.0"
|
|
196
196
|
},
|
|
197
197
|
"name": "@codyswann/lisa",
|
|
198
|
-
"version": "4.98.
|
|
198
|
+
"version": "4.98.3",
|
|
199
199
|
"description": "Governance-as-code for AI coding agents: turns a repository into agent-operated software factories with guardrails, guidance and automated enforcement for Claude Code, Codex, Cursor, OpenCode, Antigravity, Copilot and Devin",
|
|
200
200
|
"main": "dist/index.js",
|
|
201
201
|
"exports": {
|
|
@@ -357,7 +357,7 @@
|
|
|
357
357
|
"test": "tests"
|
|
358
358
|
},
|
|
359
359
|
"types": "./dist/index.d.ts",
|
|
360
|
-
"lisaReleaseCommit": "
|
|
361
|
-
"gitHead": "
|
|
362
|
-
"lisaReleaseTag": "v4.98.
|
|
360
|
+
"lisaReleaseCommit": "3318c06960d2133eb68b6acc2744e905c0ff1800",
|
|
361
|
+
"gitHead": "3318c06960d2133eb68b6acc2744e905c0ff1800",
|
|
362
|
+
"lisaReleaseTag": "v4.98.3"
|
|
363
363
|
}
|
|
@@ -249,19 +249,46 @@ leave the ledger as it is (`markedAt` stays null), carry on with the cycle and e
|
|
|
249
249
|
- `worker-question` or `decision` with a worker that has not finished: `SendMessage` it to the
|
|
250
250
|
worker when `classify <ref>` shows it live, else `resume <ref>` with the answer on STDIN.
|
|
251
251
|
- `repo-route`: stamp `repo:<name>` through `lisa-tracker-write`; the next dispatch routes it.
|
|
252
|
-
- `exhausted`: no worker is left to resume.
|
|
253
|
-
move the item to the `ready` role, and clear with `--reset-attempts` in
|
|
254
|
-
dispatch starts a fresh attempt that reads the answer on the item.
|
|
255
|
-
- `decision` with no worker yet: nothing to deliver
|
|
252
|
+
- `exhausted`: no worker is left to resume. Record the answer on the item (below). In the
|
|
253
|
+
step 2 update, also move the item to the `ready` role, and clear with `--reset-attempts` in
|
|
254
|
+
step 3, so the next dispatch starts a fresh attempt that reads the answer on the item.
|
|
255
|
+
- `decision` with no worker yet: nothing to deliver. Record the answer on the item (below); the
|
|
256
|
+
next worker reads it there.
|
|
256
257
|
- `worker-question` or `decision` whose worker already reported `DONE` or `FAILED` (the
|
|
257
258
|
question outlives the worker in the ledger, so its marker can still be removed): do not
|
|
258
|
-
resume the finished worker.
|
|
259
|
-
`resume` refuses a finished worker (exit 2), and `spawn` refuses a ref while its
|
|
260
|
-
pending, so finish this clearing first.
|
|
259
|
+
resume the finished worker. Record the answer on the item (below); the next attempt reads it
|
|
260
|
+
there. `resume` refuses a finished worker (exit 2), and `spawn` refuses a ref while its
|
|
261
|
+
question is pending, so finish this clearing first.
|
|
262
|
+
|
|
263
|
+
**Record the answer on the item** (a finished worker, an `exhausted` item, or a `decision` no
|
|
264
|
+
worker has picked up): the next attempt
|
|
265
|
+
can only read an answer that is on the item, and an answer given with `answer` or on Telegram
|
|
266
|
+
is only in the ledger, which step 3 empties. Run `answer-plan <ref>`. When it returns
|
|
267
|
+
`record: true`: Before posting, read the item's comments with `lisa-tracker-read`; when a
|
|
268
|
+
comment whose body is exactly the plan's `comment` is already there (an earlier cycle posted
|
|
269
|
+
it and then stopped), do not post it again, and take that comment as the read-back.
|
|
270
|
+
Otherwise post its `comment` exactly as given through `lisa-tracker-write` and read it
|
|
271
|
+
back with `lisa-tracker-read`; only then go on to step 2. `record: false` with `reason`
|
|
272
|
+
`answered-on-item` (the answer is already on the item) needs nothing posted. If the post or the
|
|
273
|
+
read-back fails, stop here: leave the marker and the question pending (do not run step 3),
|
|
274
|
+
carry on with the cycle and end it `recovery-required`; the next cycle's "Waiting on a human"
|
|
275
|
+
step tries again. Exit 2 means the queued answer looks like it holds a credential: post
|
|
276
|
+
nothing, keep the question pending, and ask the operator to answer again without it (a new
|
|
277
|
+
`answer` replaces the queued one).
|
|
261
278
|
2. **Remove the manager's own marker** (the `marker` the ledger recorded, nothing else) through
|
|
262
279
|
`lisa-tracker-write`, with a short comment: `[lisa-session-manager] Answer delivered; removed the
|
|
263
|
-
hold.`
|
|
264
|
-
|
|
280
|
+
hold.` when a worker received the answer (`SendMessage` or `resume`), else
|
|
281
|
+
`[lisa-session-manager] Answer recorded on the item; removed the hold.` Read it back with
|
|
282
|
+
`lisa-tracker-read`.
|
|
283
|
+
3. `ledger clear-question <ref>` (`--reset-attempts` for an `exhausted` item). After "Record the
|
|
284
|
+
answer on the item" posted (or found) a comment, run it as
|
|
285
|
+
`ledger clear-question <ref> --expect-answer-at <answerAt>`, with `answerAt` from that
|
|
286
|
+
`answer-plan`: the operator may have replaced the answer since (a new `answer` or Telegram
|
|
287
|
+
reply replaces the queued one), and a plain clear would delete the replacement unseen. On
|
|
288
|
+
exit 2 from `ledger clear-question` (the answer changed since it was planned), keep the hold:
|
|
289
|
+
do not clear (the pending question keeps the item out of dispatch even once the marker is
|
|
290
|
+
removed), and run "Record the answer on the item" again for the replacement, then this step
|
|
291
|
+
with its new `answerAt`; the next cycle's "Waiting on a human" step may do it.
|
|
265
292
|
|
|
266
293
|
## Handling messages (any time, not only during a cycle)
|
|
267
294
|
|
|
@@ -282,8 +309,18 @@ leave the ledger as it is (`markedAt` stays null), carry on with the cycle and e
|
|
|
282
309
|
Telegram plugin (0.0.7) does not, so never guess one.
|
|
283
310
|
- `answer`: follow "Clearing" in "Mark and move on" with `message` as the answer (`SendMessage`
|
|
284
311
|
to a live worker, `resume <ref>` for one that was idle-stopped or is gone without finishing,
|
|
285
|
-
|
|
286
|
-
|
|
312
|
+
the `repo:<name>` stamp for a repo-routing question), then acknowledge on Telegram.
|
|
313
|
+
**Only when no worker will receive it** — `ledger get <ref>` shows the worker reported `DONE`
|
|
314
|
+
or `FAILED`, the question is `exhausted`, or no worker was started for it (a `decision`, say;
|
|
315
|
+
never a repo-route) — first queue it in the ledger with `channel-answer <ref>` (`body` on
|
|
316
|
+
STDIN, source `channel`), so "Record the answer on the item" can post it. A live or resumable
|
|
317
|
+
worker gets its answer exactly as before, without `channel-answer`. Exit 2 from
|
|
318
|
+
`channel-answer` delivers nothing and has two causes, told apart by its stderr: one that says
|
|
319
|
+
the answer looks like it holds a credential (reply on Telegram that it was refused and should
|
|
320
|
+
be sent again without the secret), or one that says the ref has no pending question or no
|
|
321
|
+
ledger item (reply that the question was already answered or nothing is pending for it).
|
|
322
|
+
When the answer was recorded on the item, say so in the acknowledgement: it was posted on the
|
|
323
|
+
item, where anyone who can read the item can see it.
|
|
287
324
|
- `ambiguous`: ask which ref it is for, listing `candidates`, each with the label to start the
|
|
288
325
|
answer with (`Answer with: #12 <your answer>`).
|
|
289
326
|
- `invalid-command`: a mistyped command (`cap 40`, `stop A B`). Deliver it to no worker. Reply on
|
|
@@ -536,10 +573,10 @@ session `start` creates), every cycle ends in **exactly one** of the six outcome
|
|
|
536
573
|
| This cycle | Run outcome |
|
|
537
574
|
|---|---|
|
|
538
575
|
| No dispatch, no state change, no question relayed or newly pending. The summary still states the denominator: "swept N ready, 0 dispatchable; R running/C cap". | `nothing-needed` |
|
|
539
|
-
| At least one of: a worker spawned and seen live in `status`; a Blocked→Ready release written and read back; an answer delivered and its marker removed (`SendMessage` acknowledged, or `resume` returned a session id); a stalled item retried. | `change-proved` |
|
|
576
|
+
| At least one of: a worker spawned and seen live in `status`; a Blocked→Ready release written and read back; an answer delivered and its marker removed (`SendMessage` acknowledged, or `resume` returned a session id), or recorded on the item and read back before its marker was removed; a stalled item retried. | `change-proved` |
|
|
540
577
|
| An item was marked human-needed ("Mark and move on": marker and question comment written and read back), in any of the four cases, including an `exhausted` item moved to the `blocked` role, or a marked item whose question comment was re-posted after `item-answer` reported `no-question-comment`; or a worker `FAILED` moved the item to the `blocked` role with its reason comment, both read back. The summary names each ref and where to answer it. | `candidate-proposed` |
|
|
541
578
|
| No item was newly marked, but a pending question was re-sent on Telegram (`requestion`) and awaits the operator, and nothing else changed. | `approval-requested` |
|
|
542
|
-
| The tracker, a configured Telegram or `claude` was unreachable; Telegram is configured but was unavailable or unpaired (a question stayed pending with no Telegram message id); a human-needed mark could not be written or read back, or no marker is configured; a worker `FAILED`'s move to the `blocked` role could not be written or read back; a spawn failed after the claim (the item went back to Ready); the capacity probe failed. | `recovery-required` |
|
|
579
|
+
| The tracker, a configured Telegram or `claude` was unreachable; Telegram is configured but was unavailable or unpaired (a question stayed pending with no Telegram message id); a human-needed mark could not be written or read back, or no marker is configured; an answer for a finished worker, an `exhausted` item or a `decision` no worker has picked up could not be posted on the item or read back (its question stays pending); a worker `FAILED`'s move to the `blocked` role could not be written or read back; a spawn failed after the claim (the item went back to Ready); the capacity probe failed. | `recovery-required` |
|
|
543
580
|
| The retirement condition holds. | `policy-obsolete` |
|
|
544
581
|
|
|
545
582
|
`candidate-proposed` is the outcome for marking an item human-needed. The contract's section "A run
|
package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/references/runbook-template.md
CHANGED
|
@@ -41,7 +41,8 @@ than `capacity` allows.
|
|
|
41
41
|
|
|
42
42
|
A worker counts as started only when it is visible as a live session. A Blocked→Ready release counts
|
|
43
43
|
only after the item is read back in the `ready` role. An answer counts only once it was delivered to
|
|
44
|
-
the worker
|
|
44
|
+
the worker, or, when no worker will receive it (the worker finished, or the item was exhausted),
|
|
45
|
+
once it was posted on the item and read back there.
|
|
45
46
|
|
|
46
47
|
## Autonomous-vs-approval boundary
|
|
47
48
|
|
|
@@ -61,7 +62,8 @@ The operator answers with the CLI `answer` command that `status` lists, on Teleg
|
|
|
61
62
|
item (a reply from an operator or trusted author, matched on stable tracker ids, each
|
|
62
63
|
`login:` / `id:` entry by its own kind; with neither
|
|
63
64
|
`operatorIds` nor `trustedAuthorIds` set, replies on the item are not read); the next cycle
|
|
64
|
-
delivers the answer,
|
|
65
|
+
delivers the answer (or, for a finished worker or an exhausted item, records it on the item for the
|
|
66
|
+
next attempt and reads it back), removes the marker and clears the question. No question is ever asked in the
|
|
65
67
|
manager's terminal. When the manager itself cannot proceed it records `recovery-required` with a one-line
|
|
66
68
|
reason. Having no notification channel is not such a reason; a configured Telegram that is broken
|
|
67
69
|
or unpaired is.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record an operator's answer on the item when no worker will receive it
|
|
3
|
+
* (CodySwannGT/lisa#4624).
|
|
4
|
+
*
|
|
5
|
+
* An answer to a question whose worker reported `DONE` or `FAILED` (including
|
|
6
|
+
* one the operator stopped with `stop REF`), or to an `exhausted` item, is
|
|
7
|
+
* delivered to no worker: the next attempt can only read it on the item. An
|
|
8
|
+
* answer given with `answer` (source `cli`) or on Telegram (source `channel`)
|
|
9
|
+
* lives only in the ledger, and clearing the question deletes it there, so
|
|
10
|
+
* the manager must post it on the item, and read it back, before it clears.
|
|
11
|
+
* An answer that came from the item is already there, and a live worker
|
|
12
|
+
* receives its answer directly; both are left as they were.
|
|
13
|
+
*
|
|
14
|
+
* Pure: no I/O and no clock (the time is the answer's own `at`). The answer
|
|
15
|
+
* is data: it is quoted verbatim, never interpreted.
|
|
16
|
+
* @module session-manager/answer-record
|
|
17
|
+
*/
|
|
18
|
+
import {
|
|
19
|
+
MANAGER_COMMENT_PREFIX,
|
|
20
|
+
findCredentialShape,
|
|
21
|
+
} from "./human-needed.mjs";
|
|
22
|
+
|
|
23
|
+
/** Worker statuses after which no worker receives an answer. */
|
|
24
|
+
const FINISHED = new Set(["DONE", "FAILED"]);
|
|
25
|
+
|
|
26
|
+
/** How each answer source is named in the comment. */
|
|
27
|
+
const SOURCE_NAMES = { cli: "answer", channel: "Telegram" };
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The answer, kept verbatim. A one-line answer follows the colon; a longer one
|
|
31
|
+
* is quoted line by line beneath it, so its own lines can never pass for a
|
|
32
|
+
* new comment's first line.
|
|
33
|
+
* @param {string} head - First line, ending with the colon
|
|
34
|
+
* @param {string} text - Answer text
|
|
35
|
+
* @returns {string} Comment body
|
|
36
|
+
*/
|
|
37
|
+
function withAnswer(head, text) {
|
|
38
|
+
if (!/[\r\n]/.test(text)) return `${head} ${text}`;
|
|
39
|
+
const quoted = text
|
|
40
|
+
.split(/\r?\n|\r/)
|
|
41
|
+
.map(line => (line === "" ? ">" : `> ${line}`));
|
|
42
|
+
return [head, "", ...quoted].join("\n");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Why no comment is needed, or null when one is. No worker receives the
|
|
47
|
+
* answer when the worker finished, the item is `exhausted`, or no worker has
|
|
48
|
+
* been started yet (a `decision`, say): then only the item can carry it. A
|
|
49
|
+
* `repo-route` answer is always carried by the `repo:<name>` stamp.
|
|
50
|
+
* @param {string | undefined} status - The ledger item's status
|
|
51
|
+
* @param {string | null | undefined} worker - The ledger item's worker
|
|
52
|
+
* @param {{kind?: string, answer?: {source: string} | null} | null} pending
|
|
53
|
+
* - The pending question
|
|
54
|
+
* @returns {string | null} Reason
|
|
55
|
+
*/
|
|
56
|
+
function skipReason(status, worker, pending) {
|
|
57
|
+
if (!pending) return "no-pending-question";
|
|
58
|
+
if (!pending.answer) return "no-answer-queued";
|
|
59
|
+
if (pending.answer.source === "item") return "answered-on-item";
|
|
60
|
+
if (pending.kind === "repo-route") return "routed-by-repo-stamp";
|
|
61
|
+
if (pending.kind === "exhausted" || FINISHED.has(status ?? "")) return null;
|
|
62
|
+
return worker ? "worker-not-finished" : null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Plan recording a queued answer on the item. Throws when the answer looks
|
|
67
|
+
* like it holds a credential: it would be posted on the item.
|
|
68
|
+
* @param {{ref: string, status?: string, worker?: string | null,
|
|
69
|
+
* pending: object | null}} input - The item's ref, its ledger status and
|
|
70
|
+
* worker, and its pending question
|
|
71
|
+
* @returns {{ref: string, record: false, reason: string} |
|
|
72
|
+
* {ref: string, record: true, source: string, answerAt: string | null,
|
|
73
|
+
* comment: string}} Plan; answerAt is the queued answer's `at`, which
|
|
74
|
+
* `ledger clear-question --expect-answer-at` checks before clearing
|
|
75
|
+
*/
|
|
76
|
+
export function planAnswerRecord({ ref, status, worker, pending }) {
|
|
77
|
+
const reason = skipReason(status, worker, pending);
|
|
78
|
+
if (reason) return { ref, record: false, reason };
|
|
79
|
+
const { source, text, at } = pending.answer;
|
|
80
|
+
const shape = findCredentialShape(text);
|
|
81
|
+
if (shape) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
`the queued answer looks like it holds a credential (${shape}); it would be posted on the item. Nothing was planned: have the operator answer again without it and keep secrets in the secrets provider.`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
const by = SOURCE_NAMES[source] ?? source;
|
|
87
|
+
return {
|
|
88
|
+
ref,
|
|
89
|
+
record: true,
|
|
90
|
+
source,
|
|
91
|
+
answerAt: at ?? null,
|
|
92
|
+
comment: withAnswer(
|
|
93
|
+
`${MANAGER_COMMENT_PREFIX} The operator answered the question above (by ${by}, ${at ?? "time unknown"}):`,
|
|
94
|
+
text
|
|
95
|
+
),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Answers that only the item can carry to the next attempt
|
|
3
|
+
* (CodySwannGT/lisa#4624): `channel-answer` and `answer-plan`.
|
|
4
|
+
*
|
|
5
|
+
* `channel-answer` queues an operator's Telegram answer in the ledger (source
|
|
6
|
+
* `channel`), so it is handled like a terminal answer instead of being
|
|
7
|
+
* followed straight into Clearing and lost. `answer-plan` says whether the
|
|
8
|
+
* queued answer must be posted on the item before the question is cleared
|
|
9
|
+
* (the worker finished, or the item is `exhausted`) and gives the comment. It
|
|
10
|
+
* writes nothing; the manager posts through `lisa-tracker-write`, as it does
|
|
11
|
+
* for `mark-plan`. Both are manager-only: the operator answers with `answer`.
|
|
12
|
+
*
|
|
13
|
+
* Answer text arrives on stdin, never in argv, and a credential-shaped
|
|
14
|
+
* answer is refused (exit 2) before it can be queued or posted.
|
|
15
|
+
* @module session-manager/cli-answer-record
|
|
16
|
+
*/
|
|
17
|
+
import { planAnswerRecord } from "./answer-record.mjs";
|
|
18
|
+
import { refuseCredential } from "./cli-human.mjs";
|
|
19
|
+
import {
|
|
20
|
+
asSetupError,
|
|
21
|
+
asSetupErrorAsync,
|
|
22
|
+
requirePositional,
|
|
23
|
+
stdinText,
|
|
24
|
+
} from "./cli-runtime.mjs";
|
|
25
|
+
import { readLedger } from "./ledger.mjs";
|
|
26
|
+
import { queueAnswer } from "./ledger-questions.mjs";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* `channel-answer <ref>` (answer on stdin): queue the operator's Telegram
|
|
30
|
+
* answer. Exit 2 when the ref has no pending question, or the text looks
|
|
31
|
+
* like a credential.
|
|
32
|
+
* @param {object} ctx - CLI context
|
|
33
|
+
* @returns {Promise<{ json: object }>} `{queued:true,ref,source:"channel"}`
|
|
34
|
+
*/
|
|
35
|
+
export async function channelAnswer(ctx) {
|
|
36
|
+
const ref = requirePositional(ctx, "ref");
|
|
37
|
+
const text = stdinText(ctx, "answer");
|
|
38
|
+
refuseCredential(text);
|
|
39
|
+
await asSetupErrorAsync(() =>
|
|
40
|
+
queueAnswer(ctx.root, { ref, source: "channel", text })
|
|
41
|
+
);
|
|
42
|
+
return { json: { queued: true, ref, source: "channel" } };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* `answer-plan <ref>`: plan recording the queued answer on the item. Exit 2
|
|
47
|
+
* when the ledger is corrupt or the answer it would post looks like a
|
|
48
|
+
* credential (nothing is printed, so nothing can be posted).
|
|
49
|
+
* @param {object} ctx - CLI context
|
|
50
|
+
* @returns {Promise<{ json: object }>} `{ref,record:false,reason}` or
|
|
51
|
+
* `{ref,record:true,source,comment}`
|
|
52
|
+
*/
|
|
53
|
+
export async function answerPlan(ctx) {
|
|
54
|
+
const ref = requirePositional(ctx, "ref");
|
|
55
|
+
const ledger = await asSetupErrorAsync(() => readLedger(ctx.root));
|
|
56
|
+
const entry = Object.hasOwn(ledger.items, ref) ? ledger.items[ref] : null;
|
|
57
|
+
const pending = entry?.pendingQuestion ?? null;
|
|
58
|
+
// The credential refusal lives in planAnswerRecord and fires only when the
|
|
59
|
+
// plan would post the answer: an answer it would not post (one taken from
|
|
60
|
+
// the item, say) is not this command's to refuse. A refusal is a setup
|
|
61
|
+
// error: exit 2, nothing printed, so nothing can be posted.
|
|
62
|
+
const plan = asSetupError(() =>
|
|
63
|
+
planAnswerRecord({
|
|
64
|
+
ref,
|
|
65
|
+
status: entry?.status,
|
|
66
|
+
worker: entry?.worker ?? null,
|
|
67
|
+
pending,
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
return { json: plan };
|
|
71
|
+
}
|
|
@@ -131,6 +131,7 @@ const LEDGER_ACTIONS = {
|
|
|
131
131
|
clearPendingQuestion(ctx.root, {
|
|
132
132
|
ref: requirePositional(ctx, "ref"),
|
|
133
133
|
resetAttempts: ctx.values["reset-attempts"] === true,
|
|
134
|
+
expectAnswerAt: ctx.values["expect-answer-at"],
|
|
134
135
|
}),
|
|
135
136
|
async finish(ctx) {
|
|
136
137
|
const status = ctx.values.status;
|
|
@@ -116,12 +116,13 @@ function withOverruledMarker(plan, ref, label) {
|
|
|
116
116
|
/**
|
|
117
117
|
* Refuse (exit 2) text that looks like it holds a credential.
|
|
118
118
|
* @param {string} text - Answer text
|
|
119
|
+
* @param {string} [consequence] - What the refusal left undone
|
|
119
120
|
*/
|
|
120
|
-
function refuseCredential(text) {
|
|
121
|
+
export function refuseCredential(text, consequence = "nothing was queued") {
|
|
121
122
|
const shape = findCredentialShape(text);
|
|
122
123
|
if (shape) {
|
|
123
124
|
throw new CliError(
|
|
124
|
-
`The answer looks like it holds a credential (${shape});
|
|
125
|
+
`The answer looks like it holds a credential (${shape}); ${consequence}. Keep secrets in the secrets provider.`,
|
|
125
126
|
EXIT.SETUP
|
|
126
127
|
);
|
|
127
128
|
}
|
|
@@ -189,9 +189,13 @@ Per cycle
|
|
|
189
189
|
answer after it, and never reads it as an answer. Exit 2 when it is
|
|
190
190
|
missing or not a tracker comment id, or <ref> has no pending
|
|
191
191
|
question.
|
|
192
|
-
ledger clear-question <ref> [--reset-attempts]
|
|
193
|
-
After the answer is delivered
|
|
192
|
+
ledger clear-question <ref> [--reset-attempts] [--expect-answer-at <iso>]
|
|
193
|
+
After the answer is delivered (or recorded on the item and read back,
|
|
194
|
+
per answer-plan) and the marker removed. --reset-attempts
|
|
194
195
|
zeroes the attempt count (an exhausted item a human has answered).
|
|
196
|
+
--expect-answer-at: the answerAt answer-plan returned; exit 2 and
|
|
197
|
+
nothing cleared when the queued answer's at differs (the operator
|
|
198
|
+
replaced it since) or no answer is queued: record the new one first.
|
|
195
199
|
ledger finish <ref> --status DONE|FAILED [--sender <name>] STDIN: reason
|
|
196
200
|
--sender: exit 2 unless the ledger's worker for <ref> is exactly <name>.
|
|
197
201
|
ledger validation-failed <ref> --updated-at <ts> STDIN: failing gates
|
|
@@ -253,8 +257,10 @@ Per cycle
|
|
|
253
257
|
--max caps captures per cycle (default 3); the rest are deferred.
|
|
254
258
|
answer <ref> STDIN: the answer
|
|
255
259
|
Queues an operator's answer (source "cli") for the next cycle to
|
|
256
|
-
deliver
|
|
257
|
-
|
|
260
|
+
deliver to the worker, or record on the item when the worker has
|
|
261
|
+
finished or the item is exhausted. stdout {queued:true,ref,source}.
|
|
262
|
+
Exit 2 when <ref> has no pending question, or the text looks like a
|
|
263
|
+
credential.
|
|
258
264
|
item-answer <ref> STDIN: {"comments":[{user|author,body,createdAt}]}
|
|
259
265
|
Queues the human's answer from the item's comments (source "item"):
|
|
260
266
|
the first comment after the latest [lisa-session-manager-question]
|
|
@@ -280,6 +286,26 @@ Per cycle
|
|
|
280
286
|
credential-refused (exit 0) means no other reply answers yet. Exit 2
|
|
281
287
|
when <ref> has no pending question, the ledger is corrupt, or STDIN is
|
|
282
288
|
not valid JSON.
|
|
289
|
+
channel-answer <ref> STDIN: the answer
|
|
290
|
+
Manager only: queues the operator's Telegram answer (source
|
|
291
|
+
"channel"), so answer-plan can record it on the item. stdout
|
|
292
|
+
{queued:true,ref,source}. Exit 2 when <ref> has no pending question,
|
|
293
|
+
or the text looks like a credential.
|
|
294
|
+
answer-plan <ref>
|
|
295
|
+
Plans recording the queued answer on the item before clearing; writes
|
|
296
|
+
nothing. stdout {ref,record:true,source,answerAt,comment} when no
|
|
297
|
+
worker will receive the answer (the worker reported DONE or FAILED,
|
|
298
|
+
the question is exhausted, or no worker was started) and the answer
|
|
299
|
+
came from answer (source cli) or Telegram (source channel): post
|
|
300
|
+
comment ([lisa-session-manager] The operator answered the question
|
|
301
|
+
above (by answer|Telegram, <time>): <answer>) and read it back, then
|
|
302
|
+
ledger clear-question --expect-answer-at <answerAt> (answerAt: the
|
|
303
|
+
queued answer's at). A repo-route never records (the repo stamp carries
|
|
304
|
+
it). Otherwise {ref,record:false,reason:no-pending-question|
|
|
305
|
+
no-answer-queued|answered-on-item|worker-not-finished|
|
|
306
|
+
routed-by-repo-stamp}. Exit 2 when the answer it would post looks
|
|
307
|
+
like a credential (nothing printed, nothing to post) or the ledger
|
|
308
|
+
is corrupt.
|
|
283
309
|
record-cycle --outcome <outcome> [--ref <url>]... [--run-id <id>]
|
|
284
310
|
STDIN: one-line summary. Records loop session-manager with runbook
|
|
285
311
|
.lisa/automations/session-manager.runbook.md. stdout {path,appended,
|
|
@@ -149,6 +149,14 @@ function planningMissPlan({ ref, kind, cause, question, overruled }) {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Starts every other comment the manager posts. `item-answer` never reads a
|
|
154
|
+
* comment that starts with a bracketed `[lisa-...]` tag as an answer, so the
|
|
155
|
+
* manager's own notes (and the answers it records on the item) are never
|
|
156
|
+
* taken for a new answer.
|
|
157
|
+
*/
|
|
158
|
+
export const MANAGER_COMMENT_PREFIX = "[lisa-session-manager]";
|
|
159
|
+
|
|
152
160
|
/** Marks the manager's question comment, so its answer can be found after it. */
|
|
153
161
|
export const QUESTION_MARKER = "[lisa-session-manager-question]";
|
|
154
162
|
|
|
@@ -173,6 +181,23 @@ const CREDENTIAL_SHAPES = [
|
|
|
173
181
|
["API key", /\bsk-(?:ant-)?[A-Za-z0-9_-]{20,}/],
|
|
174
182
|
["private key", /-----BEGIN [A-Z ]*PRIVATE KEY-----/],
|
|
175
183
|
["bearer token", /\bbearer\s+[A-Za-z0-9._~+/=-]{20,}/i],
|
|
184
|
+
// The password part cannot cross a `/`, so a port, a path or a query
|
|
185
|
+
// holding an `@` (`http://host:3000/q?owner=a@b.com`) is not refused.
|
|
186
|
+
["URI with a password", /\b[a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:[^\s/@]+@/i],
|
|
187
|
+
// Env-style names (GITHUB_TOKEN, client_secret, DB_PASSWORD) are caught by
|
|
188
|
+
// allowing an identifier prefix: `\b` does not fire after `_`. The value
|
|
189
|
+
// must hold a digit and be 8+ characters, so ordinary prose ("token:
|
|
190
|
+
// expires daily", "secret: yes") is not refused.
|
|
191
|
+
[
|
|
192
|
+
"password or secret assignment",
|
|
193
|
+
/(?:^|[^A-Za-z0-9])[A-Za-z0-9_-]*(?:password|passwd|secret|token)\s*[=:]\s*(?=\S*\d)\S{8,}/i,
|
|
194
|
+
],
|
|
195
|
+
// A password needs no digit to be one: refuse a long value outright
|
|
196
|
+
// (`password: changeme` is still accepted).
|
|
197
|
+
[
|
|
198
|
+
"password assignment",
|
|
199
|
+
/(?:^|[^A-Za-z0-9])[A-Za-z0-9_-]*(?:password|passwd)\s*[=:]\s*\S{12,}/i,
|
|
200
|
+
],
|
|
176
201
|
];
|
|
177
202
|
|
|
178
203
|
/**
|
|
@@ -233,7 +258,7 @@ function questionComment({
|
|
|
233
258
|
"How to answer:",
|
|
234
259
|
...ways,
|
|
235
260
|
"",
|
|
236
|
-
`The session manager keeps working on other items meanwhile. Once the answer is delivered it removes ${markerText} and says so here.`,
|
|
261
|
+
`The session manager keeps working on other items meanwhile. Once the answer is delivered to the worker, or recorded here for the next attempt, it removes ${markerText} and says so here.`,
|
|
237
262
|
].join("\n");
|
|
238
263
|
}
|
|
239
264
|
|
|
@@ -231,19 +231,32 @@ export function setPendingQuestion(
|
|
|
231
231
|
* Clear an item's pending question, once its answer has been delivered and
|
|
232
232
|
* the manager's own marker removed. `resetAttempts` zeroes the attempt count:
|
|
233
233
|
* an `exhausted` item a human has answered starts again from attempt one
|
|
234
|
-
* instead of being exhausted again on its first stall.
|
|
234
|
+
* instead of being exhausted again on its first stall. `expectAnswerAt` is
|
|
235
|
+
* the queued answer's `at` that `answer-plan` recorded on the item: when the
|
|
236
|
+
* pending answer's `at` differs (the operator replaced it since, or none is
|
|
237
|
+
* queued), nothing is cleared and it throws, so a replacement is never
|
|
238
|
+
* deleted unseen (CodySwannGT/lisa#4624). Without it, nothing is compared.
|
|
235
239
|
* @param {string} projectRoot - Absolute project root
|
|
236
|
-
* @param {{ref: string, resetAttempts?: boolean}}
|
|
240
|
+
* @param {{ref: string, resetAttempts?: boolean, expectAnswerAt?: string}}
|
|
241
|
+
* target - Item
|
|
237
242
|
* @param {import("./ledger.mjs").LedgerSeams} [seams] - Injected seams
|
|
238
243
|
* @returns {Promise<import("./ledger.mjs").LedgerItem>} The updated item
|
|
239
244
|
*/
|
|
240
245
|
export function clearPendingQuestion(
|
|
241
246
|
projectRoot,
|
|
242
|
-
{ ref, resetAttempts = false },
|
|
247
|
+
{ ref, resetAttempts = false, expectAnswerAt },
|
|
243
248
|
seams
|
|
244
249
|
) {
|
|
245
250
|
return updateLedger(projectRoot, seams, (ledger, at) => {
|
|
246
251
|
const previous = requireItem(ledger, ref);
|
|
252
|
+
if (
|
|
253
|
+
expectAnswerAt !== undefined &&
|
|
254
|
+
previous.pendingQuestion?.answer?.at !== expectAnswerAt
|
|
255
|
+
) {
|
|
256
|
+
throw new Error(
|
|
257
|
+
`the answer changed since it was planned (${ref}); nothing was cleared. Record the new one first: run answer-plan again and post its comment.`
|
|
258
|
+
);
|
|
259
|
+
}
|
|
247
260
|
return withItem(ledger, ref, {
|
|
248
261
|
...previous,
|
|
249
262
|
pendingQuestion: null,
|
|
@@ -38,6 +38,7 @@ import path from "node:path";
|
|
|
38
38
|
import { fileURLToPath } from "node:url";
|
|
39
39
|
import { parseArgs } from "node:util";
|
|
40
40
|
|
|
41
|
+
import { answerPlan, channelAnswer } from "./cli-answer-record.mjs";
|
|
41
42
|
import {
|
|
42
43
|
LEDGER_ACTION_NAMES,
|
|
43
44
|
blockedPlan,
|
|
@@ -128,6 +129,8 @@ const COMMANDS = {
|
|
|
128
129
|
},
|
|
129
130
|
answer: { run: answer, options: {}, positionals: 1 },
|
|
130
131
|
"item-answer": { run: itemAnswer, options: {}, positionals: 1 },
|
|
132
|
+
"channel-answer": { run: channelAnswer, options: {}, positionals: 1 },
|
|
133
|
+
"answer-plan": { run: answerPlan, options: {}, positionals: 1 },
|
|
131
134
|
"record-cycle": {
|
|
132
135
|
run: recordCycle,
|
|
133
136
|
options: {
|
|
@@ -154,7 +157,10 @@ const LEDGER_SPECS = {
|
|
|
154
157
|
options: { "marker-type": text, marker: text, "comment-id": text },
|
|
155
158
|
positionals: 1,
|
|
156
159
|
},
|
|
157
|
-
"clear-question": {
|
|
160
|
+
"clear-question": {
|
|
161
|
+
options: { "reset-attempts": flag, "expect-answer-at": text },
|
|
162
|
+
positionals: 1,
|
|
163
|
+
},
|
|
158
164
|
finish: { options: { status: text, sender: text }, positionals: 1 },
|
|
159
165
|
"validation-failed": { options: { "updated-at": text }, positionals: 1 },
|
|
160
166
|
"validation-cleared": { options: {}, positionals: 1 },
|
|
@@ -247,19 +247,46 @@ leave the ledger as it is (`markedAt` stays null), carry on with the cycle and e
|
|
|
247
247
|
- `worker-question` or `decision` with a worker that has not finished: `SendMessage` it to the
|
|
248
248
|
worker when `classify <ref>` shows it live, else `resume <ref>` with the answer on STDIN.
|
|
249
249
|
- `repo-route`: stamp `repo:<name>` through `lisa-tracker-write`; the next dispatch routes it.
|
|
250
|
-
- `exhausted`: no worker is left to resume.
|
|
251
|
-
move the item to the `ready` role, and clear with `--reset-attempts` in
|
|
252
|
-
dispatch starts a fresh attempt that reads the answer on the item.
|
|
253
|
-
- `decision` with no worker yet: nothing to deliver
|
|
250
|
+
- `exhausted`: no worker is left to resume. Record the answer on the item (below). In the
|
|
251
|
+
step 2 update, also move the item to the `ready` role, and clear with `--reset-attempts` in
|
|
252
|
+
step 3, so the next dispatch starts a fresh attempt that reads the answer on the item.
|
|
253
|
+
- `decision` with no worker yet: nothing to deliver. Record the answer on the item (below); the
|
|
254
|
+
next worker reads it there.
|
|
254
255
|
- `worker-question` or `decision` whose worker already reported `DONE` or `FAILED` (the
|
|
255
256
|
question outlives the worker in the ledger, so its marker can still be removed): do not
|
|
256
|
-
resume the finished worker.
|
|
257
|
-
`resume` refuses a finished worker (exit 2), and `spawn` refuses a ref while its
|
|
258
|
-
pending, so finish this clearing first.
|
|
257
|
+
resume the finished worker. Record the answer on the item (below); the next attempt reads it
|
|
258
|
+
there. `resume` refuses a finished worker (exit 2), and `spawn` refuses a ref while its
|
|
259
|
+
question is pending, so finish this clearing first.
|
|
260
|
+
|
|
261
|
+
**Record the answer on the item** (a finished worker, an `exhausted` item, or a `decision` no
|
|
262
|
+
worker has picked up): the next attempt
|
|
263
|
+
can only read an answer that is on the item, and an answer given with `answer` or on Telegram
|
|
264
|
+
is only in the ledger, which step 3 empties. Run `answer-plan <ref>`. When it returns
|
|
265
|
+
`record: true`: Before posting, read the item's comments with `lisa-tracker-read`; when a
|
|
266
|
+
comment whose body is exactly the plan's `comment` is already there (an earlier cycle posted
|
|
267
|
+
it and then stopped), do not post it again, and take that comment as the read-back.
|
|
268
|
+
Otherwise post its `comment` exactly as given through `lisa-tracker-write` and read it
|
|
269
|
+
back with `lisa-tracker-read`; only then go on to step 2. `record: false` with `reason`
|
|
270
|
+
`answered-on-item` (the answer is already on the item) needs nothing posted. If the post or the
|
|
271
|
+
read-back fails, stop here: leave the marker and the question pending (do not run step 3),
|
|
272
|
+
carry on with the cycle and end it `recovery-required`; the next cycle's "Waiting on a human"
|
|
273
|
+
step tries again. Exit 2 means the queued answer looks like it holds a credential: post
|
|
274
|
+
nothing, keep the question pending, and ask the operator to answer again without it (a new
|
|
275
|
+
`answer` replaces the queued one).
|
|
259
276
|
2. **Remove the manager's own marker** (the `marker` the ledger recorded, nothing else) through
|
|
260
277
|
`lisa-tracker-write`, with a short comment: `[lisa-session-manager] Answer delivered; removed the
|
|
261
|
-
hold.`
|
|
262
|
-
|
|
278
|
+
hold.` when a worker received the answer (`SendMessage` or `resume`), else
|
|
279
|
+
`[lisa-session-manager] Answer recorded on the item; removed the hold.` Read it back with
|
|
280
|
+
`lisa-tracker-read`.
|
|
281
|
+
3. `ledger clear-question <ref>` (`--reset-attempts` for an `exhausted` item). After "Record the
|
|
282
|
+
answer on the item" posted (or found) a comment, run it as
|
|
283
|
+
`ledger clear-question <ref> --expect-answer-at <answerAt>`, with `answerAt` from that
|
|
284
|
+
`answer-plan`: the operator may have replaced the answer since (a new `answer` or Telegram
|
|
285
|
+
reply replaces the queued one), and a plain clear would delete the replacement unseen. On
|
|
286
|
+
exit 2 from `ledger clear-question` (the answer changed since it was planned), keep the hold:
|
|
287
|
+
do not clear (the pending question keeps the item out of dispatch even once the marker is
|
|
288
|
+
removed), and run "Record the answer on the item" again for the replacement, then this step
|
|
289
|
+
with its new `answerAt`; the next cycle's "Waiting on a human" step may do it.
|
|
263
290
|
|
|
264
291
|
## Handling messages (any time, not only during a cycle)
|
|
265
292
|
|
|
@@ -280,8 +307,18 @@ leave the ledger as it is (`markedAt` stays null), carry on with the cycle and e
|
|
|
280
307
|
Telegram plugin (0.0.7) does not, so never guess one.
|
|
281
308
|
- `answer`: follow "Clearing" in "Mark and move on" with `message` as the answer (`SendMessage`
|
|
282
309
|
to a live worker, `resume <ref>` for one that was idle-stopped or is gone without finishing,
|
|
283
|
-
|
|
284
|
-
|
|
310
|
+
the `repo:<name>` stamp for a repo-routing question), then acknowledge on Telegram.
|
|
311
|
+
**Only when no worker will receive it** — `ledger get <ref>` shows the worker reported `DONE`
|
|
312
|
+
or `FAILED`, the question is `exhausted`, or no worker was started for it (a `decision`, say;
|
|
313
|
+
never a repo-route) — first queue it in the ledger with `channel-answer <ref>` (`body` on
|
|
314
|
+
STDIN, source `channel`), so "Record the answer on the item" can post it. A live or resumable
|
|
315
|
+
worker gets its answer exactly as before, without `channel-answer`. Exit 2 from
|
|
316
|
+
`channel-answer` delivers nothing and has two causes, told apart by its stderr: one that says
|
|
317
|
+
the answer looks like it holds a credential (reply on Telegram that it was refused and should
|
|
318
|
+
be sent again without the secret), or one that says the ref has no pending question or no
|
|
319
|
+
ledger item (reply that the question was already answered or nothing is pending for it).
|
|
320
|
+
When the answer was recorded on the item, say so in the acknowledgement: it was posted on the
|
|
321
|
+
item, where anyone who can read the item can see it.
|
|
285
322
|
- `ambiguous`: ask which ref it is for, listing `candidates`, each with the label to start the
|
|
286
323
|
answer with (`Answer with: #12 <your answer>`).
|
|
287
324
|
- `invalid-command`: a mistyped command (`cap 40`, `stop A B`). Deliver it to no worker. Reply on
|
|
@@ -534,10 +571,10 @@ session `start` creates), every cycle ends in **exactly one** of the six outcome
|
|
|
534
571
|
| This cycle | Run outcome |
|
|
535
572
|
|---|---|
|
|
536
573
|
| No dispatch, no state change, no question relayed or newly pending. The summary still states the denominator: "swept N ready, 0 dispatchable; R running/C cap". | `nothing-needed` |
|
|
537
|
-
| At least one of: a worker spawned and seen live in `status`; a Blocked→Ready release written and read back; an answer delivered and its marker removed (`SendMessage` acknowledged, or `resume` returned a session id); a stalled item retried. | `change-proved` |
|
|
574
|
+
| At least one of: a worker spawned and seen live in `status`; a Blocked→Ready release written and read back; an answer delivered and its marker removed (`SendMessage` acknowledged, or `resume` returned a session id), or recorded on the item and read back before its marker was removed; a stalled item retried. | `change-proved` |
|
|
538
575
|
| An item was marked human-needed ("Mark and move on": marker and question comment written and read back), in any of the four cases, including an `exhausted` item moved to the `blocked` role, or a marked item whose question comment was re-posted after `item-answer` reported `no-question-comment`; or a worker `FAILED` moved the item to the `blocked` role with its reason comment, both read back. The summary names each ref and where to answer it. | `candidate-proposed` |
|
|
539
576
|
| No item was newly marked, but a pending question was re-sent on Telegram (`requestion`) and awaits the operator, and nothing else changed. | `approval-requested` |
|
|
540
|
-
| The tracker, a configured Telegram or `claude` was unreachable; Telegram is configured but was unavailable or unpaired (a question stayed pending with no Telegram message id); a human-needed mark could not be written or read back, or no marker is configured; a worker `FAILED`'s move to the `blocked` role could not be written or read back; a spawn failed after the claim (the item went back to Ready); the capacity probe failed. | `recovery-required` |
|
|
577
|
+
| The tracker, a configured Telegram or `claude` was unreachable; Telegram is configured but was unavailable or unpaired (a question stayed pending with no Telegram message id); a human-needed mark could not be written or read back, or no marker is configured; an answer for a finished worker, an `exhausted` item or a `decision` no worker has picked up could not be posted on the item or read back (its question stays pending); a worker `FAILED`'s move to the `blocked` role could not be written or read back; a spawn failed after the claim (the item went back to Ready); the capacity probe failed. | `recovery-required` |
|
|
541
578
|
| The retirement condition holds. | `policy-obsolete` |
|
|
542
579
|
|
|
543
580
|
`candidate-proposed` is the outcome for marking an item human-needed. The contract's section "A run
|
|
@@ -41,7 +41,8 @@ than `capacity` allows.
|
|
|
41
41
|
|
|
42
42
|
A worker counts as started only when it is visible as a live session. A Blocked→Ready release counts
|
|
43
43
|
only after the item is read back in the `ready` role. An answer counts only once it was delivered to
|
|
44
|
-
the worker
|
|
44
|
+
the worker, or, when no worker will receive it (the worker finished, or the item was exhausted),
|
|
45
|
+
once it was posted on the item and read back there.
|
|
45
46
|
|
|
46
47
|
## Autonomous-vs-approval boundary
|
|
47
48
|
|
|
@@ -61,7 +62,8 @@ The operator answers with the CLI `answer` command that `status` lists, on Teleg
|
|
|
61
62
|
item (a reply from an operator or trusted author, matched on stable tracker ids, each
|
|
62
63
|
`login:` / `id:` entry by its own kind; with neither
|
|
63
64
|
`operatorIds` nor `trustedAuthorIds` set, replies on the item are not read); the next cycle
|
|
64
|
-
delivers the answer,
|
|
65
|
+
delivers the answer (or, for a finished worker or an exhausted item, records it on the item for the
|
|
66
|
+
next attempt and reads it back), removes the marker and clears the question. No question is ever asked in the
|
|
65
67
|
manager's terminal. When the manager itself cannot proceed it records `recovery-required` with a one-line
|
|
66
68
|
reason. Having no notification channel is not such a reason; a configured Telegram that is broken
|
|
67
69
|
or unpaired is.
|