@markus-global/cli 0.12.3 → 0.12.5-rc.1
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 +25 -0
- package/dist/background-maintenance.d.ts.map +1 -1
- package/dist/background-maintenance.js +61 -0
- package/dist/background-maintenance.js.map +1 -1
- package/dist/commands/im-inbound-origin.d.ts +38 -0
- package/dist/commands/im-inbound-origin.d.ts.map +1 -0
- package/dist/commands/im-inbound-origin.js +48 -0
- package/dist/commands/im-inbound-origin.js.map +1 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +211 -46
- package/dist/commands/start.js.map +1 -1
- package/dist/markus.mjs +18523 -9866
- package/dist/web-ui/assets/{AsyncState-_UC7xcxJ.js → AsyncState-fJJNUOXK.js} +1 -1
- package/dist/web-ui/assets/ChatComponents-S7d2CAAU.js +14 -0
- package/dist/web-ui/assets/{ContentRenderer-C-V5k_3K.js → ContentRenderer-DWqhC0uq.js} +6 -6
- package/dist/web-ui/assets/DeliverableShareModal-B7DwzEnt.js +1 -0
- package/dist/web-ui/assets/{Deliverables-CQnWqbTb.js → Deliverables-CueBYYpx.js} +2 -2
- package/dist/web-ui/assets/MarkdownMessage-D8BsJzvD.js +4 -0
- package/dist/web-ui/assets/{Search-CVYQIy_D.js → Search-CaYXz3u-.js} +1 -1
- package/dist/web-ui/assets/{SendToChat-IOAvuta-.js → SendToChat-_9sm7UBY.js} +1 -1
- package/dist/web-ui/assets/Settings-DTL14pY8.js +8 -0
- package/dist/web-ui/assets/{Store-BEsLd_RN.js → Store-DpGqUMS2.js} +1 -1
- package/dist/web-ui/assets/Switch-NYQTn8wl.js +1 -0
- package/dist/web-ui/assets/Team-DB-JytPl.js +93 -0
- package/dist/web-ui/assets/Work-sQq-gy3S.js +142 -0
- package/dist/web-ui/assets/{arc-DP1Vf7Sx.js → arc-JtkmqkSR.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-Buq8JYN8.js → architectureDiagram-3BPJPVTR-B8zM5fky.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-BCa2p2_X.js → blockDiagram-GPEHLZMM-BQgjaOcE.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-BxsgggQY.js → c4Diagram-AAUBKEIU-BnZvYRwj.js} +1 -1
- package/dist/web-ui/assets/channel-Zno2q8Ba.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-BJZZ60c9.js → chunk-2J33WTMH-KONx1qvt.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-C5hc4E6J.js → chunk-4BX2VUAB-BqkxAkWs.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-CbyvZ6Mk.js → chunk-55IACEB6-DxLiTj85.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-JmNt9TVA.js → chunk-727SXJPM-Dhj-9NIs.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-BTk0v5ba.js → chunk-AQP2D5EJ-M1vQ4YYc.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-BO-dhB1U.js → chunk-FMBD7UC4-DaXv58SH.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-BdjCcLdb.js → chunk-ND2GUHAM-Brkz9FCu.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-BAzRC82n.js → chunk-QZHKN3VN-DIsEGiBf.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-hI59DDUw.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-hI59DDUw.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-CVffmErT.js → cose-bilkent-S5V4N54A-CSjC_YL5.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-Dd9pB2fX.js → dagre-BM42HDAG-BevSxaQN.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-BG_AUqzM.js → diagram-2AECGRRQ-CT3Hj8jy.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-D5qFMRFf.js → diagram-5GNKFQAL-CAebHy6q.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-B3qTxSWl.js → diagram-KO2AKTUF-BvRWS7BX.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-BrxC1636.js → diagram-LMA3HP47-gR9HBKc4.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-BvXyEQ9-.js → diagram-OG6HWLK6-B5HGsfNo.js} +1 -1
- package/dist/web-ui/assets/{docx-preview-DBAZFeEb.js → docx-preview-pRjmDg6F.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-CMap9oy_.js → erDiagram-TEJ5UH35-mrPW01aQ.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-BZerJtvk.js → flowDiagram-I6XJVG4X-BrZ1G-Tt.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-CagPMHMO.js → ganttDiagram-6RSMTGT7-Dq_5mate.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-DZ5dDKRu.js → gitGraphDiagram-PVQCEYII-Cb3yTWUy.js} +1 -1
- package/dist/web-ui/assets/index-9SXWNIl0.css +1 -0
- package/dist/web-ui/assets/index-Bco6UnT7.js +867 -0
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-CHLdsDUZ.js → infoDiagram-5YYISTIA-CcnNlnvs.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-SdeinQaS.js → ishikawaDiagram-YF4QCWOH-BqHTPtO1.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-BtlL2fi0.js → journeyDiagram-JHISSGLW-DKBB9B-C.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-BKPQYXkB.js → kanban-definition-UN3LZRKU-BVO5tbNl.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-MkJR6w4B.js → mermaid.core-bMoKRCj4.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-CbOmHX_u.js → mindmap-definition-RKZ34NQL-Bk0lFKmi.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-CypGjJP1.js → pieDiagram-4H26LBE5-BRPnBLeL.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-CGtemfUz.js → quadrantDiagram-W4KKPZXB-CAqdqT5W.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-N7YfpCvE.js → requirementDiagram-4Y6WPE33-Vv5YNzCu.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-CYnSrei-.js → sankeyDiagram-5OEKKPKP-Ciq1EgmQ.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-CsB7dCPF.js → sequenceDiagram-3UESZ5HK-DVRqp161.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-DTDFUXFP.js → stateDiagram-AJRCARHV-zbjDSKA3.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-C54VSYn7.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-C_bWAN9B.js → timeline-definition-PNZ67QCA-D0hr0d1U.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-CX_qAuUT.js → vennDiagram-CIIHVFJN-CtuZLcPo.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-q53jQ293.js → wardley-L42UT6IY-nP2-eCDJ.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-D34dKCJU.js → wardleyDiagram-YWT4CUSO-Dxc7OveP.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-BFAngp66.js → xychartDiagram-2RQKCTM6-Bm2LvPhZ.js} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/docs/README.md +50 -16
- package/docs/api/guides/websocket.md +43 -0
- package/docs/api/reference.md +657 -0
- package/docs/architecture/a2a-communication.md +303 -0
- package/docs/architecture/agent-runtime.md +145 -28
- package/docs/architecture/architecture.md +30 -11
- package/docs/architecture/cognitive-architecture.md +189 -15
- package/docs/architecture/concurrent-processing.md +190 -31
- package/docs/architecture/context-assembly.md +264 -0
- package/docs/architecture/derived-views.md +463 -0
- package/docs/architecture/desktop-auto-update.md +185 -0
- package/docs/architecture/facts.md +406 -0
- package/docs/architecture/learning-loop.md +11 -0
- package/docs/architecture/limits.md +79 -0
- package/docs/architecture/mailbox-system.md +786 -668
- package/docs/architecture/memory-system.md +1 -1
- package/docs/architecture/messaging-gateway.md +7 -0
- package/docs/architecture/notification-delivery.md +221 -0
- package/docs/architecture/notification-sounds.md +177 -0
- package/docs/architecture/prompt-engineering.md +171 -700
- package/docs/{design/remote-access-contract.md → architecture/remote-access.md} +4 -0
- package/docs/architecture/state-machines.md +288 -5
- package/docs/architecture/tool-loop-harness.md +362 -0
- package/docs/architecture/tool-system.md +40 -16
- package/docs/design/background-callback-in-turn-delivery-2026-11-22.md +95 -0
- package/docs/design/c10-0b-pick-identity-leak-2026-11-22.md +233 -0
- package/docs/design/c10-a-identity-columns-2026-11-22.md +182 -0
- package/docs/design/c10-c-trust-boundary-2026-11-23.md +222 -0
- package/docs/design/c10-external-adapters-plan-2026-11-19.md +448 -0
- package/docs/design/c8-residual-mechanisms-2026-11-15.md +984 -0
- package/docs/design/external-signal-decision-loop-2026-11-25.md +579 -0
- package/docs/guides/development.md +1 -1
- package/docs/{architecture → guides}/mailbox-audit-checklist.md +7 -0
- package/docs/guides/remote-access.md +1 -1
- package/docs/{design/agent-stop-intent-audit.md → records/agent-stop-intent-audit-2026-11-08.md} +4 -0
- package/docs/records/c10-l5-gate-verification-2026-11-26.md +72 -0
- package/docs/records/c10-l5-live-verification-2026-11-25.md +117 -0
- package/docs/records/cut6-c4-verification-2026-11-12.md +268 -0
- package/docs/records/cut6-mailbox-address-envelope-design-2026-11-12.md +871 -0
- package/docs/records/cut7-c7a-red-green-evidence-2026-11-13.md +105 -0
- package/docs/records/cut7-c7a-workunit-implementation-2026-11-13.md +116 -0
- package/docs/records/cut7-c7b-verification-2026-11-14.md +90 -0
- package/docs/records/cut7-live-verification-2026-11-14.md +33 -0
- package/docs/records/cut7-wiring-negative-cache-2026-11-14.md +64 -0
- package/docs/records/cut7-workunit-execution-plan-2026-11-13.md +206 -0
- package/docs/records/cut8-a-entity-keys-design-2026-11-14.md +377 -0
- package/docs/records/cut8-b-turn-delta-injection-2026-11-14.md +362 -0
- package/docs/records/cut8-c-single-clock-2026-11-14.md +119 -0
- package/docs/records/cut8-c-single-clock-design-2026-11-14.md +150 -0
- package/docs/records/cut8-d-2026-11-14.md +231 -0
- package/docs/records/cut8-live-verification-2026-11-14.md +1018 -0
- package/docs/records/cut9-adjacent-identity-paths-2026-11-15.md +200 -0
- package/docs/records/cut9-identity-declaration-2026-11-15.md +163 -0
- package/docs/records/cut9-inbox-dual-run-diff-2026-11-15.md +117 -0
- package/docs/records/cut9-live-verification-2026-11-15.md +222 -0
- package/docs/records/cut9-runtime-probe-2026-11-19.md +520 -0
- package/docs/{design/deliverable-sharing.md → records/deliverable-sharing-2026-08-12.md} +10 -3
- package/docs/records/identity-backlog-disposition-2026-11-22.md +143 -0
- package/docs/records/marketplace-orphan-freeze-2026-11-22.md +239 -0
- package/docs/{architecture/notify-user-context-truth.md → records/notify-user-context-truth-2026-10-28.md} +6 -0
- package/docs/{handoff → records}/remote-access-handoff.md +1 -1
- package/package.json +1 -1
- package/templates/roles/HANDBOOK.md +1 -1
- package/templates/skills/agent-building/SKILL.md +1 -1
- package/dist/web-ui/assets/ChatComponents-Ca9tWI9W.js +0 -12
- package/dist/web-ui/assets/DeliverableShareModal-BvpyowYJ.js +0 -1
- package/dist/web-ui/assets/MarkdownMessage-DedA8Zob.js +0 -4
- package/dist/web-ui/assets/Settings-BQDqf4q5.js +0 -8
- package/dist/web-ui/assets/Switch-C6InTNUi.js +0 -1
- package/dist/web-ui/assets/Team-nfNyWj-s.js +0 -85
- package/dist/web-ui/assets/Work-BQvgkynj.js +0 -142
- package/dist/web-ui/assets/channel-BTSrOo6c.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-BSYlcnF9.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-BSYlcnF9.js +0 -1
- package/dist/web-ui/assets/index-CKPQYzzR.js +0 -867
- package/dist/web-ui/assets/index-CzHSs0Vd.css +0 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-AVnDjlzF.js +0 -1
- package/docs/api/api.md +0 -353
- package/docs/architecture/llm-provider-timeouts.md +0 -60
- package/docs/architecture/state-ownership.md +0 -83
- /package/docs/architecture/{frontend/team-chat.md → team-chat.md} +0 -0
- /package/docs/{analysis → records}/2026-10-29-a2a-cache-hit-rate.md +0 -0
- /package/docs/{fixes → records}/2026-11-12-session-expiry-and-mention-thinking.md +0 -0
- /package/docs/{handoff → records}/approval-tri-state-handoff.md +0 -0
- /package/docs/{design → records}/overview-attention-redesign.md +0 -0
- /package/docs/{remote-access/fast-path-plan.md → records/remote-access-fast-path-plan-2026-10-17.md} +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# C9 adjacent paths — shutdown re-queue identity + gateway receipt fixture
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-15
|
|
4
|
+
Card: `tsk_804c3f67235acca464742519` (follow-up to `tsk_4459e401385dfadc6d9e4c59`)
|
|
5
|
+
Scope: `packages/core/src/mailbox.ts`, `packages/core/src/attention.ts`,
|
|
6
|
+
`packages/org-manager/src/api-server.ts`, new `packages/org-manager/src/gateway-task-receipt.ts`
|
|
7
|
+
(+ 2 new test files, + 1 allowlist entry)
|
|
8
|
+
Status: implemented
|
|
9
|
+
|
|
10
|
+
## 1. Starting facts (measured on the card's base commit `76501788`)
|
|
11
|
+
|
|
12
|
+
| Fact | Reading |
|
|
13
|
+
|---|---|
|
|
14
|
+
| Callers that declare `refOrigin` before this change | 2 (`agent.ts` `pending-link`, `api-server.ts` `platform-internal`) — the previous card's work |
|
|
15
|
+
| Shutdown re-queue of an interrupted item | `attention.ts` inlined `enqueue(sourceType, payload, { priority, metadata, reuseItemId })` — no `workUnitRef`, no `refOrigin` |
|
|
16
|
+
| Same shape in `mailbox.reEnqueueOnShutdown()` | identical omission; **no caller** anywhere (dead public method, live duplicate of the inline block) |
|
|
17
|
+
| `SqliteMailboxRepo.requeueItem()` columns written | `status / queued_at / started_at / completed_at / claimed_by / lease_until / drop_reason / bounce_target` — **`work_unit_ref` is not in the UPDATE** |
|
|
18
|
+
| Gateway receipt enqueue | inlined in the `api-server.ts` sync-bridge closure; verdict `platform-internal` upheld by reading only |
|
|
19
|
+
|
|
20
|
+
## 2. Root cause (R1 — one fact, three writers)
|
|
21
|
+
|
|
22
|
+
Identity (`mailbox_items.work_unit_ref`) is decided in three places:
|
|
23
|
+
|
|
24
|
+
1. `enqueue()` writes whatever `options.workUnitRef` says;
|
|
25
|
+
2. the producer chain links the real ref afterwards (`linkMailboxItem`, the single writer);
|
|
26
|
+
3. the C8-P0 guard re-decides "was this forgotten?" by looking at a NULL ref + a declaration.
|
|
27
|
+
|
|
28
|
+
The re-queue path is the case where **none** of the three should decide anything: the row
|
|
29
|
+
already exists and its ref is already there. It reached the guard anyway (it builds a fresh
|
|
30
|
+
`MailboxItem` from `options`, where the ref defaults to `null`), so strict mode would throw
|
|
31
|
+
and the item would stay `processing` until the lease expired — a graceful restart silently
|
|
32
|
+
degrading into a crash recovery.
|
|
33
|
+
|
|
34
|
+
## 3. Semantics ruling: re-queue **inherits** the row's identity
|
|
35
|
+
|
|
36
|
+
The card asked to answer this before touching code:
|
|
37
|
+
|
|
38
|
+
> does reuse inherit the original row's `work_unit_ref`, or does it re-declare a new fact?
|
|
39
|
+
|
|
40
|
+
**Inherit.** Evidence is mechanical, not stylistic: `requeueItem()`'s `UPDATE` lists every
|
|
41
|
+
mutable column and does *not* include `work_unit_ref`, so a re-queued row keeps the identity
|
|
42
|
+
it had. Any code that computed a ref at the re-queue call site would be a second writer of the
|
|
43
|
+
same fact — exactly the defect family C9 closed.
|
|
44
|
+
|
|
45
|
+
Two consequences for the call site:
|
|
46
|
+
|
|
47
|
+
- when the caller still holds a ref (`item.workUnitRef`, populated by producers that know the
|
|
48
|
+
entity at enqueue time), hand it back — otherwise the in-memory requeued item would drop an
|
|
49
|
+
identity that was never in doubt (declare `entity`);
|
|
50
|
+
- when it holds none, declare `pending-link`: this call decides no identity, the row is the
|
|
51
|
+
authority. That is the honest statement for both dominant families here — task
|
|
52
|
+
(`sendTaskExecution`, linked by `onItemEnqueued`) and A2A (`AgentDelivery.deliver`, linked
|
|
53
|
+
by `linkMailboxItem` after enqueue).
|
|
54
|
+
|
|
55
|
+
Not `platform-internal`: that would claim "there is no entity", which is false for a task or
|
|
56
|
+
A2A row that simply gets its ref late.
|
|
57
|
+
|
|
58
|
+
## 4. Probe: the path really did reach the guard (red → green)
|
|
59
|
+
|
|
60
|
+
Real assembly chain in a real Node process: `AgentMailbox` + real `SqliteMailboxRepo`
|
|
61
|
+
(+ `SqliteWorkUnitRepo` for the single identity writer), throwaway SQLite DB under `/tmp`,
|
|
62
|
+
`MARKUS_STRICT_IDENTITY=1` (stricter than "0 ERROR lines": an undeclared empty identity throws).
|
|
63
|
+
|
|
64
|
+
Scenario: producer enqueue (`task_status_update`, `intent=trigger_execution`, `pending-link`,
|
|
65
|
+
round 2) → `linkMailboxItem(row, task_<id>_r2)` → `dequeue()` (row goes `processing`) → the
|
|
66
|
+
shutdown re-queue call.
|
|
67
|
+
|
|
68
|
+
Before the change:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
row before reuse: status=processing, work_unit_ref=task_tsk_probe_reuse_r1
|
|
72
|
+
attention-shape enqueue -> THREW mailbox.enqueue(task_status_update) has no workUnitRef and no refOrigin
|
|
73
|
+
mailbox.reEnqueueOnShutdown -> THREW (same message)
|
|
74
|
+
unclaimedIdentityCount: 2
|
|
75
|
+
row after reuse attempt: status=processing (identity intact, but the item never came back)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
After the change (same probe):
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
attention-shape enqueue -> THREW (the inline duplicate is gone from attention.ts; kept here as a control)
|
|
82
|
+
mailbox.reEnqueueOnShutdown -> NO
|
|
83
|
+
row after reuse: status=queued, claimed_by=NULL, work_unit_ref=task_tsk_probe_reuse_r1 ← inherited
|
|
84
|
+
unclaimedIdentityCount: 1 (only the deliberate control call)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
So: the guard *was* the thing firing, and inheritance is the real DB behaviour rather than an
|
|
88
|
+
assumption in prose.
|
|
89
|
+
|
|
90
|
+
## 5. Changes
|
|
91
|
+
|
|
92
|
+
### 5.1 `mailbox.reEnqueueOnShutdown()` — the single re-queue implementation
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
this.enqueue(item.sourceType, item.payload, {
|
|
96
|
+
priority: item.priority,
|
|
97
|
+
metadata: item.metadata,
|
|
98
|
+
round: item.round, // structural, not payload
|
|
99
|
+
reuseItemId: item.id,
|
|
100
|
+
workUnitRef: item.workUnitRef ?? null, // hand back what we hold
|
|
101
|
+
refOrigin: item.workUnitRef ? 'entity' : 'pending-link',
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`round` is carried because it is the dedup-key / unicast-route input; dropping it on a re-queue
|
|
106
|
+
silently demotes a round-scoped delivery to "round unknown" (the existing re-delivery tests
|
|
107
|
+
already pass `round: item.round` for the same reason).
|
|
108
|
+
|
|
109
|
+
### 5.2 `attention.ts` — the inline duplicate is deleted
|
|
110
|
+
|
|
111
|
+
The shutdown branch now calls `this.mailbox.reEnqueueOnShutdown(item)` instead of re-building
|
|
112
|
+
the same options object. Before this change that method had **zero** callers while the
|
|
113
|
+
controller carried a copy of its body: one behaviour, two sites, and only one of them was ever
|
|
114
|
+
going to receive the declaration. Deleting the copy is the fix; adding a second declaration
|
|
115
|
+
would have been the same defect in a new place.
|
|
116
|
+
|
|
117
|
+
### 5.3 `org-manager/src/gateway-task-receipt.ts` — receipt enqueue as production code
|
|
118
|
+
|
|
119
|
+
The gateway `createTask` receipt enqueue (formerly inlined in the `api-server.ts` sync bridge)
|
|
120
|
+
moved into an exported function; `api-server.ts` now calls it inside the same `try/catch`
|
|
121
|
+
(a receipt failure must not fail task creation). The declaration is unchanged and still
|
|
122
|
+
`platform-internal`, now with the reason next to it:
|
|
123
|
+
|
|
124
|
+
- no WorkUnit exists at creation time; the first one (`task_<id>_r1`) is created at execution
|
|
125
|
+
start and attached to the **execution item**, not this row;
|
|
126
|
+
- nothing links this row (`linkMailboxItem`'s callers are the execution / delivery chains);
|
|
127
|
+
- the task's entity linkage is structural: `envelope.messageId = gateway-task:<id>` +
|
|
128
|
+
`metadata.taskId`.
|
|
129
|
+
|
|
130
|
+
`platform-internal` is the honest verb; `pending-link` would promise a link nobody makes.
|
|
131
|
+
|
|
132
|
+
## 6. Tests and mutation self-proof
|
|
133
|
+
|
|
134
|
+
### 6.1 `packages/core/test/mailbox-identity-reuse.test.ts` (4 cases)
|
|
135
|
+
|
|
136
|
+
Real `AgentMailbox` + real `SqliteMailboxRepo`/`SqliteWorkUnitRepo`, throwaway DB,
|
|
137
|
+
`MARKUS_STRICT_IDENTITY=1`:
|
|
138
|
+
|
|
139
|
+
1. re-queue of an interrupted, already-linked task row: no throw, `status=queued`,
|
|
140
|
+
`work_unit_ref` still `task_<id>_r2` (read back from the DB, not from memory), `round`
|
|
141
|
+
preserved, unclaimed count 0;
|
|
142
|
+
2. re-queue of an item that carried a ref at enqueue (review_request): the in-memory item keeps
|
|
143
|
+
the ref (the `entity` branch), the row unchanged;
|
|
144
|
+
3. an **undeclared** caller of the same fact type still throws (the fail-open guard);
|
|
145
|
+
4. contract fence: `attention.ts` must not contain `reuseItemId:` again and must call
|
|
146
|
+
`this.mailbox.reEnqueueOnShutdown(`.
|
|
147
|
+
|
|
148
|
+
### 6.2 `packages/org-manager/test/gateway-task-receipt.test.ts` (2 cases)
|
|
149
|
+
|
|
150
|
+
Calls the **production** helper (not a copy of its options object):
|
|
151
|
+
|
|
152
|
+
1. strict mode, no throw; receipt row `work_unit_ref IS NULL`, `intent=deliver`,
|
|
153
|
+
`messageId=gateway-task:<id>`; then a real execution dispatch is enqueued and linked —
|
|
154
|
+
the execution row gets `task_<id>_r1` while the receipt row stays NULL and exactly **one**
|
|
155
|
+
row in the whole task carries an identity;
|
|
156
|
+
2. no assignee → no row written, no throw.
|
|
157
|
+
|
|
158
|
+
### 6.3 Mutation readings (each mutation applied alone, then reverted)
|
|
159
|
+
|
|
160
|
+
| Mutation | Expected | Observed |
|
|
161
|
+
|---|---|---|
|
|
162
|
+
| delete `workUnitRef`/`refOrigin` from `reEnqueueOnShutdown` | positive cases red | 2 failed / 2 passed; error text is the guard message (`…task_status_update) has no workUnitRef…`, `…review_request)…`) |
|
|
163
|
+
| delete the guard's `throw` in `mailbox.ts` | negative case red | 1 failed (`expected [Function] to throw an error`) / 5 passed across both files |
|
|
164
|
+
| delete `refOrigin: 'platform-internal'` in the receipt helper | receipt case red | 1 failed (guard message) / 1 passed |
|
|
165
|
+
|
|
166
|
+
No mutation left the suite green, so the three tests test the production decisions rather than
|
|
167
|
+
the ability to pass an option.
|
|
168
|
+
|
|
169
|
+
## 7. Quality gates (same order as CI, run in this worktree)
|
|
170
|
+
|
|
171
|
+
| Gate | Result |
|
|
172
|
+
|---|---|
|
|
173
|
+
| `npm run typecheck` | clean (both `tsc -b` and the standalone web-ui `tsc --noEmit`) |
|
|
174
|
+
| `npm run lint` | 0 errors / 1003 warnings (the pre-existing warning count is unchanged) |
|
|
175
|
+
| `node scripts/architecture-guard.mjs` | pass — 34 hits all allowlisted, 27/27 invariants |
|
|
176
|
+
| `node scripts/security-guard.mjs` | ok |
|
|
177
|
+
| `npm run test` | 8883 passed / **1 failed**, `cli/test/commands-start-integration.test.ts` "auto-runs quickInit" 60s timeout — **pre-existing**: reproduces in isolation here (16/17 with the same failure) **and on the untouched base checkout at `76501788`** (same single failure). Two consecutive full runs agreed; an earlier run under heavy machine load showed 12 failures (all timeouts in attention/turn-delta suites), which did not reproduce serially. |
|
|
178
|
+
| `npm run test:web-ui` | see §7.1 |
|
|
179
|
+
|
|
180
|
+
### 7.1 web-ui
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Test Files 124 passed | 1 skipped (125)
|
|
184
|
+
Tests 1548 passed | 3 skipped (1551)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Both skipped entries are pre-existing platform-conditional skips (no failures).
|
|
188
|
+
|
|
189
|
+
## 8. One decision recorded, nothing left pending
|
|
190
|
+
|
|
191
|
+
**`architecture-allowlist.json` gained one `session-identity` entry** for
|
|
192
|
+
`packages/org-manager/src/gateway-task-receipt.ts`. The rule fires on
|
|
193
|
+
`.enqueueToMailbox(` call sites in `core`/`org-manager` `src/` that have no session token in
|
|
194
|
+
their window, and its own remediation text is "if this is a genuine exemption, register it and
|
|
195
|
+
write the reason". The extracted function is the same call site that used to sit in
|
|
196
|
+
`api-server.ts` (already allowlisted with the same rationale); the entry is the migration of
|
|
197
|
+
that rationale, not a new silence. The alternative — keeping the call in `api-server.ts` and
|
|
198
|
+
importing that 16k-line module from a test — would have made the fixture depend on the whole
|
|
199
|
+
API server boot surface, which is precisely the "test can't call production" problem this card
|
|
200
|
+
exists to remove.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# C9 follow-up — identity declaration for `task_status_update` enqueues
|
|
2
|
+
|
|
3
|
+
Date: 2026-11-15
|
|
4
|
+
Scope: `packages/core/src/agent.ts`, `packages/org-manager/src/api-server.ts` (+ new tests)
|
|
5
|
+
Status: implemented
|
|
6
|
+
|
|
7
|
+
## 1. Symptom
|
|
8
|
+
|
|
9
|
+
The C8-P0 identity guard (`packages/core/src/mailbox.ts`, `AgentMailbox.enqueue`) fired
|
|
10
|
+
on a fact type that some callers legitimately enqueue without an identity:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
[ERROR] [mailbox] mailbox.enqueue(task_status_update) has no workUnitRef and no refOrigin
|
|
14
|
+
— identity would be silently NULL (declare refOrigin: "pending-link" | "platform-internal")
|
|
15
|
+
{"agentId":"agt_d7f911ea2163f2151277b90e","sourceType":"task_status_update","itemId":"mbx_aa61…"}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Readings on 2026-11-15 (`~/.markus/logs/runtime-2026-11-15.log`):
|
|
19
|
+
|
|
20
|
+
| Reading | Value |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `grep -c "has no workUnitRef and no refOrigin"` | 13 |
|
|
23
|
+
| distinct `sourceType` values among those hits | `task_status_update` only |
|
|
24
|
+
| `intent` of those mailbox rows (DB cross-check, 13/13) | `trigger_execution` |
|
|
25
|
+
| `work_unit_ref` of those rows **after** claim (DB cross-check, 13/13) | `task_<id>_r<n>` (e.g. `task_tsk_41782…_r2`) |
|
|
26
|
+
| callers that declare `refOrigin` in `packages/*/src` before this change | **0** |
|
|
27
|
+
|
|
28
|
+
The guard's actionable hint ("declare `refOrigin`") had no exemplar in the codebase:
|
|
29
|
+
the capability the gate demanded was unreachable in the turn that needed it. Same shape
|
|
30
|
+
as the family C9 just closed.
|
|
31
|
+
|
|
32
|
+
Production behaviour of the guard is fail-open (`log.error` + `unclaimedIdentityCount++`),
|
|
33
|
+
but if that counter becomes a CI gate or `MARKUS_STRICT_IDENTITY=1` is enabled, these
|
|
34
|
+
paths throw. So the signal has to become truthful, not merely quiet.
|
|
35
|
+
|
|
36
|
+
## 2. Root cause (R1 — one fact, several writers)
|
|
37
|
+
|
|
38
|
+
"Who provides the identity" is decided in three different places:
|
|
39
|
+
|
|
40
|
+
1. `mailbox.enqueue` derives `workUnitRef` from `options.workUnitRef`;
|
|
41
|
+
2. the task chain supplies it **after** the fact exists (`onItemEnqueued` → TaskService
|
|
42
|
+
writes `mailbox_items.work_unit_ref`);
|
|
43
|
+
3. the guard re-decides "was this forgotten?" by looking at a NULL ref.
|
|
44
|
+
|
|
45
|
+
A caller that legitimately has no ref *at enqueue time* is indistinguishable from a
|
|
46
|
+
caller that forgot. The missing piece is not a second guard but a **declaration**: the
|
|
47
|
+
caller must state *why* the ref is empty. `EnqueueOptions.refOrigin` already exists for
|
|
48
|
+
this; nobody used it.
|
|
49
|
+
|
|
50
|
+
## 3. Site-by-site decision
|
|
51
|
+
|
|
52
|
+
`task_status_update` is enqueued from exactly three places in `packages/*/src`.
|
|
53
|
+
|
|
54
|
+
### 3.1 `packages/core/src/agent.ts` — `sendTaskExecution()` → `pending-link`
|
|
55
|
+
|
|
56
|
+
The item is enqueued first; the caller then receives the item id through `onItemEnqueued`
|
|
57
|
+
and TaskService links the work unit to that row. Identity genuinely arrives *after* the
|
|
58
|
+
fact — this is the definition of `pending-link`.
|
|
59
|
+
|
|
60
|
+
Evidence: all 13 production hits are this path (`intent='trigger_execution'`), and 13/13
|
|
61
|
+
rows ended with `work_unit_ref = task_<id>_r<n>`. The declaration does not change the
|
|
62
|
+
linkage; it names it.
|
|
63
|
+
|
|
64
|
+
### 3.2 `packages/org-manager/src/api-server.ts` — gateway `createTask` delivery record → `platform-internal`
|
|
65
|
+
|
|
66
|
+
Written when an external gateway creates a task: `intent='deliver'`, `invokesLLM=false`,
|
|
67
|
+
envelope `messageId = gateway-task:<taskId>`. It is a **receipt** for the creation event.
|
|
68
|
+
No work unit exists at creation and no code path will ever link this row — declaring
|
|
69
|
+
`pending-link` would be a promise nobody keeps. The task's entity linkage is carried
|
|
70
|
+
structurally by `envelope.messageId` and `metadata.taskId`.
|
|
71
|
+
|
|
72
|
+
### 3.3 `packages/org-manager/src/task-service.ts` — `maybeNotifyAssignee()` → no change
|
|
73
|
+
|
|
74
|
+
Already passes `workUnitRef: WORK_UNIT_REF.task(task.id, task.executionRound ?? 1)`, so
|
|
75
|
+
the guard never fired here. Listed as a candidate on the card; confirmed not affected.
|
|
76
|
+
|
|
77
|
+
## 4. Why option A and not option B
|
|
78
|
+
|
|
79
|
+
Option B (add `task_status_update` to `PLATFORM_INTERNAL_SOURCES`) is keyed by
|
|
80
|
+
`sourceType`, so it would also silence §3.1 — the one place where identity is real and
|
|
81
|
+
merely late. That would trade a loud signal for a false one. Option A (per-call
|
|
82
|
+
declaration) keeps the guard honest and matches its own message.
|
|
83
|
+
|
|
84
|
+
## 5. Test plan
|
|
85
|
+
|
|
86
|
+
New file `packages/core/test/mailbox-identity-declaration.test.ts`, two directions:
|
|
87
|
+
|
|
88
|
+
1. **Positive (must not throw)** — real assembly chain under `MARKUS_STRICT_IDENTITY=1`:
|
|
89
|
+
construct an `Agent`, call `sendTaskExecution(...)`. Before the change this throws;
|
|
90
|
+
after it returns an item with `workUnitRef === null` (pending-link is a declaration,
|
|
91
|
+
not a ref) and the guard counter stays 0.
|
|
92
|
+
2. **Negative (must throw)** — an undeclared caller of the same fact type: a record-shaped
|
|
93
|
+
`task_status_update` enqueue with no ref and no declaration throws the guard message.
|
|
94
|
+
This is what stops a fail-open regression: removing the throw in `mailbox.ts` turns
|
|
95
|
+
this red.
|
|
96
|
+
|
|
97
|
+
Both directions go through `Agent`/`AgentMailbox` — no test pokes `options.refOrigin`
|
|
98
|
+
directly to fake a declaration.
|
|
99
|
+
|
|
100
|
+
## 6. Verification readings
|
|
101
|
+
|
|
102
|
+
### 6.1 The live runtime cannot execute this diff (and why that is not a gap)
|
|
103
|
+
|
|
104
|
+
The running instance is a **packaged Electron app**
|
|
105
|
+
(`packages/desktop/dist-electron/mac-arm64/Markus.app`, pid 83331) whose server code is the
|
|
106
|
+
bundle built into the `.app`; `packages/cli/src/commands/start.ts` also hardcodes
|
|
107
|
+
`join(homedir(), '.markus')` as the data dir. Testing this diff against the live instance
|
|
108
|
+
would mean rebuilding and restarting that app — which kills every in-flight agent session
|
|
109
|
+
(the platform is executing five concurrent workers). That is a destructive, unauthorized
|
|
110
|
+
action, so it was not taken.
|
|
111
|
+
|
|
112
|
+
Instead the real chain was booted in a real Node process against a throwaway SQLite DB
|
|
113
|
+
(`/tmp` probe, not committed): real `TaskService` + real `Agent` + real
|
|
114
|
+
`SqliteMailboxRepo`/`SqliteWorkUnitRepo`, with `MARKUS_STRICT_IDENTITY=1` — strictly
|
|
115
|
+
stronger than "0 ERROR lines", because an undeclared empty identity **throws** instead of
|
|
116
|
+
logging.
|
|
117
|
+
|
|
118
|
+
### 6.2 Readings (2026-11-15 16:14 CST)
|
|
119
|
+
|
|
120
|
+
Scenario: create task → `approveTask(runNow)` → r1 dispatch → 打回 (terminal `failed` →
|
|
121
|
+
`in_progress`, the only transition that bumps `executionRound`) → r2 dispatch.
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
after approve -> status: in_progress round: 1
|
|
125
|
+
mailbox_items:
|
|
126
|
+
mbx_0b226f0b | task_status_update | trigger_execution | ref=task_tsk_422e…_r1
|
|
127
|
+
after failed -> status: failed round: 1
|
|
128
|
+
after 打回(reopen) -> status: in_progress round: 2
|
|
129
|
+
mailbox_items:
|
|
130
|
+
mbx_0b226f0b | task_status_update | trigger_execution | ref=task_tsk_422e…_r1
|
|
131
|
+
mbx_bc848a4e | task_status_update | deliver | ref=task_tsk_422e…_r1
|
|
132
|
+
mbx_0dc4c499 | task_status_update | trigger_execution | ref=task_tsk_422e…_r2
|
|
133
|
+
assertions:
|
|
134
|
+
rows with ref task_<id>_r2: 1
|
|
135
|
+
rows with NULL ref: 0
|
|
136
|
+
unclaimedIdentityCount: 0
|
|
137
|
+
RESULT: PASS (no throw, identity landed, 0 unclaimed)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Both card gates hold: the enqueue no longer trips the guard (it throws if it did, and the
|
|
141
|
+
count is 0), **and** the r2 item still landed its real identity `task_<id>_r2` — the
|
|
142
|
+
declaration named the behaviour, it did not erase it.
|
|
143
|
+
|
|
144
|
+
### 6.3 Quality gates (same order as CI)
|
|
145
|
+
|
|
146
|
+
| Gate | Result |
|
|
147
|
+
|---|---|
|
|
148
|
+
| `npm run typecheck` | clean |
|
|
149
|
+
| `npm run lint` | 0 errors (1003 pre-existing warnings) |
|
|
150
|
+
| `node scripts/architecture-guard.mjs` | pass (34 hits whitelisted, 27/27 invariants) |
|
|
151
|
+
| `node scripts/security-guard.mjs` | ok |
|
|
152
|
+
| `npm run test` | 8877 passed / 1 failed — `cli/test/commands-start-integration.test.ts` "auto-runs quickInit" 60s timeout, **pre-existing**: reproduces in isolation, untouched by this diff (live web-ui holds the port) |
|
|
153
|
+
| `node scripts/probe` (strict identity) | PASS, see §6.2 |
|
|
154
|
+
|
|
155
|
+
## 7. Out of scope (audited, deliberately unchanged)
|
|
156
|
+
|
|
157
|
+
`packages/core/src/attention.ts` re-enqueues a shutdown-interrupted row with
|
|
158
|
+
`{ reuseItemId }` and no declaration; it therefore also reaches the guard. That is a
|
|
159
|
+
different mechanism (re-queue of an existing row whose `work_unit_ref` is already in the
|
|
160
|
+
DB, not a new fact), and fixing it means deciding whether reuse inherits the row's
|
|
161
|
+
identity or declares its own. I did not touch it here: it is outside this card's
|
|
162
|
+
`task_status_update` scope and it changes re-queue semantics. Recorded so the next reader
|
|
163
|
+
does not have to rediscover it.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Inbox dual run — legacy `buildAttentionQueue` vs `deriveInbox` (C9-D)
|
|
2
|
+
|
|
3
|
+
> **Historical record.** Moved here from `docs/architecture/` on 2026-11-15: this is a dated
|
|
4
|
+
> measurement, not a description of current behaviour. The living contract is
|
|
5
|
+
> [`derived-views.md`](../architecture/derived-views.md) §7–§13.
|
|
6
|
+
|
|
7
|
+
Measured **2026-11-15 02:34 (Asia/Shanghai)** on the live database
|
|
8
|
+
`~/.markus/data.db`, read-only, same input on both sides. This is the "灰度双跑" evidence
|
|
9
|
+
required by the card: the two lists are produced by the **shipped legacy code** and by the
|
|
10
|
+
**code under review**, not by a reimplementation of either.
|
|
11
|
+
|
|
12
|
+
## 1. How the two lists were produced (reproducible)
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
# 1. snapshot the exact rows the Overview page feeds the queue (read-only)
|
|
16
|
+
node /tmp/build-inbox-snapshot.mjs
|
|
17
|
+
# → userId=usr_26f8cf3d14130d43d813b124
|
|
18
|
+
# approvals=4 (pending) notifications=20 (unread, the page's limit)
|
|
19
|
+
# tasks=4 (review|blocked|failed|in_progress) requirements=4 (pending|rejected)
|
|
20
|
+
|
|
21
|
+
# 2. legacy queue: base commit 1eb6b06d (C9-C tip; attentionQueue.ts unchanged from 011f23bf)
|
|
22
|
+
cd /private/tmp/c9c-base-dstage && npx vitest run packages/web-ui/test/__legacy_probe.test.ts
|
|
23
|
+
# → /tmp/inbox-legacy.json
|
|
24
|
+
|
|
25
|
+
# 3. derived queue: this branch
|
|
26
|
+
cd <c9d worktree> && npx vitest run packages/web-ui/test/__derived_probe.test.ts
|
|
27
|
+
# → /tmp/inbox-derived.json (+ .dropped)
|
|
28
|
+
|
|
29
|
+
# 4. classify
|
|
30
|
+
node /tmp/classify2.mjs
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Both probes are one-off and **were deleted before the commit** — no dead code ships.
|
|
34
|
+
|
|
35
|
+
## 2. Counts
|
|
36
|
+
|
|
37
|
+
| Reading | legacy | derived |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| rows in the list | 11 | **10** |
|
|
40
|
+
| rows that mean "a human must act" | 5 | 4 |
|
|
41
|
+
| unread notifications accounted for | 20 (6 rows + 14 attached) | 20 (all attached to rows) |
|
|
42
|
+
| rows folding more than one source | 0 (no such concept) | **5** |
|
|
43
|
+
| rows withheld for having no destination | 0 (they were rendered) | **0 on this snapshot** |
|
|
44
|
+
|
|
45
|
+
The one-row reduction is not a loss of work: it is the same requirement counted twice (§3.1).
|
|
46
|
+
|
|
47
|
+
## 3. Classified differences
|
|
48
|
+
|
|
49
|
+
### 3.1 Legacy **duplicated** one subject
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
requirement:req_202f503e2ecc6876567f069c requirement_approval 台海「隔离/封控」常态化研判…
|
|
53
|
+
approval:apr_mwf4nzid_1p approval_request 台海「隔离/封控」常态化研判…
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The legacy queue deduped by **task** entity only (`claimedTargets.add('task:' + id)`); a
|
|
57
|
+
requirement had no such key, so a requirement approval and an approval *about that requirement*
|
|
58
|
+
both survived. Derived: one row, `sources = [fsm:req_202f…, approval:apr_mwf4nzid_1p]`,
|
|
59
|
+
`key = requirement:req_202f503e2ecc6876567f069c:approve`. **This is a defect the Owner can see**
|
|
60
|
+
(two identical titles, one of which cannot be acted on differently).
|
|
61
|
+
|
|
62
|
+
### 3.2 Legacy **could not say what is blocking someone** — there was no such field
|
|
63
|
+
|
|
64
|
+
The legacy row set is `{id, kind, title, priority, waitingSince, waitingBasis, target, isNew, meta}`.
|
|
65
|
+
"Does a named other party wait on this?" was only implicit in `kind`, and the badge
|
|
66
|
+
(`actionableCount`) counted every non-message row the same. Derived carries `blocking` per row
|
|
67
|
+
(7 → 4 truths: the 4 rows above are blocking, the 6 message rows are not), so a later consumer
|
|
68
|
+
(mobile, audit page) cannot re-guess it.
|
|
69
|
+
|
|
70
|
+
### 3.3 Legacy merged **9 sources into 1 row without recording it**; derived keeps the record
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
task:tsk_d5c97ad4f4d267deb748e998:approve ← approval:apr_mwg95oye_3p
|
|
74
|
+
+ fsm:tsk_d5c97ad4f4d267deb748e998
|
|
75
|
+
+ 7 notifications
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Legacy also collapsed these into one row (via `notices`), but the *reason* was unrecoverable:
|
|
79
|
+
`sources[]` did not exist. Derived names every contributor, which is what makes "why is this
|
|
80
|
+
here" answerable and what the audit page (C9-E) can display.
|
|
81
|
+
|
|
82
|
+
### 3.4 The dual run caught a defect **in this cut's own first draft** (now fixed + tested)
|
|
83
|
+
|
|
84
|
+
Draft 1 mapped a notification's `type` to a need (`task_review` → `review`, `blocking: true`).
|
|
85
|
+
On real data that produced **three blocking "review" rows for tasks that are already
|
|
86
|
+
`completed`** — stale `task_review` notifications whose task was closed hours ago:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
tsk_77be97a3… completed (reviewer_type=agent) ← notification type=task_review
|
|
90
|
+
tsk_dff4474a… completed (reviewer_type=agent) ← notification type=task_review
|
|
91
|
+
tsk_b04ac0a3… completed (reviewer_type=agent) ← notification type=task_review
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
That is the C8-E defect in a new costume: deriving state out of a payload. Fixed: a
|
|
95
|
+
notification only ever contributes need `read`; the state comes from the row that owns it
|
|
96
|
+
(the FSM/approval loops), and folding puts the unreadness on that row anyway. Two tests pin it
|
|
97
|
+
(`a notification never raises a need`, `that same stale notice folds into the row when the FSM
|
|
98
|
+
still says review`).
|
|
99
|
+
|
|
100
|
+
### 3.5 What the drop rule would have removed (not on this snapshot)
|
|
101
|
+
|
|
102
|
+
`dropped = 0` here. The rule exists for the rows that *do* occur over time: an approval whose
|
|
103
|
+
agent record is gone (no entity, no `agentId`), and a broadcast with no entity and no sender.
|
|
104
|
+
Legacy rendered those as a row that navigates to `TEAM` with **no parameters** — a click that
|
|
105
|
+
lands on a page where nothing can be done. Derived withholds them and reports
|
|
106
|
+
`{source, ref, reason: 'no_action'}` instead of silently hiding them.
|
|
107
|
+
|
|
108
|
+
## 4. Decision
|
|
109
|
+
|
|
110
|
+
The derived list is a **strict subset** on this data (same work, one duplicate removed) with two
|
|
111
|
+
additions that are not visible as rows: `blocking` and `sources`. Nothing that needs a human
|
|
112
|
+
disappeared, and no item lost its destination — checked by comparing the destination of every
|
|
113
|
+
surviving row, not by counting rows.
|
|
114
|
+
|
|
115
|
+
Rollback: the whole cut is one commit (`git revert`), and there is deliberately **no runtime
|
|
116
|
+
`legacy | derive` switch** — a switch keeps the old assembly in the shipped bundle and with it a
|
|
117
|
+
second decider for the same fact (see `derived-views.md` §12).
|