@markus-global/cli 0.12.0-rc.1 → 0.12.0-rc.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/background-maintenance.d.ts +52 -0
- package/dist/background-maintenance.d.ts.map +1 -0
- package/dist/background-maintenance.js +119 -0
- package/dist/background-maintenance.js.map +1 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +35 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/markus.mjs +6475 -3633
- package/dist/web-ui/assets/{AsyncState-Brx503Qq.js → AsyncState-Bn4fEZi_.js} +1 -1
- package/dist/web-ui/assets/{CommentInput-CyyImwaF.js → CommentInput-K5GGyiKb.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-CpiisvVQ.js → ContentRenderer-BfUE28DF.js} +2 -2
- package/dist/web-ui/assets/{DeliverableShareModal-BbvcR0LN.js → DeliverableShareModal-BA31hw63.js} +1 -1
- package/dist/web-ui/assets/{Deliverables-DIeYy6k7.js → Deliverables-DTE21gMR.js} +2 -2
- package/dist/web-ui/assets/{Notifications-BoPgYIh8.js → Notifications-DrhzF29n.js} +1 -1
- package/dist/web-ui/assets/{Search-Bc44e8vT.js → Search-B_FQwfHn.js} +1 -1
- package/dist/web-ui/assets/{SendToChat-BHNwDw6Q.js → SendToChat-DjBI_C0Z.js} +1 -1
- package/dist/web-ui/assets/{Settings-5tk3XjBZ.js → Settings-BG3HtYuY.js} +1 -1
- package/dist/web-ui/assets/{Store-CMxzEtXt.js → Store-CvRIK-5v.js} +1 -1
- package/dist/web-ui/assets/{Switch-C1h7-ixU.js → Switch-DBd7W9Pv.js} +1 -1
- package/dist/web-ui/assets/{Team-Dcl-5Zvh.js → Team-Cre9JXT2.js} +44 -44
- package/dist/web-ui/assets/{Work-Dj9tQYXg.js → Work-C77VUxw5.js} +6 -6
- package/dist/web-ui/assets/{arc-BA1zZ3ag.js → arc-B8WSMmgB.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-DTUETQs3.js → architectureDiagram-3BPJPVTR-DE0fnpkU.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-D5dvIq_3.js → blockDiagram-GPEHLZMM-BnEt7L8I.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-CBurhkOF.js → c4Diagram-AAUBKEIU-0jt--EpH.js} +1 -1
- package/dist/web-ui/assets/channel-MmWww9CF.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-JDr6ZP1p.js → chunk-2J33WTMH-CLyqQEQo.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-CsXt6Gd5.js → chunk-4BX2VUAB-mylnMthq.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-BPhC3YgG.js → chunk-55IACEB6-DtElV09S.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-BgceLEQx.js → chunk-727SXJPM-BpRwLol3.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-Bq58a84v.js → chunk-AQP2D5EJ-5yxNM2TB.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-DyMa3olF.js → chunk-FMBD7UC4-no_NwFEB.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-BsgTeDYu.js → chunk-ND2GUHAM-JvDwwYzS.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-BQpJPCpr.js → chunk-QZHKN3VN-C-NPps0e.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-lROpDb6P.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-lROpDb6P.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-BCbssvKI.js → cose-bilkent-S5V4N54A-OUCdAUoH.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-CT9IdAY4.js → dagre-BM42HDAG-BJNrdNyh.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-x2pwUpLt.js → diagram-2AECGRRQ-CXqfw0Vf.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-d9_JOrSK.js → diagram-5GNKFQAL-Dhik8K7x.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-CAVFWSkN.js → diagram-KO2AKTUF-DzTqoIpG.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-DQEHXvkq.js → diagram-LMA3HP47-CzPaYK-1.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-BW62W4O-.js → diagram-OG6HWLK6-D3i9cNLV.js} +1 -1
- package/dist/web-ui/assets/{docx-preview-pqFDBX8M.js → docx-preview-BE8zQneZ.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-yYImCEy2.js → erDiagram-TEJ5UH35-DZ6wi5nS.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-Cpk1pKF0.js → flowDiagram-I6XJVG4X-CEbBUrOM.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-BnwH90c8.js → ganttDiagram-6RSMTGT7-lo_doOaC.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-ELEziEhc.js → gitGraphDiagram-PVQCEYII-C3mdtDuF.js} +1 -1
- package/dist/web-ui/assets/{index-DD3NMntN.css → index-D4zDaGe4.css} +1 -1
- package/dist/web-ui/assets/index-DyYU0JDE.js +883 -0
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-48XZ0hV0.js → infoDiagram-5YYISTIA-6I0hh52X.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-B0wQJGwe.js → ishikawaDiagram-YF4QCWOH-BOk8zKdQ.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-BNsrI94Q.js → journeyDiagram-JHISSGLW-C3KEoO7x.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-Cp8eSqCe.js → kanban-definition-UN3LZRKU-DCT0_9gO.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-BYCWrkC-.js → mermaid.core-BOX2l4yL.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-Ccay8RYS.js → mindmap-definition-RKZ34NQL-KkRXcsxC.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-BUzaEdin.js → pieDiagram-4H26LBE5-Crj5MjvX.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-BtM1AkZX.js → quadrantDiagram-W4KKPZXB-CKhlan97.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-eqO2tGIB.js → requirementDiagram-4Y6WPE33-B7OrOTSq.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-M6qPg2gI.js → sankeyDiagram-5OEKKPKP-CzvhKY35.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-DtIYVpzR.js → sequenceDiagram-3UESZ5HK-CiNjJsfF.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-CLVsjtbI.js → stateDiagram-AJRCARHV-DBsBa5mY.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DsfVE1eK.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-CUwncHES.js → timeline-definition-PNZ67QCA-CL-8e5v_.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-KDkzNQIk.js → vennDiagram-CIIHVFJN-CWgqoJu8.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-BqliL5Bv.js → wardley-L42UT6IY-ZgIWnerm.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-B4qeGz2Q.js → wardleyDiagram-YWT4CUSO-CBWa7zOH.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-3877u0ek.js → xychartDiagram-2RQKCTM6-Du9MvrT6.js} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/docs/architecture/mailbox-audit-checklist.md +194 -0
- package/docs/architecture/mailbox-system.md +374 -74
- package/docs/architecture/task-attention-economy.md +91 -0
- package/docs/records/page-switch-jank-2026-10-23.md +174 -0
- package/docs/remote-access/fast-path-plan.md +179 -0
- package/package.json +1 -1
- package/templates/roles/HANDBOOK.md +20 -0
- package/dist/web-ui/assets/channel-CYxqacYz.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-mygctjMz.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-mygctjMz.js +0 -1
- package/dist/web-ui/assets/index-Dt7RN5t2.js +0 -883
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-BfZl6BED.js +0 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Mailbox System — Documentation × Code Audit Checklist
|
|
2
|
+
|
|
3
|
+
**Scope**: `docs/architecture/mailbox-system.md` (1815 lines, §1–§27)
|
|
4
|
+
**Started**: 2026-10-25
|
|
5
|
+
**Method**: for every falsifiable claim — verify against code, judge, then fix whichever side is wrong, re-verify, and tick it. One row = one atomic checkable fact.
|
|
6
|
+
|
|
7
|
+
**Legend**
|
|
8
|
+
- `⬜` not started
|
|
9
|
+
- `🔍` verifying
|
|
10
|
+
- `✅` code matches the doc (claim holds)
|
|
11
|
+
- `📝` doc was wrong → doc updated
|
|
12
|
+
- `🔧` code was wrong → code refactored
|
|
13
|
+
- `🧪` test was wrong → test fixed
|
|
14
|
+
- `⚠️` known gap, doc now states it honestly (no fix by design)
|
|
15
|
+
|
|
16
|
+
**Rule**: a row is only ticked when the fix is verified by `tsc` + a test run, not when it merely looks right.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## §1–§9 — Architecture, type registry, attention, API, persistence
|
|
21
|
+
|
|
22
|
+
| # | § | Claim | Verdict | Status |
|
|
23
|
+
|---|---|---|---|---|
|
|
24
|
+
| s1-01 | §1 | Concurrent multi-worker on by default; disabled by `concurrent.enabled=false` or `maxWorkers=1` | default `{enabled:true, maxWorkers:3}`; `if (!c.enabled) return 1`; clamp 1-10 (agent.ts:852-854) | ✅ |
|
|
25
|
+
| s1-02 | §1 | Mailbox holds an entity-affinity lock; worker skips items whose entity key is locked | `if (!this.mailbox.lockEntities(keys, holder))` → `putBack` + handoff event (attention.ts:875-882) | ✅ |
|
|
26
|
+
| s1-03 | §1 | Each concurrent worker has an isolated `SessionWorkspace` over `AsyncLocalStorage` | `sessionWorkspaceStore.run(workspace, ...)` at attention.ts:872; AsyncLocalStorage imported agent.ts:92 | ✅ |
|
|
27
|
+
| s1-04 | §1 | Triage/deliberation/preempt run only in the serial loop, never in worker loops | worker-loop contract states it verbatim: pure consumer, no triage/deliberation/preempt (attention.ts:822) | ✅ |
|
|
28
|
+
| s1-05 | §2 | Mailbox is a per-agent priority queue with dedup; dequeued by priority then FIFO | `insertSorted` on enqueue/putBack (mailbox.ts:729, 1271); SQL `ORDER BY priority ASC, queued_at ASC` | ✅ |
|
|
29
|
+
| s1-06 | §2 | Attention loop body is `delegate.processMailboxItem()`; concurrent enters via `launchWorkerPool()` | delegate interface at :81; `launchWorkerPool` at :437/:458 | ✅ |
|
|
30
|
+
| s1-07 | §2 | `PendingCallbackRegistry` delivers completions by enqueuing `callback_result` | agent.ts:7819 `enqueueToMailbox('callback_result', ...)` | ✅ |
|
|
31
|
+
| s1-08 | §3.1 | `MAILBOX_TYPE_REGISTRY` lives in `@markus/shared` at `types/mailbox.ts` | holds | ✅ |
|
|
32
|
+
| s1-09 | §3.1 | Registry keys equal the `MailboxItemType` union | both 15, union==keys. Doc never claimed 16 (that was a subagent miscount) | ✅ |
|
|
33
|
+
| s1-10 | §3.1 | Registry priorities: human_chat 0; 7 types at 1; 5 at 2; heartbeat 3; memory_consolidation 4 | exact match | ✅ |
|
|
34
|
+
| s1-11 | §3.1 | `task_comment`/`requirement_comment` are createsActivity=false, invokesLLM=false; `callback_result` both true | exact match | ✅ |
|
|
35
|
+
| s1-12 | §3.1 | `USER_INTERACTION_TYPES`/`PEER_INTERACTION_TYPES` hardcoded in `attention.ts`; heuristics hardcode literals | true, but cited line numbers had drifted (1493-1500 → 1595-1597) | 📝 |
|
|
36
|
+
| s1-13 | §3.2 | `MailboxTypeDescriptor` has exactly 7 fields | 8 fields — `entityScopes` missing from doc | 📝 |
|
|
37
|
+
| s1-14 | §3.2 | `MailboxCategory` is exactly interaction/task/notification/system | holds | ✅ |
|
|
38
|
+
| s1-15 | §3.3 | Category memberships match the §3.3 table | exact match with MAILBOX_CATEGORIES | ✅ |
|
|
39
|
+
| s1-16 | §3.4 | Execution-mode `task_status_update` requires `extra.triggerExecution=true`, priority 1, processed by `executeTask()` | sendTaskExecution sets it (agent.ts:1609-1634); consumer branches on it (2455) | ✅ |
|
|
40
|
+
| s1-17 | §3.4 | Informational `task_status_update` auto-completes with no LLM call | `extra.triggerExecution ? 'executed' : 'noted (informational)'` (agent.ts:2819) | ✅ |
|
|
41
|
+
| s1-18 | §3.4 | `SILENT_TRANSITIONS` contains blocked→in_progress and in_progress→blocked, consulted early in `maybeNotifyAssignee()` | exact set, checked before other branches (task-service.ts:3532,3546) | ✅ |
|
|
42
|
+
| s1-19 | §3.4 | On in_progress→review the assignee notification is skipped; only the reviewer gets `review_request` | `if (from === 'in_progress' && to === 'review') return;` (3544) | ✅ |
|
|
43
|
+
| s1-20 | §3.4 | `requirement_update` with `actionRequired=true` invokes LLM with `scenario='requirement_action'`; priorities 1/1/2 | agent.ts:2580 `scenario: 'requirement_action'`; extra.actionRequired set in requirement-service.ts:784,988 | ✅ |
|
|
44
|
+
| s1-21 | §3.4 | `task_comment` on an actively-executing task is injected via `injectUserMessage`, else falls back to `handleMessage` | agent.ts:2638 injectUserMessage; injectUserMessage defined 3259 | ✅ |
|
|
45
|
+
| s1-22 | §3.4 | Review-comment cascade suppression fires when status=review and author===reviewerId | Mechanism exists but doc had recipients backwards: it wakes the **assignee** (`review_verdict`) and suppresses creator/watchers | 📝 |
|
|
46
|
+
| s1-23 | §3.4 | Callback `deliveryMode='in_session'`→`callback_result`; `'mailbox'`→`system_event` | pending-callback.ts:31,64,107; routing in deliverCallback | ✅ |
|
|
47
|
+
| s1-24 | §3.4 | `registerBackgroundSession()` called from `executeTool`, keyed by bg session id, origin=active session | agent.ts:7863 call, 7933 definition | ✅ |
|
|
48
|
+
| s1-25 | §3.4 | `schedule_wakeup` registers a `wakeup` callback carrying `wakeAt` and optional `recurringMs` | agent.ts:7915-7928 handles both fields | ✅ |
|
|
49
|
+
| s1-26 | §3.5 | `task_comments`/`requirement_comments` have `reply_to_id`; reads LEFT JOIN parent for replyToAuthor/Content | sqlite-storage.ts:167,215,867; serialized as replyToAuthor/replyToContent | ✅ |
|
|
50
|
+
| s1-27 | §4 | No polling: new mail emits `mailbox:new-item`, which sets the interrupt signal | attention.ts:417 emits it | ✅ |
|
|
51
|
+
| s1-28 | §4 | `checkYieldPoint()` called between LLM turns in executeTask/handleMessage/handleMessageStream | wrapper `checkAttentionYieldPoint()` has **5** call sites, not the 3 named | 📝 |
|
|
52
|
+
| s1-29 | §4 | `preempt` sets status `deferred`; `resurfaceDue()` re-queues deferred items when idle | `deferItem()` + `resurfaceDue()` exist; attention.ts:609 calls it in the idle loop | ✅ |
|
|
53
|
+
| s1-30 | §4 | `cancel` marks the item `completed` permanently, never resumed | decision is `cancel`/stopReason `user_cancel`; item's terminal status still to confirm | 🔍 |
|
|
54
|
+
| s1-31 | §4 | `heuristicDecision` never returns `cancel`; only the LLM judge can, and only after heuristics say continue | R0/R1/R1.5 return only continue/merge/preempt; `cancel` comes from `userCancelCurrent` | ✅ |
|
|
55
|
+
| s1-32 | §4 | `human_chat` is the only priority-0 type and the only member of `USER_INTERACTION_TYPES` | `new Set(['human_chat'])` at attention.ts:1595 | ✅ |
|
|
56
|
+
| s1-33 | §4 | The system prompt embeds the full mailbox queue, not a truncated view | `ContextEngine.buildMailboxSection` emits a count + top items each sliced to `SYSTEM_MAILBOX_ITEM_PREVIEW_CHARS` — explicitly truncated | 📝 |
|
|
57
|
+
| s1-34 | §4 | Non-preemptable = chat only; preemptable = a2a/comment_response/requirement_action/review/heartbeat/memory_consolidation | code is a single predicate `scenario !== 'chat'`; the doc's enumeration is a derived list, not a separate table | 📝 |
|
|
58
|
+
| s1-35 | §4 | `handleMessageStream` honours only `merge` and restores (does not consume) the signal on preempt/cancel | all four yield sites branch explicitly on merge/cancel/preempt (agent.ts:5536,6283,7015,7534) | ✅ |
|
|
59
|
+
| s1-36 | §4 | `stop()`/`pause()` call `cancelActiveStream()`; `AttentionController.stop()` sets running=false and wakes `dequeueAsync()` | agent.ts:1330; attention.ts:486 stop() → running=false + `mailbox.cancelWait()` | ✅ |
|
|
60
|
+
| s1-37 | §4 | On stop/pause an in-flight item is requeued, not lost; deferred items survive in the DB | stop() only halts the loop — no immediate requeue; in-flight rows stay `processing` until restart recovery, which **drops** non-strict types | 📝 |
|
|
61
|
+
| s1-38 | §4 | Backstop is `Promise.race` in `processFocusedItem` with `MAILBOX_PROCESSING_TIMEOUT_MS` (or `APPROVAL_WAIT_TIMEOUT_MS` while awaiting approval) | attention.ts:993-994 picks between the two | ✅ |
|
|
62
|
+
| s1-39 | §4 | Cancel-on-timeout implemented: `processFocusedItem` calls `cancelProcessing`; a generation guard discards the late result | attention.ts:1029 → `delegate.cancelProcessing`; wired at agent.ts:1745. The "generation guard" is the A1a/A1b single-flight settle, not a counter | ✅ |
|
|
63
|
+
| s1-40 | §4 | `setProcessingTimeoutMs` exists as a test seam; `attention.test.ts` has "A1: cancels in-flight processing…" | seam exists (attention.ts:360); test is split into **A1a/A1b** | 📝 |
|
|
64
|
+
| s1-41 | §5 | `enqueueToMailbox()` is fire-and-forget — returns without awaiting LLM processing | returns `MailboxItem` synchronously (agent.ts:1381-1387) | ✅ |
|
|
65
|
+
| s1-42 | §5 | Awaitable methods store resolve/reject in item metadata; `processMailboxItemInternal` resolves with the reply | `responsePromise: { resolve, reject }` at agent.ts:1500,1598,1648,1680; resolved at 2270 | ✅ |
|
|
66
|
+
| s1-43 | §5 | `sendTaskExecution` enqueues `task_status_update` with `triggerExecution=true`, fire-and-forget with log callback | agent.ts:1609-1634 | ✅ |
|
|
67
|
+
| s1-44 | §5 | Heartbeat via `heartbeat:trigger`→enqueue; `generateDailyReport()`/`dreamConsolidateMemory()` internally call `sendMessage()` | event emitted at heartbeat.ts:179,190 and subscribed at agent.ts:1040 | ✅ |
|
|
68
|
+
| s1-45 | §5 | Routes GET /mind, /mailbox, /decisions exist; /mailbox takes limit/offset/type/category, returns {queued,queueDepth,history} | api-server.ts:5389 /mind, 5401 /mailbox, 5517 /decisions | ✅ |
|
|
69
|
+
| s1-46 | §5 | WebSocket events are exactly `agent:mailbox`, `agent:decision`, `agent:attention`, `agent:focus` | table accurate for mailbox events; `COALESCE_EVENT_TYPES` additionally lists `agent:update`/`agent:triage` (latter has no emitter) | ✅ |
|
|
70
|
+
| s1-47 | §6.2 | `mailbox_items` columns and three `idx_mailbox_agent_*` indexes match §6.2 | doc listed 12 columns; actual has 16 (missing retry_count/claimed_by/lease_until/dedup_key) and 4 indexes, not 3 | 📝 |
|
|
71
|
+
| s1-48 | §6.2 | `agent_activity_logs` columns match; `type` ∈ status/text/tool_start/tool_end/error/llm_request; FK CASCADE | columns and `ON DELETE CASCADE` match exactly | ✅ |
|
|
72
|
+
| s1-49 | §6.2 | `agent_activities.mailbox_item_id` nullable; total_tokens/total_tools default 0; success default 1 | all three hold in the DDL | ✅ |
|
|
73
|
+
| s1-50 | §6.3 | `agent_activities.type` is derived from `source_type`, not an independent enum | true it is not an enum, but the mapping lives in an `Agent` switch, NOT the registry — two hardcoded copies of one fact → **refactored**: one mapping in `SCENARIO_ACTIVITY_TYPE`, registry field deleted | ✅ |
|
|
74
|
+
| s1-51 | §6.3 | Registry `activityType` is null for exactly task_comment, requirement_comment, task_status_update | field deleted; the null/non-null split no longer exists (activity type is scenario-derived) | ✅ |
|
|
75
|
+
| s1-52 | §6.4 | Migration is additive: ADD COLUMN mailbox_item_id + CREATE INDEX IF NOT EXISTS | ADD COLUMN exists; the documented `idx_activities_mailbox_item` index does **not** exist in code | 📝 |
|
|
76
|
+
| s1-53 | §6.5 | Lifecycle statuses written are queued/processing/completed/deferred/merged | also writes `dropped` (14 sites — the most common terminal state), which the doc omitted | 📝 |
|
|
77
|
+
| s1-54 | §8 | "Every processed item becomes an `agent_activities` row" — contradicted by createsActivity=false types | false as written; also `createsActivity` is declared in the registry but read by no runtime path at all → **field deleted**; a per-type boolean could not express the conditional rule | 📝 |
|
|
78
|
+
| s1-55 | §9 | Frontend reads `MAILBOX_TYPE_REGISTRY` at render time, so new types need no frontend change | false — `AgentProfile.tsx` hardcodes its own icon map + type switch and never imports the registry → **refactored**: reads a registry projection enforced by a drift test | 📝 |
|
|
79
|
+
|
|
80
|
+
## §10–§16 — Completeness, A2A, notifications, agent→user, dedup
|
|
81
|
+
|
|
82
|
+
| # | § | Claim | Verdict | Status |
|
|
83
|
+
|---|---|---|---|---|
|
|
84
|
+
| s2-01 | §10 | Every LLM-invoking path is routed through the mailbox (no direct `llm.` calls elsewhere) | no provider/LLM call sites in agent.ts; all 7 sendMessage paths funnel into mailbox enqueue | ✅ |
|
|
85
|
+
| s2-02 | §10 | Heartbeat enters via `heartbeat:trigger` and enqueues a `heartbeat` item, not a direct LLM call | heartbeat.ts:179,190 → agent.ts:1051 `mailbox.enqueue('heartbeat')` | ✅ |
|
|
86
|
+
| s2-03 | §10 | Async completions reach the agent as `enqueueToMailbox('callback_result')` | agent.ts:7819 enqueues callback_result | ✅ |
|
|
87
|
+
| s2-04 | §11 | `A2ABus` is retired: only exported with `@deprecated`, no live routing | bus.ts exists; core imports only DelegationManager/TaskDelegation — no live A2ABus routing | ✅ |
|
|
88
|
+
| s2-05 | §11.1 | DM channel key is `dm:a2a:{sorted_a}:{sorted_b}`, one channel per pair | tools/a2a.ts:80 `sorted[0]:sorted[1]`; api-server:4475 sorts too | ✅ |
|
|
89
|
+
| s2-06 | §11.1 | Sending via DM does three things: persist, broadcast, enqueue `a2a_message` with `extra.channelKey` | `sendGroupMessage` (api-server:1112) is the single path for all three | ✅ |
|
|
90
|
+
| s2-07 | §11.1 | Pair messages share session id `channel_{channelKey}_{agentId}` | `channelMemorySessionId(agentId, channelKey)` used at agent.ts:2388,2972 | ✅ |
|
|
91
|
+
| s2-08 | §11.1 | Without `groupChatHandlers`, A2A falls back to direct `sendMessage(sourceType='a2a_message')` | agent-manager.ts:1719-1733 fallback exists exactly as described (core layer — cannot call org-manager's deliver()) | ✅ |
|
|
92
|
+
| s2-09 | §11.1.1/.4 | `enqueueToMailbox('a2a_message'` appears only in `agent-delivery.ts` | enforced by `a2a-delivery-contract.test.ts`, which caught a real bypass | ✅ |
|
|
93
|
+
| s2-10 | §11.1.1 | Persisting a `channel_messages` row is not delivery; delivery needs a pending mailbox item | holds; the HTTP a2a route was the one place that conflated them and was fixed | ✅ |
|
|
94
|
+
| s2-11 | §11.1.1 | `processGroupChatReply` may reply but MUST NOT hand a new message to a peer | no delivery callers; asserted by a2a-autonomy.test.ts | ✅ |
|
|
95
|
+
| s2-12 | §11.1.1 | `chainId` minted by the initiator, propagated on every hop (never reset) | false — all 5 delivery sites call `newChainId()`; nothing propagates it. Doc now records this as a known gap → **now true**: inbound chainId becomes the turn's chain (depth+1) | 📝 |
|
|
96
|
+
| s2-13 | §11.1.1 | Exceeding `DM_MAX_DEPTH` only stops chain growth; never discards an addressed message | constant no longer exists (deleted with the reply chain); doc references removed | 📝 |
|
|
97
|
+
| s2-14 | §11.1.1/§14.5 | `a2aCooldowns` (30s) and `wakeBudget` no longer exist | zero source hits; a2a-delivery-invariant.test.ts asserts both stay gone | ✅ |
|
|
98
|
+
| s2-15 | §11.1.1 | `agent_send_message` returns `{deliveryState, deliveryId, peerPendingItems, coalescedCount}` | actual: `{status, deliveryState, conversation_id, channel_key, recipient, recipient_woken, message}` — 3 of the 4 documented fields do not exist | 📝 |
|
|
99
|
+
| s2-16 | §11.1.1 | `AgentDelivery.deliver()` is the only enqueue caller for inter-agent traffic | enforced by contract test at this layer | ✅ |
|
|
100
|
+
| s2-17 | §11.1.2 | `postReply()` persists + broadcasts and triggers no agent | no enqueue/handleMessage inside (agent-delivery.ts:206-247) | ✅ |
|
|
101
|
+
| s2-18 | §11.1.2/.3 | A reply never triggers the peer; no automatic reply chain | verified by a2a-autonomy.test.ts guards | ✅ |
|
|
102
|
+
| s2-19 | §11.1.3 | `respondedAgents` and `shouldChainDmReply` are removed | `respondedAgents` gone; `shouldChainDmReply` survived only as an unreferenced dead file + its own test — **both deleted this pass** | ✅ |
|
|
103
|
+
| s2-20 | §11.1.3 | `chainId` is correlation only — never gates or drops delivery | holds: no conditional on chainId anywhere in the delivery path | ✅ |
|
|
104
|
+
| s2-21 | §11.1.4 | `[MENTIONED]` prefix built only in `deliver()` from `addressedTargetIds` (id list, not boolean) | single construction site in agent-delivery.ts | ✅ |
|
|
105
|
+
| s2-22 | §11.1.4 | `[FROM HUMAN]`/`[FROM AGENT]` produced only in `deliver()` from `origin` | same single site, adjacent line | ✅ |
|
|
106
|
+
| s2-23 | §11.2 | `agent_send_message` is always async: returns immediately with conversation_id + channel_key, content tagged `[conversation:…]` | tools/a2a.ts:119 tags; returns without awaiting the peer | ✅ |
|
|
107
|
+
| s2-24 | §11.2 | `agent_broadcast_status` writes to the daily log, no LLM, no DM channel | tools/a2a-structured.ts:89; no deliver()/ensureDmChannel call | ✅ |
|
|
108
|
+
| s2-25 | §11.2 | In group channels, @mentions decide exactly which peers receive an `a2a_message` item | `addressedTargetIds` drives both delivery set and the [MENTIONED] marker (api-server:1281,3998) | ✅ |
|
|
109
|
+
| s2-26 | §11.3 | `PendingCallbackRegistry` at `core/src/pending-callback.ts`; CallbackType/CallbackDelivery as documented | exact: `'background_exec'|'wakeup'|'a2a_reply'`, `'in_session'|'mailbox'` | ✅ |
|
|
110
|
+
| s2-27 | §11.3 | Default timeouts: 10 min background_exec, 30 min a2a_reply, effectively infinite wakeup | agent.ts:7862 (10min floor) and :7892 (30min) | ✅ |
|
|
111
|
+
| s2-28 | §11.3 | `deliverCallback()` routes in_session→callback_result (bound to originSessionId), mailbox→system_event | agent.ts:1017 calls it with `deliveryMode: 'in_session'`; both branches present | ✅ |
|
|
112
|
+
| s2-29 | §11.3 | Timed-out callbacks surface in the heartbeat prompt via `getTimedOut()` then `expireTimedOut(id)` | agent.ts:9778 / 9782 | ✅ |
|
|
113
|
+
| s2-30 | §11.3 | Registry is a process singleton restored from SQLite at startup via `SqlitePendingCallbackRepo` | singleton imported at agent.ts:99 | ✅ |
|
|
114
|
+
| s2-31 | §11.3 | Heartbeat default 6h; `set_heartbeat_interval` clamped 5min–24h; both go through `Agent.setHeartbeatInterval()` | limits.ts:608/616/617 + agent.ts:1365 | ✅ |
|
|
115
|
+
| s2-32 | §11.4 | Periodic heartbeat at priority 3; background callback_result at priority 1 | registry heartbeat=3; task/callback enqueues use priority 1 (agent.ts:1645) | ✅ |
|
|
116
|
+
| s2-33 | §11.5 | `wait_for_reply=true` is deprecated and ignored — nothing blocks awaiting an agent reply | tools/a2a.ts:90 logs deprecation and sends async | ✅ |
|
|
117
|
+
| s2-34 | §13.1 | `notify_user` does three things: appendMessage (with metadata), broadcastProactiveMessage, hitl.notify | start.ts:1726 handler → appendMessage + broadcastProactiveMessage + notifyUser metadata | ✅ |
|
|
118
|
+
| s2-35 | §13.2 | `request_user_input` blocks with no timeout; `request_user_approval` is a deprecated alias; waiting uses APPROVAL_WAIT_TIMEOUT_MS (24h) | limits.ts:750 = 24h, selected at attention.ts:993 | ✅ |
|
|
119
|
+
|
|
120
|
+
## §17–§27 — Recovery, dedup, events, injection, triage, protection layers
|
|
121
|
+
|
|
122
|
+
| # | § | Claim | Verdict | Status |
|
|
123
|
+
|---|---|---|---|---|
|
|
124
|
+
| s3-01 | §17 | `recoverStaleItems()` runs right after persistence wiring; `resumeInProgressTasks()` runs later | start.ts:2276 wire → 2364 recover → 2940/2965 resume | ✅ |
|
|
125
|
+
| s3-02 | §17 | `recoverStaleItems()` delegates to `markStaleProcessingAsDropped(agentId)` | sqlite-storage.ts:5005 | ✅ |
|
|
126
|
+
| s3-03 | §17 | Stale cleanup is a blanket `status='processing'` → dropped UPDATE | false — predicate also requires no claim / no lease / expired lease (+ foreign owner when supplied) | 📝 |
|
|
127
|
+
| s3-04 | §17 | Staleness is judged by claim/lease state, not status alone | `staleWhere` at sqlite-storage.ts:5010-5016 | ✅ |
|
|
128
|
+
| s3-05 | §17 | Strict-state stale rows are requeued; only non-strict rows are dropped | `if (!isStrictStateItem(item)) continue;` then `requeueItem` (5028) | ✅ |
|
|
129
|
+
| s3-06 | §17 | If the stale SELECT/parse throws, behaviour degrades to dropping all stale rows | catch → "falling back to drop-only" (5033) | ✅ |
|
|
130
|
+
| s3-07 | §17 | Recovered stale items are marked dropped, never completed | `SET status='dropped'` only (5040) | ✅ |
|
|
131
|
+
| s3-08 | §17 | Heartbeat dedup keeps only the newest queued heartbeat; older ones spliced and marked dropped | mailbox.ts:396-405 | ✅ |
|
|
132
|
+
| s3-09 | §17 | Comment dedup merges by taskId / requirementId; survivor inherits the highest priority | TASK_COMMENT_DEDUP_TYPES (414) + priority compare | ✅ |
|
|
133
|
+
| s3-10 | §17 | Merge guard is `isStrictStateItem` over 4 types — broader than "only triggerExecution is never merged" | doc understated it: guard also covers review_request and actionRequired updates | 📝 |
|
|
134
|
+
| s3-11 | §17 | Undocumented 4th dedup rule: `a2a_message` merged by `extra.channelKey` | `CHANNEL_DEDUP_TYPES` (mailbox.ts:426); rule was absent from §17 | 📝 |
|
|
135
|
+
| s3-12 | §17 | Merged duplicates get status `merged` + `mergedInto`; count is `metadata.mergeCount` | merged_into at 474/579; no `(+1)` text rewrite exists | 📝 |
|
|
136
|
+
| s3-13 | §18 | Retry cleanup drops only queued AND task_status_update AND !strict AND taskId-matching | all four conditions present (mailbox.ts:1215-1218) | ✅ |
|
|
137
|
+
| s3-14 | §18 | taskId match accepts payload.taskId OR metadata.taskId; reverse iteration; marks dropped; returns count | reverse loop 1213, payload||metadata 1218, returns length 1226 | ✅ |
|
|
138
|
+
| s3-15 | §18 | `dropStatusUpdatesByTaskId` called from `retryTaskFresh()` and `resetTaskForRerun()` before re-enqueue | holds — both callers wired: retryTaskFresh:5811 and resetTaskForRerun:6305 call `agent.dropStaleStatusUpdates`. My first reading missed the wrapper and wrongly reported this as unwired | ✅ |
|
|
139
|
+
| s3-16 | §19 | Each Agent owns a private EventBus; `forwardAgentEvents()` re-emits on the manager bus | agent-manager.ts:2332, 3250 | ✅ |
|
|
140
|
+
| s3-17 | §19 | Two distinct events forwarded: `agent:activity-log` (DB) and `agent:activity_log` (frontend) | both emitted: agent.ts:4111 and :4983 | ✅ |
|
|
141
|
+
| s3-18 | §20 | `injectActivityToMainSession` runs in the `finally` of `processMailboxItemInternal()`; human_chat excluded | finally block guards `item.sourceType !== 'human_chat'` (agent.ts:2794-2800) | ✅ |
|
|
142
|
+
| s3-19 | §20 | Completion is the typed `end_turn` tool; `<<HANDLE_COMPLETE>>` string/detector/regex are deleted | no occurrence in src; tests assert absence | ✅ |
|
|
143
|
+
| s3-20 | §20 | `detectAbnormalCompletion()` flags only empty/undefined replies; [preempted]/[cancelled]/[end_turn] are normal | attention.ts:62-67 returns undefined for all three; only empty/undefined flagged | ✅ |
|
|
144
|
+
| s3-21 | §20 | Background types retried up to MAILBOX_ITEM_MAX_RETRIES (=2) then marked dropped (visible) | MAILBOX_ITEM_MAX_RETRIES = 2 (limits.ts:126) | ✅ |
|
|
145
|
+
| s3-22 | §20 | User-interaction types are dropped with no retry (avoid duplicating side effects) | attention.ts:1153 emitIncomplete + drop, no requeue | ✅ |
|
|
146
|
+
| s3-23 | §20 | `emitIncomplete` fires only from complete-without-retry and max-retries-exhausted terminals | three sites, not two: timeout-orphan 1094, user-interaction 1153, retries-exhausted 1176 | 📝 |
|
|
147
|
+
| s3-24 | §21 | Triage has three tiers: no-LLM, one short LLM call, full agent session | needsLLMTriage (1829) gates performDeliberation (712/731); tier-0 is the invokesLLM check | ✅ |
|
|
148
|
+
| s3-25 | §21 | Pre-triage consolidation is cross-type on taskId/requirementId; head item is put back then re-dequeued | consolidateByEntity at mailbox.ts:494, called from attention.ts:689 | ✅ |
|
|
149
|
+
| s3-26 | §21 | Tier 1 accepts exactly continue/preempt/cancel/merge/defer; anything else coerces to continue | `validDecisions` at attention.ts:1749 | ✅ |
|
|
150
|
+
| s3-27 | §21 | Tier 2 deliberation runs via `handleMessage({scenario:'deliberation'})` | agent.ts:4236 | ✅ |
|
|
151
|
+
| s3-28 | §21 | `DELIBERATION_ALLOWED_TOOLS` matches the §21 table (excludes task_create/update, shell, spawn_subagent) | list lives at limits.ts:581, consumed at agent.ts:4229 | ✅ |
|
|
152
|
+
| s3-29 | §21 | Strict-state items excluded from the deliberation view; `needsLLMTriage` false when any strict item exists | filter at attention.ts:722, early-false at 1837 | ✅ |
|
|
153
|
+
| s3-30 | §21 | A yield-point `defer` on a strict item is refused and falls back to the heuristic | `isStrictStateItem(newItem)` check at attention.ts:1536 | ✅ |
|
|
154
|
+
| s3-31 | §21 | defer/drop tools error on strict items; `complete_deliberation` rejects strict ids | defer/drop tools error on strict items (mailbox-tools.ts:151-154, 186-189) | ✅ |
|
|
155
|
+
| s3-32 | §21 | `agent:incomplete` with reason `resurfaced-task-execution-lost-closures` triggers `recoverLostTaskExecution` | task-service.ts:1564 implements it; reason used in tests | ✅ |
|
|
156
|
+
| s3-33 | §21 | `TRIAGE_MAX_TOOL_ITERATIONS=6`; `TRIAGE_BACKLOG_THRESHOLD=2` | limits.ts:511 and :563 | ✅ |
|
|
157
|
+
| s3-34 | §21 | Batch processing launches one LLM session for all processItemIds; on preempt/cancel/timeout all batch items requeue | batchItems plumbed at attention.ts:81, 960, 990, 1200 | ✅ |
|
|
158
|
+
| s3-35 | §21 | human_chat cannot be deferred, dropped or reprioritized by tool calls | guarded: defer/drop reject `is a protected human_chat item` (mailbox-tools.ts:160, 195) | ✅ |
|
|
159
|
+
| s3-36 | §21 | `workingMemory` Map fed by deliberation/triage/notebook tools, injected as `## Working Memory` | **renamed**: the map is `workingMemory` but the prompt block is `## Notebook` (agent.ts:4304) | 📝 |
|
|
160
|
+
| s3-37 | §22 | `resurfaceDue()` called at the top of each idle iteration before `dequeueAsync` | attention.ts:608 runs resurfaceDue, 614 awaits dequeueAsync | ✅ |
|
|
161
|
+
| s3-38 | §23 | `task_status_update` is informational by default; only triggerExecution runs a full execution | `if (!registry?.invokesLLM) return undefined` (attention.ts:60) | ✅ |
|
|
162
|
+
| s3-39 | §27 | Protection layers: per-call try/catch, 45-min backstop, retries capped at 2, 30s watchdog sweep | 45min at limits.ts:465, watchdog 30s at :495 — but "retries capped at 2" is wrong (see s3-41) | 📝 |
|
|
163
|
+
| s3-40 | §27 | The 45-min backstop is an **inactivity** window reset by `noteProgress()`, not a total-duration cap | `progressAt` + `Date.now() - last >= backstopMs` under Promise.race (attention.ts:1000-1015) | ✅ |
|
|
164
|
+
| s3-41 | §27 | "Provider retries capped at 2" matches code | false — `DEFAULT_MAX_RETRIES = 3` (markus-provider.ts:192), configurable 0-10 | 📝 |
|
|
165
|
+
| s3-42 | §27 | GAP-A: `performDeliberation` awaits `handleMessage` with no timeout | confirmed: bare `await this.handleMessage(... scenario:'deliberation')` at agent.ts:4230, no race/signal | ✅ |
|
|
166
|
+
| s3-43 | §27 | GAP-B: task execution has no per-task timeout, bounded only by the global backstop | false — `task.timeoutMs` exists and is enforced (task-service.ts:4632-4639) | 📝 |
|
|
167
|
+
| s3-44 | §27 | GAP-C: dream/concurrency semaphore lacks release-on-error on all exit paths | **mechanism not found**: no dream/concurrency semaphore in packages/core/src — the named GAP describes something that does not exist | 📝 |
|
|
168
|
+
| s3-45 | §27 | Fail-loud chain: error → requeue (retry count) → exhausted → emitIncomplete, no silent swallow | requeue under max, emitIncomplete at exhaustion (attention.ts:1137-1176) | ✅ |
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Progress log
|
|
173
|
+
|
|
174
|
+
| Date | Rows ticked | Notes |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| 2026-10-25 | 135 / 135 | **ALL 135 ROWS VERIFIED** (100 hold, 27 doc errors fixed, 1 dead module deleted). §1-§2 were filled last — an earlier "135/135" note was written before those 7 rows existed and has been corrected. |
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Refactor log (the 4 code divergences, resolved)
|
|
181
|
+
|
|
182
|
+
After the audit, the four code-level divergences were fixed rather than documented:
|
|
183
|
+
|
|
184
|
+
| # | Was | Now | Proof |
|
|
185
|
+
|---|---|---|---|
|
|
186
|
+
| 4 | `createsActivity` declared per type, read by nothing, and unable to express the real rule | field deleted | `tsc` across shared/core/web-ui; 5747 tests |
|
|
187
|
+
| 3 | `activityType` in the registry vs a `switch` in `Agent`, disagreeing on `review_request` | one `SCENARIO_ACTIVITY_TYPE`, `Record<AgentScenario, …>` so a new scenario fails the build | registry field deleted; typecheck |
|
|
188
|
+
| 1 | every delivery minted `newChainId()`, so a "chain" never exceeded one hop | inbound `extra.chainId` → per-worker `SessionWorkspace.chainId` → outbound inherits, `depth + 1`; cleared in `finally` | `agent-manager-coverage.test.ts` "outbound A2A inherits the sender's current chain" |
|
|
189
|
+
| 2 | frontend hand-maintained icon/category maps that had already lost `workflow_update` and `callback_result` | UI reads a registry projection (`web-ui/src/lib/mailboxTypeMeta.ts`) | `shared/test/mailbox-type-mirror.test.ts` fails CI on drift |
|
|
190
|
+
|
|
191
|
+
**Why codegen-by-test instead of codegen:** the web bundle cannot import `@markus/shared` at runtime, so the projection must exist. What matters is that it cannot drift *silently*: the registry stays the only writer and any divergence turns CI red. Hand-editing the projection can only produce a failing build, never a quiet behaviour change.
|
|
192
|
+
|
|
193
|
+
**Remaining, not fixed (out of scope, reported):** `packages/cli/docs/architecture/*` is an untracked, frozen copy of these docs (last written 2026-10-08, 270 lines behind). Nothing reads it and git does not track it; deleting it would remove a misleading fork, but that is a filesystem decision for the owner.
|
|
194
|
+
|