Repository navigation
feat: close the decision and mention attention loops - #1561
Conversation
|
Follow-up at
Verification on local PostgreSQL 16 / MongoDB 7, Node 22:
This push supersedes the old CI rerun. Fresh remote checks and the TASK-130 review gate are still required; no merge, deploy, or backlog sweep performed. |
lilyshen0722
left a comment
There was a problem hiding this comment.
Gate at 8298cdb2b370c5f7c27a22d5c1b78d0c2cf78f55. 36/36 across the three service suites. The timeout diagnosis is confirmed and the stamp is guarded; gate (a) is not met as specified, and gate (b) is blocked on a ruling rather than on code.
The timeout cause is what the PR description now says
Confirmed independently before the fix: pg/Message.ts Message.create gained an awaited resolveMentionAttentionForReply(...), a Mongo updateMany on every PG insert, and the threading fixtures had no Mongo connection. That is a per-write coupling, not the one-shot sweep — which is reachable only via backend/package.json:25 and one unit test, and is scheduled nowhere.
Worth keeping in view even though the tests are green: every PG message write now blocks on a Mongo round-trip whose filter is {recipientUserId, podId, kind, status, $or:[sourceCreatedAt<t, {sourceCreatedAt:$exists:false, createdAt<t}]}, against indexes (recipientUserId, status, createdAt) and (podId, status, createdAt). Neither covers that shape and the $exists:false branch is index-hostile. Fine at test volume; the chat write path is the wrong place to discover it isn't.
Gate (a): the event is asserted at the enqueue, not at the queue
I asked for request → rule → event on the agent's queue. Both halves are mocked:
decisionRequestService.test.js:35mocksagentEventService.enqueueand asserts the call shapeagentEventService.test.js:1mocks theAgentEventmodel and assertsAgentEvent.createwas called
Chained, those prove the service asks for the right document. Neither proves the asking agent can read it — the producer-side assertion pins what was written, never that anyone can fetch it.
I checked the two things that would have made this a defect rather than a gap, and both are fine: the poll query is {agentName: lowercased, instanceId, status:'pending'} with no type filter, so decision.ruled is deliverable like any other type; and DecisionRequest.agentName/instanceId are lowercase: true at models/DecisionRequest.ts:65-66, so the enqueue's casing matches what the reader lowercases to.
So: sound by construction, unproven by test. One service-tier test that enqueues and then reads the queue as that agent would close it. Not blocking on my own authority — but "delivered" is the word in the DoD, and nothing here tests delivery.
Gate (b): the stamp is guarded, the label is still wrong
The stamp is pinned — removing resolvedBy: 'replied' gives 1 red (resolves only this recipient's older mentions in this pod when they post a reply).
But the rule is unchanged from what I flagged: any later post by that recipient in that pod, with no thread or reply-target condition, stamped 'replied'. That is the broad rule wearing the narrow label. The sweep will move the 195 through a stamp that asserts a reply nobody wrote, and my gate — "the backlog shrinks only through the two stamps" — passes while recording something untrue.
This is not a code defect; it is an unmade decision, raised in 63942 and 64143 and again in the pod. Either:
- keep this filter and stamp
'posted-since', or - keep
'replied'and addthread_root_id/ reply-target matching, whichAttentionItemalready carries at:42-43.
I can gate either the moment one is named. I cannot gate the pair as built.
|
Added the missing queue-delivery gate at a8c179a. The new service-tier test uses real MongoDB 7 and PostgreSQL 16 and real HTTP auth: POST /api/agents/runtime/decisions → POST /api/activity/decisions/:id/choose → GET /api/agents/runtime/events as the asking seat. No enqueue, model, auth, or message-store mocks. It checks the exact ruling payload, a second seat on the same runtime cannot read it, the persisted event becomes delivered with one attempt, and a duplicate ruling creates no second event. Omitting the typed enqueue gives exactly one red at the queue-read assertion (expected one ruling, received zero). Restored baseline: 14/14 across delivery and both threading suites; diff check clean. This commit is test-only. The resolution-label ruling remains outstanding; no sweep or behavior change for (b). |
a8c179a to
1b6adc5
Compare
|
CI trigger recovery: GitHub reported DIRTY/CONFLICTING at a8c179a; git merge-tree reproduced conflicts only in cli/package.json and cli/package-lock.json. Rebased onto main 5d87cb6 and retained CLI 0.1.33 above main 0.1.32. New head: 1b6adc5. Range-diff marks the implementation and both test commits identical; only the version-bump base lines changed. Focused CLI suites pass 137/137. GitHub now reports MERGEABLE, and seven pull_request workflow runs exist at this exact head, including Tests 34011966888 and Package Version Guard 34011966860. They are running, not yet green. No close/reopen was needed. Resolution-label ruling remains outstanding. |
…n guard) Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EtwYLMJAYuZ3grLQoXWMWT
…tarts the seat (#1568) * feat: model choice from the UI reaches the seat — and changing it restarts the seat The other half of Sam's ask ("no way to … config their model from UI"). The on-my-computer hire form gains a Model select (adapter default / opus / sonnet / haiku — aliases, not version-pinned ids, because the seat runs on the user's own CLI install whose model ids move). The choice rides the install as config.runtime.model, the daemon work list already serves it, and the supervisor now writes it into the token record's environment — the exact field the claude adapter turns into --model on every spawn AND on the session-recovery retry path. Live edits propagate: on each tick the supervisor compares the served model against the record; a difference updates the record and restarts the seat through the exit event (the D6 path — no second spawner). A row with no declared model never strips a hand-set environment. 5 new tests (mint carries environment.model, no-model invents nothing, change→update+restart, hand-set env preserved, UI payload shape). cli 427 green, frontend 616 green. cli 0.1.32 → 0.1.33. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EtwYLMJAYuZ3grLQoXWMWT * chore(cli): 0.1.34 — 0.1.33 is claimed by older open PR #1561 (version guard) Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EtwYLMJAYuZ3grLQoXWMWT --------- Co-authored-by: Claude Fable 5 <[email protected]>
Both #1561 and #1568 bumped cli/package.json (0.1.33 vs 0.1.34); take main and bump once more. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JavWvyVL478UfEhJjcfMgX
…1570) * feat(cli): commonly daemon install — the login service (ADR-026 D1) `commonly daemon install` registers the resident daemon as a login service: a launchd LaunchAgent on macOS (KeepAlive — launchd restarts a dead daemon), a systemd user unit on Linux (Restart=always). Both run the exact interpreter + CLI entry that executed the install, resolved at install time — a PATH lookup at boot would race version managers and silently run a different install than the one the user tested. The unit's PATH carries homebrew for the CHILDREN: seats spawn the user's claude/codex by name, and launchd's default PATH would kill every seat at adapter detection while the daemon itself looked healthy. Install requires a registered daemon credential (a service without one just crash-loops at boot). `daemon uninstall` unloads and removes; a failing launchctl load surfaces instead of reporting success. 8 new tests on the generated units and both flows, side effects injected. cli 0.1.34 → 0.1.35 (0.1.33 is claimed by open #1561, 0.1.34 by #1568). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EtwYLMJAYuZ3grLQoXWMWT * chore(cli): 0.1.36 — main took 0.1.35 while this was in flight Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EtwYLMJAYuZ3grLQoXWMWT --------- Co-authored-by: Claude Fable 5 <[email protected]>
What changed
decision.ruledevent to the asking runtime after the ruling CAS, while preserving explicit mentions and using the old reply-edge wake only if the typed queue is unavailableresolvedBy, and adds a source-backed dry-run/apply sweep for legacy rowsdecision.ruledinto a runnable wrapper promptReview gates
AgentEventqueue row is asserted end to end, including payload and orderingrepliedoracknowledgedstamps; it never resolves unread or cross-pod mentionsVerification
backend npm test -- --runInBand(focused: 6 suites, 135 tests)backend npm run tsc:check -- --pretty falsebackend npm run buildcli npm test -- --runInBand(29 suites, 405 passed, 10 skipped)commonly-mcp npm test -- --runInBand(3 suites, 58 tests)git diff --checkThe full backend suite cannot complete locally on Node 26 due an existing
jsonwebtoken→buffer-equal-constant-timecompatibility failure while loading unrelated suites; the focused TASK-130 suites, typecheck, and build pass.