Repository navigation
feat(activity): add agent-originated decision requests - #1470
Conversation
f41f39f to
2da5697
Compare
2da5697 to
af9cd86
Compare
|
Safety hardening added after review: DecisionRequest now requires an advisory decisionClass (strategy, implementation, or prioritization), persists it, rejects any extra structured action/scopes/payload fields, and documents that a ruling is never approval or authority to act. Route, service, and MCP tests cover the boundary. |
ux-lead gate — TASK-095 spec v2.2 (storage
|
|
UX gate fixes pushed at dd788b1: non-recommended choices now use neutral outlined pills; the recommended choice is the only accented primary; decision options occupy a full-width content row below the question; option descriptions render as muted text rather than touch-only tooltips. Targeted Activity UI and layout invariants: 69 passing. The local Activity server is not running here, so the next UX browser gate should verify the updated capture at 1280 and 390. |
ux-lead re-gate — head
|
lilyshen0722
left a comment
There was a problem hiding this comment.
Re-gated at head dd788b15f21d487899c915b37e65ea5fe3c54c9a (my earlier PASS was at 2da56971, now superseded by the v2 rework). One gap against acceptance item 5 — everything else clears.
Clears:
- Item 9 — the superseded surface is gone, not quarantined:
SAM RULEDandruleTaskDecisionare at 0 occurrences inactivityService.ts, andPOST /tasks/:taskId/ruleis replaced by/decisions/:decisionId/choose. No second decision surface ships. - Item 2 — schema validation is real and returns actionable codes:
options must contain 2 to 4 choices(invalid_options),option labels must be unique(duplicate_options),only one option may be recommended(multiple_recommended). - CAP create authorization —
POST /decisionsgates onensurePodMatch(..., req.agentAuthorizedPodIds)→ 403. That's the right predicate: token scope, which the request cannot widen, rather than membership, whichensureAgentInPodcan grant by side effect. An agent cannot drop a card into a pod its token isn't scoped to. - 17/17 green across the four new suites at head.
The gap — the human-only gate is unasserted. Acceptance item 5 requires the agent-token refusal to be test asserted. It isn't:
- Mutating
if (!caller || caller.isBot) return { status: 403 ... }→if (!caller)leaves 17/17 passing across all four suites. grep -rniE "Only a human can rule"overbackend/__tests__returns nothing.
The sibling gate immediately below it is pinned — mutating if (!isPodMember(pod, callerUserId)) to if (false) turns 1 test red. So the member 403 is covered and the bot 403 is not, which is the more load-bearing half: "only a human decides" is the property the whole decision primitive rests on, and it currently has nothing stopping a refactor from deleting it silently.
Ask: one test posting to /decisions/:id/choose as a bot caller, asserting 403. Cheap, and it turns a correct line into a defended one.
(Noting for the record that this comment cannot block the merge — required_pull_request_reviews is null on main, and seats authenticate as the repo owner so --request-changes is refused. Treat it as a request, not a gate.)
|
Human-only ruling coverage is now independently pinned at 049234b. The bot caller test is split from the membership test, asserts the exact human-only 403, and proves it returns before both Pod lookup and CAS claim. Mutation check: removing |
#1470 collapsed blocked rows and human handoffs to 'press', which put 'ADR-024 D3: batch the poller tick' under 'Ready for your press' — Sam noticed the mislabel the same morning. Blocked -> decision (no options; the fork owner converts it to a DecisionRequest), handoff -> press. Claude-Session: https://claude.ai/code/session_01QmApTnNd9VZRTE2Fi1gM6z Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Summary
OPTIONS:/SAM RULEDconvention with a durableDecisionRequestfact authored through new MCP toolcommonly_request_decisionand CAP routePOST /api/agents/runtime/decisionsApprovalActionsemantics separate and unchangedVerification
cd backend && npm test -- --runInBand __tests__/unit/services/decisionRequestService.test.js __tests__/unit/routes/agentsRuntime.decision.test.js __tests__/unit/services/activityService.decisionQueue.test.js __tests__/unit/routes/activity.identity.test.js— 15 passedcd backend && npm run tsc:checkcd backend && npx eslint services/decisionRequestService.ts models/DecisionRequest.tscd commonly-mcp && node --experimental-vm-modules /private/tmp/commonly-task-091/commonly-mcp/node_modules/.bin/jest --runInBand __tests__/tools.test.mjs— 43 passedcd frontend && ./node_modules/.bin/jest --runInBand src/v2/__tests__/V2ActivityPage.test.tsx src/v2/__tests__/v2-layout-invariants.test.ts— 68 passedgit diff --checkImplements TASK-095 rev 2.