Repository navigation
Inbox slice G: request_human_input questions become asks rows - #2780
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Merging this PR will not alter performance
Comparing Footnotes
|
|
@coderabbitai review |
Action not completed
|
0c17ae1 to
63212c8
Compare
* feat(overview): aggregated project overview read (operation + REST route)
projectOverviewGet returns running chats and recent ideas/merged PRs for
the Inbox F1 Project Overview page; GET /api/projects/:projectId/overview.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(chat): share the new-chat composer and start path
Move composer state and the Instant/task start out of useProjectChatState
into useNewChatComposer, which returns what it started and never
navigates. The chat page keeps opening the new chat; the Project Overview
task box will reuse the same start without leaving the page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(web): Project Overview page with Running now, Budgets, Automations, Recently and a task box
New lazy-loaded page at /projects/:id/overview, first in the project nav
on desktop and phone. Running now and Recently come from the aggregated
overview read (refreshed by project socket events); Budgets reuses the
composer's usage model; Automations reuses the Automation page's model and
fix button through a new one-line AttentionLine. The task box is the real
new-chat composer and start path; sending stays on the page with a receipt
and an optimistic Running now row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(overview): task box start without navigation, budgets wording, composer collapse
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* style: sort test imports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(overview): Playwright visual audit; keep the idle phone task box to one row
The composer measured its height only when its text changed, so a box
first measured while its row was narrower kept a wrapped placeholder's
height. It now re-measures on width changes. While folded, attach waits
in the To row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: Project Overview guide and overview API reference
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* style: sort operations exports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(overview): review findings — waiting-on-you ranked first, phone box refolds, accessible budgets
- Running now ranks chats waiting on the viewer first and reports
waitingOnViewerTotal, so the cap never hides the page's one exception
('7 more running · 2 waiting on you').
- Composer folds on an outside tap or a completed send instead of on blur
(iOS does not focus tapped buttons); the success receipt is transient;
receipt live regions are persistent; the text box has a name.
- Budgets tiles speak the usage left; failing automations count in red with
a secondary Resume; compact idea rows in Recently.
- Merged PR links must be https; global profile names only for the task
creator's own profiles.
- Performance: index for newest merged PRs (migration 0246), a lighter
recent-ideas read (11 measured round trips), no socket refetch on a
hidden tab, ResizeObserver work deferred to the next frame.
- Tests: nav order on desktop and phone, round-trip budget, query plan,
automation fix, Recently links, hidden-tab, fold-after-send.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* style: sort operations imports
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* task: archive inbox F1 project overview task
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: sidebar scroll audit counts the Overview nav item
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* task: record F1 checklist and review outcomes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore: renumber overview index migration to 0249
0246 is taken by #2772 (already applied on staging2), 0247 by #2780 and 0248 by #2781.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: give the GitHub sign-in prompt a painted background
The app-wide prompt in AuthProvider used bg-surface-elevated, a class no theme defines, so it
rendered transparent over whatever sat at the bottom of the page. Staging2 showed it over the
Overview task box. Use the Toast's glass-surface and shadow-dropdown. The Overview audit gains a
GitHub-reauth failed-start scene that asserts the prompt paints a background (red against the
old class).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
b5c9fce to
3e73805
Compare
|
❌ The last analysis has failed. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce G) request_human_input files one asks row (kind question) through createAsk; the answer is a compare-and-set on the row plus a durable prompt with notified_at and sweep retry; reminders, the undelivered grace and expiry run from asks in the inbox sweep with admin settings inbox.question*. The attention routes, chat list, ProjectData session reads, idea status, Connector reads, check-in hold and stalled-task guard read open questions from asks. Marker-era questions keep their ProjectData paths until they resolve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…overlay and hold tests - question-asks.test.ts: filing, answer outcomes, concurrent answers, tenancy attack/owner pairs, typed-message close, sweep reminders/grace/expiry - workers: request_human_input -> asks row -> inbox archive/answer of a sleeping chat queues one wake-capable delivery; marker-era overlap case - chat list index overlay + live ranking, stall guard, check-in hold, Connector projection; marker-era route tests keep the overlap path - createAsk split into inbox-ask-create-core.ts (file size rule) - docs: admin settings inbox.question*, API reference, notifications/config Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- check-in hold lasts until the question's deadline and is released when it closes (no lease-cadence alarms while a question is open); gate marker questionHold so a release never ends a claim lease or quarantine - typed-message close runs after the broadcast and alarm, only closes questions filed before the message - getSession no longer reads D1 (no consumer renders it; list reads do) - sweep steps get their own budget; throughput stated - same-answer replay retries an undelivered answer - request_human_input: empty context/options and validation errors are INVALID_PARAMS, not internal errors - partial index idx_asks_open_question; expiry predicate in the ranking EXISTS and the Connector projection; shared chat-writer check - HUMAN_INPUT_TIMEOUT_MS retired in the deploy-script binding test - tests: real-SQL hold, shared reads in every mode, conjunct-isolating and forged-snapshot attacks, Connector lists, idea merge, real-DO typed close, check-in resolution, expiry outcome, authz through real routes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…through the sweep - typed-message close binds the message's own timestamp - the check-in hold covers a question just past its deadline until the sweep extends or expires it - tests: file-wide VM fetch stub, real-DO retry idempotence of the answer notice, just-expired hold case Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Project Overview (F1) found a chat paused on a person only through session_summaries.attention_json, which no longer carries agent questions. Read this project's open, unexpired question asks once in a CTE and treat either signal as paused, for the waiting state, the ranking and the count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every production ProjectData object carries do_meta.projectId before an RPC reaches it (ensureProjectId through the service memo) and reads it from memory afterwards. The fixture never set it, so slice G's question close on a human message re-ran the empty lookup each batch. With the production shape the profile is unchanged from main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4976031 to
387e213
Compare
Summary
Inbox slice G (spec: SAM idea
01M7G03ZCQ6TM6CMEYDRKQ8ST9, decision 8 "one record per ask, in D1"). A question an agent asks withrequest_human_inputis now oneasksrow (kindquestion) and nothing else: the row is the record of truth for the question, its status and its answer. No attention marker, nosession_summaries.attention_jsoncopy.routes/mcp/human-input-tool.ts→services/inbox/question-asks.ts:fileQuestionAsk): same inputs and limits; filed through the sharedcreateAsk(assignee = the task owner; per-chat capinbox.openItemsPerChat; title = first sentence capped atinbox.titleMaxChars; body = the full question). Same notification and push, linked to the ask (notification_id). Tool result shape unchanged;humanInputRequest.idis the ask id.sam_agent_answerand the inbox answer route):answerAttention(routes/chat-attention.ts) reads the ask first;answerQuestionAskdoes a compare-and-setopen → answeredbound to project + chat + kind, delivers the answer as a durable prompt (deliverInboxAskNotice, the wake path for a sleeping chat), recordsnotified_at; the inbox sweep retries an undelivered answer. Caller outcomes preserved: accepted (200), already answered with the same answer (200alreadyResolved), still being delivered (202inFlight), different answer being delivered / already resolved (409), invalid option (400).ProjectDatamessage persistence and human prompt acceptance callcloseQuestionAsksForHumanMessage.asksin the 5-minute inbox sweep, from admin settingsinbox.questionTimeoutMinutes,inbox.questionFirstReminderPercent,inbox.questionSecondReminderPercent,inbox.questionUndeliveredGraceMinutes,inbox.questionMaxWaitMinutes. An expired question endsexpiredand has today's task outcome (ProjectData.expireQuestionAskreuses the marker-expiry consequence).attention.created/attention.resolvedsocket events all show asks-era questions.InteractionStore,acp_interactionmarkers,attention_json) until slice J.Marker-era vs asks-era during the overlap (no data migration)
attention:<sessionId>:<markerId>fromattention_json(as in slice A)ask:<id>fromasksasks→ durable promptasks→archived+ noticeHUMAN_INPUT_*(unchanged)inbox.question*Tests: marker-era archive and answer paths (
inbox-capability.test.ts"a marker-era question…",notification-push-do.test.tsfree-form marker,chat-attention-reader.test.ts,chat-prompt-cancel.test.ts); asks-era everywhere else. Removing the marker-era question code after the drain is idea01M7HC7CN5WY6GEP9G0PP4DG7B.Rule 44 inventory (every writer and reader)
Every writer and reader of question markers (kind
needs_input) and ofsession_summaries.attention_json, and what it does after this slice. "Marker-era" = keepsserving questions that existed as markers at deploy until they resolve (max 24 h by default);
removal tracked in the follow-up idea filed with this PR.
Writers
routes/mcp/human-input-tool.ts(request_human_input)createAttentionMarker+linkAttentionNotificationfileQuestionAsk→createAsk(asks row) +linkQuestionNotification(asks.notification_id); no markerProjectData.createAttentionMarkerRPC (request_human_input branch: resolves check-ins)ProjectData.recordQuestionAskedProjectData.linkAttentionNotification+ clientanswerAttention(routes/chat-attention.ts; callers: resolve route,ports.chat.answerAttention→sam_agent_answer, inbox answer)answerQuestionAskCAS + durable prompt +notified_at; marker-era fallback unchangedarchiveAttention(inbox port,attention:refs)archiveInboxItem(closeAsk+ notice)message-persistence.ts:resolveAttentionForRoles,durability-foundation.ts(human message)closeQuestionAsksForHumanMessage(asks → answered, notified)attention-expiry.ts(DO alarm: expiry, escalation, undelivered grace, task outcome)services/inbox/sweep.ts) +ProjectData.expireQuestionAsk(reusesfailExpiredTaskMarker)interaction-store-attention.ts(permission mirrors),reconciliation*.ts,idle-cleanup*.ts,wake-failure.ts,provider-limit-attention.tssession-summary-sync.ts(writesattention_json)Readers
GET …/attention/:id(chat card, notification reader)services/session-summary-index.ts)attention; live ranking counts chats with an open questionlistSessions/getSessionsByTaskIds/getSession(chat list fallback, team statusteam-core.ts, account maproutes/account-map.ts)withQuestionAttentionmerges open question asksuseSessionReducerlive eventsattention.createdfromrecordQuestionAsked;attention.resolvedfrom answer/archive delivery accept, typed message, expiryinbox-list-core.ts)sam_chat_read/sam_chat_interactions/sam_work_changes(attention-core.ts)sam_chats_list/sam_projects_list(connector-read-core.ts)scheduled/stalled-task-classifier.ts)hasOpenQuestionAsk(D1) + marker checkresolveCandidateProjectIdD1 query)idea-work.ts)mergeQuestionAskspackages/operations/src/project-overview.ts, rebased in after #2775)open_questionsCTE over this project's open, unexpired question asks: such a chat iswaiting, ranked first and counted; the summary'sattention_jsonstill covers other markersarchive-sharding.ts)inbox.questionMaxWaitMinutes(≤ 3 days) long before the 7-day archive graceHUMAN_INPUT_TIMEOUT_MSinbox.questionTimeoutMinutes); the other threeHUMAN_INPUT_*remain for marker-era questionsRound trips of the changed hot paths (rule 60)
request_human_inputcreateAsk: settings, member check, task check, insert (4 D1); settings for the schedule (1 D1, per-isolate cached store);recordQuestionAsked(1 DO); D1 project name + Notification DO; link notification (1 D1). ≈ 8 D1 + 2 DO (mutation budget 12)loadQuestionAsk(1 D1); CAS (1 D1); notice row (1 D1);acceptPromptDelivery(1 DO);notified_at(1 D1). No VM call: delivery is the durable wake pathPromise.all(no added latency)json_each)idx_asks_open_question)getSessionUPDATE … RETURNINGafter the broadcast and alarminbox.sweepBatchSizerows: reminders (1 D1 read + CAS + push each), expiry (receipt check, CAS, DO outcome), notice retrySweep throughput at the outer limit (rule 81): default 10 rows per step per tick = 120 per hour per step; a question needs ≤ 2 reminder rows and 1 expiry row, so 100 questions expiring at once drain in ≈ 50 min (setting goes to 50). Reminders and expiry fire on the 5-minute tick instead of the DO alarm's exact time.
Check-in hold (Cloudflare review H2)
An open question holds SAM's check-in by deferring the reconciliation gate to the question's deadline (
questionHold), so the alarm waits instead of re-arming at the lease cadence; every close path releases it (releaseQuestionHold). The release only touches a question hold, never a claim lease or quarantine.Discrimination evidence (rule 28)
Each guard was weakened once and the named test went red, then restored: answer CAS project/chat (
forged snapshot attack),loadQuestionAskproject/chat (attack: an ask id addressed…), typed close project (typed chat message…) and the DO hook wiring (workersa person's chat message answers…), Connector projection project (shows a question held in D1 asks…), stall guard project (consults the model when the asks question is in another project), live-ranking EXISTS (ranks an old chat waiting on a question…), reconciliation hold project (does not hold … in another project). The chat-card GET attack is also protected by the session-access check, so it is defence in depth rather than predicate-discriminating.Behaviour changes worth knowing
HUMAN_INPUT_TIMEOUT_MSis retired (no GitHub Environment overrides existed in staging or production, checked 2026-11-16); the other threeHUMAN_INPUT_*stay for marker-era questions.inbox.openItemsPerChat) andinbox.bodyMaxCharsnow apply torequest_human_input; hitting one returnsINVALID_PARAMSwith the reason.inbox.noticeRetryMinutes, and sending the same answer again retries it at once.Validation
pnpm lint(affected packages;pnpm check:fastgreen)pnpm typecheckpnpm test(API unit suite, project-data unit suite, affected Workers suites:inbox-capability,notification-push-do,attention-markers,stalled-task-human-input,session-summary-index-sync,project-data-idea-work,sleep-idle-cleanup-attention,attention-expiry-failed-task-preservation,acp-interaction-store)scripts/quality/sync-wrangler-config.test.ts,pnpm quality:migration-safetymaxCandidatesPerSweep), and a held candidate leaves the alarm until the question's deadline; the inbox sweep's three steps are each bounded byinbox.sweepBatchSize(throughput above)Staging Verification (REQUIRED for all code changes — merge-blocking)
0247_asks_questions.sqlapplied and all six columns present (D1pragma_table_info)staging2-agent-user), the same routes the chat card and inbox callStaging Verification Evidence
staging2, 2026-11-16 09:39–09:55Z, project
01M7HTM8747B16PHS25TQ6WBZA(Artifacts, Claude Code), real agents.request_human_input→ oneasksrow; inbox itemstore: "ask"; chat listneeds_inputwith the ask id; card GET (marker-shaped); Project Overviewwaiting,waitingOnViewer: trueeu, cardus)alreadyResolved: true; agent repliedGOT I: usarchived,agentNotified: true; a later card answer 409 "already resolved"; agent told "archived … will not act on it"GOT A: euat 09:49:25Zmedium→ 400 "answer must match one of the requested options";large→ 200; agent repliedGOT B: largeinbox.questionTimeoutMinutes=questionMaxWaitMinutes= 1 (both reset to defaults right after)expired: trueat the deadline; the 5-minute sweep setstatus='expired'at 09:53:09Z; the task failed "Human input request expired after timeout", the marker-era outcomeasksrows afterwardsanswered(us,eu,large), 1archived, 1expired; every rownotified_atset;next_escalation_at= created + 30 min,max_expires_atas configuredinbox-capability.test.ts, marker-era answer and archive cases).tasks/backlog/2026-11-16-manual-sleep-hibernate-timeout-500.md);capacity-pool-edit-query-plan.test.tssits at the 5 s default timeout and timed out once in CI (tasks/backlog/2026-11-16-capacity-pool-query-plan-test-near-timeout.md). A transient upstream402 AI inference failedon the VM agent's first turn cleared on retry.UI Compliance Checklist (Required for UI changes)
N/A: no UI changes (no files under apps/web, packages/ui, packages/terminal).
UI Screenshot Evidence
N/A: no UI changes.
End-to-End Verification (Required for multi-component changes)
Data Flow Trace
request_human_input→routes/mcp/human-input-tool.ts:handleRequestHumanInput→services/inbox/question-asks.ts:fileQuestionAsk→packages/operations/src/inbox-ask-create-core.ts:createAsk(D1 insert) →ProjectData.recordQuestionAsked(check-in resolved,attention.created) →services/notification.ts:notifyNeedsInput→linkQuestionNotification.routes/chat-attention.tsGET (ask first) orinbox-item-core.ts:readStoreRow.answerAttention(card, notification,sam_agent_answer) orinbox-write-core.ts:answerAsk→ports.chat.answerAttention→question-asks.ts:answerQuestionAsk(CAS) →ask-notice.ts:deliverInboxAskNotice→ProjectData.acceptPromptDelivery(sourceinbox_ask, wake-capable;durability-foundation.tsreleases the check-in hold and emitsattention.resolved) →notified_at.message-persistence.ts/durability-foundation.ts→question-asks.ts:closeQuestionAsksForHumanMessage.services/inbox/sweep.tsreminders → undelivered grace → expiry →ask-notice.ts:expireQuestion→ProjectData.expireQuestionAsk→attention-expiry.ts:failExpiredQuestionAsk.Untested Gaps
inbox_askdelivery on a sleeping chat. The live wake is verified on staging (below).EXPLAIN QUERY PLANassertion for the new partial index (idx_asks_open_question).Post-Mortem (Required for bug fix PRs)
N/A: not a bug fix
Specialist Review Evidence (Required for agent-authored PRs)
needs-human-reviewlabel added and merge deferred to human (n/a: all completed)INVALID_PARAMS(3de6a8e). LOW: expiry predicate in ranking/Connector reads and index fixed; non-atomic typed close accepted with expiry backstop (humanMessageSince); grantee inbox visibility narrowing documented aboveHUMAN_INPUT_TIMEOUT_MSretired in the deploy-script binding test; check-in hold re-armed at lease cadence → hold until the question's deadline + release on close. MEDIUM: typed close after broadcast/alarm;getSessionoverlay removed; per-step sweep budgets; partial indexidx_asks_open_question(3de6a8e, re-verified PASS). LOW: message-timestamp guard and hold through sweep pickup (7d8786f); hold kept until deadline when an answer notice can never be delivered (documented)01M7HC7CN5WY6GEP9G0PP4DG7B): sweep budget-saturation and answer-vs-expiry race tests, real Notification DO receipt path, live socket payload assertions,request_human_inputreal failure modes through/mcpCodeRabbit Review Evidence (Required for agent-authored PRs)
CodeRabbit Notes
Marked ready and labelled
coderabbit-reviewat 2026-11-16T05:18:20Z; the label workflow ran (success). CodeRabbit replied at 05:18:57Z with "Review limit reached — You've used all free OSS reviews for now" (rate limit). No review; not re-triggered (rule 25).Exceptions (If any)
Agent Preflight (Required)
Classification
External References
N/A: internal storage move; no external API changed (D1
RETURNINGandjson_eachare already used in this codebase).Codebase Impact Analysis
apps/api(MCP request_human_input, attention routes, inbox sweep/notice, chat list index, stalled-task classifier),packages/operations(createAsk, inbox answer, settings, Connector reads),packages/project-data(session reads, reconciliation hold, idea status, typed-message close, expiry outcome, live events),packages/worker-core(shared open-question read, schema),packages/shared(constant removed), deploy config (HUMAN_INPUT_TIMEOUT_MS removed).Documentation & Specs
apps/www/src/content/docs/docs/guides/admin-settings.md(question settings, sweep budget),reference/api.md(inbox stores, answer outcomes, attention route ids),guides/notifications.mdandreference/configuration.md(HUMAN_INPUT_*),.claude/skills/env-reference/SKILL.md,apps/api/.env.example. Nospecs/edits (outside spec context).Constitution & Risk Check
Principle XI: every new limit is an admin setting with a typed default (policy 9017df94). Risks: transition overlap with marker-era questions (both paths kept until they drain); answer delivery moves from a direct live-agent prompt to the durable prompt queue (the wake path), which is what lets a sleeping VM chat wake.
🤖 Generated with Claude Code