Repository navigation
Inbox slice E: SAM files system error items - #2781
Conversation
…leeps and undelivered answers (slice E) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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
|
…QL tests for slice E Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… error items Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* 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>
Integrates origin/main and replaces the branch tree with slice E rebased onto it: the nine commits from sam/slice-e-part6-wip (failed wake as an asks error item read through slice G's adapters, undelivered answers, review fixes) on top of main 30ae952. Done as a merge instead of a rebase so the PR branch is never force-pushed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A chat blocked on a provider usage limit resolved its wake_failed marker but left the inbox error item that replaced the marker open. The block now closes it as superseded through the same write that closes chat error items when the person writes in the chat (one shared helper). Integration test on the real task callback route: a task waiting on a usage limit files no error item (inline or by the sweep) beside a genuine failure that does, and the block closes the open failed-wake item. Verified red without the close. API reference: the failed-wake and undelivered-inbox-answer rows, the wake action, and the provider-limit behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
Action not completed
|
Security, Cloudflare, test and completion reviews of the rebased head. Sweeps (rule 47, 81): - Task sweep pages the failed-task window with a (updated_at, id) keyset cursor (at most 5 pages of 4x batch) and excludes failures a person set in SQL, so normal endings can no longer hold every slot. - The task-recovery close is driven from tasks changed inside the window, not from every held key. - Automation sweep: one row per automation; an archived item never holds a slot; the close half reads each automation's newest finished run in the same statement (new idx_trigger_executions_trigger_finished) and returns only items that can close or need Resume. - Undelivered-answer filing probes the chat's delivery key (no swap between two given-up asks of one chat) and skips archived chats. - Each half of each step is isolated; fileAndNotify never throws. Readers: the chat list probes a chat's wake item by its exact dedupe key on the unique (project_id, dedupe_key) index; the unused partial index idx_asks_open_wake_error is dropped from 0248. Actions and notifications: - Retry claims the item (compare-and-set) before starting the new task, and hands it back if the retry is refused: no duplicate task on a double click. - Agent sign-in sessions cannot archive an error item. - Permission-request notifications go to current members only. - The task-failed notification body is always the classified sentence, never raw error text; the callback sends none when the sweep already filed it. - Failed-wake assignee: the chat creator, else the chat's own task owner, else the project owner (never the sending task's owner); the port no longer takes taskId. - An unconfirmed interaction answer files its item before the projection is marked resolved, so a failed write retries. - Wake-failure filing is one per chat per alarm, each chat isolated; the wake-ready close runs beside the readiness signal; the two human-message closes run together; a first filing skips its redundant update. Tests: sleep-loss item through the real bounded sleep fallback; failed-wake item through the real port, wake-ready close, chat-message close in the DO and the chat index; a real agent_prompt_failed callback files inline with a linked notification; task-failed notification never carries raw text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rror items - A flood of parent-stopped tasks newer than a genuine failure no longer hides it (keyset pages); the admin-set batch and lookback are honoured. - The real auto-pause at admission gives the item Resume; after a resume the old failures are behind the reset and a single new one files nothing. - An archived automation item costs no check and holds no slot. - Two overlapping Retry answers start one task (claim compare-and-set). - A recovered task closes only its own project's item; archive is the assignee's only; resume through a foreign project is not found. - Two given-up answers in one chat keep one stable delivery item; an archived chat files none. - Route: an unknown action is 400; an agent sign-in session cannot fix or archive an error item (owner control archives it). Each new guard was removed once and its test went red. Docs: failed wake in the error notification row; batch setting wording. Backlog: the remaining narrowings, stated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t every minute The inbox error steps sit in the */5 operational sweep (the every-minute cron only resumes capacity-pool continuations). Correct the comments, the batch setting description, the API reference and the admin settings guide, and restate the throughput per five-minute tick. 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>
…de it Running the D1 close concurrently with the ProjectData wake-ready signal reordered queued deliveries (session-wake-ready.test.ts 'delivers a saturated queue immediately once, in original order' failed in CI). Close it after the signal instead: it still cannot delay readiness. 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>
…ng them SonarCloud's duplication gate failed (4.1% on new code, all in tests): the sleep-loss test copied the bounded-fallback test's snapshot seeding and mock forwarding, and two provider-limit cases repeated one setup. - tests/helpers/session-snapshot-seed.ts: one seedSnapshotGeneration for both sleep-fallback suites. - The sleep-loss test builds its spies and module mocks from one name list. - provider-limit-lifecycle: seedInboxOwner() and rejectDistinctIncidents(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts resolved by keeping both sides: slice D's agent-ask ports beside slice E's error-item ports, both notification fields, both type exports, both admin settings rows. Slice D's "only a blocking question pauses a chat" is applied to slice E's two-arm reader (question arm gains blocking = 1) and to the chat index ranking. Tests: slice D's agent-asks test applies migration 0248; the wake-failure reader fixture marks its question blocking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…into slice E Only conflict: packages/worker-core/src/index.ts export blocks (kept both). No file overlap with #2815; its provider-limit wait stays queued, so the slice's sweep still files nothing for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|



Summary
Inbox slice E (spec idea
01M7G03ZCQ6TM6CMEYDRKQ8ST9, section 1 decision 3): SAM fileserrorinbox items itself for genuine system failures: one item per failing thing, updated in place on repeats, closed by itself on recovery. SAM still never files an item because an agent ended its turn.Takeover (2026-11-16 14:25Z): task
01M7JC1MTRFT8PWRQ8BNFP8D6Wtook over from01M7HDVC5BV0MZ91V0AR9CK5XT, which stopped at its account's 5-hour limit and was then failed by SAM while queued. The full work fromsam/slice-e-part6-wipwas rebased onto main (slices G, C and F1) and brought onto this branch as merge commita7b01b35c(its tree is the rebased result; no force-push). One gap was finished after the takeover (f3cc79dd3, see below). SAM's assigned output branchsam/take-over-finish-slice-fp8d6wis not used.askskinderrorthrough the sharedcreateAsk, dedupe keyerror:<source>:<id>(packages/operations/src/inbox-error-core.ts).tasks/active/2026-11-16-inbox-slice-e-system-errors.md):tasks.status='failed'; the VM-agent callback also files inline.asksrow instead of thewake_failedmarker. The chat list reads it through slice G's reader (readOpenQuestionAttention/preferAttention). The marker is written only as a logged fallback when the D1 filing fails, so a failure is never invisible.delivery_unconfirmed, and inbox asks whose notice the sweep gave up on.failed, the automation runs cleanly or is resumed or disabled, the chat wakes, the person writes in the chat, or (new) the chat becomes blocked on a provider usage limit (superseded).{type:'actions'}): retry (existingretrySubtask), wake (authorizeAgentWake+ensureSessionRecovery), resume (updateSchedule), open_chat (client). Agent sign-in sessions get 403.lifecycleOutcome(no error), a person-set status,classifyFailure().diagnosable === false(cancel, parent stop, input expiry, superseded wake), an archived chat. A task waiting on a provider usage limit is not failed and files nothing.errorandcron_failurenotifications open the inbox item. ACP permission/form/URL requests send oneneeds_inputnotification per request, linking the item.inbox.automationFailureThreshold,inbox.errorSweepBatchSize,inbox.errorLookbackMinutes.Added after the takeover (
f3cc79dd3,2fe59c8d6,2fce75c87,5e56f8333)wake_failedmarker the item replaced (closeWakeErrorAskForProviderLimitinpackages/project-data/src/do/question-asks.ts, called fromprovider-limit-attention.ts).provider-limit-lifecycle.test.ts). Four rejected prompts park and then block the task. No error item is filed inline or by the sweep, while a genuine failure in the same sweep tick is filed. The block then closes the open failed-wake item. Verified red with the close removed.(updated_at, id)keyset cursor, at most 5 pages of4 × batch. It excludes failures a person set themselves in SQL, so a flood of parent-stopped tasks can no longer hide a genuine failure. The task-recovery close is driven from tasks changed inside the window, not from every held key.idx_trigger_executions_trigger_finished) and returns only the items that can close or need Resume.(project_id, dedupe_key)index. The partial index the planner never used is dropped.fileAndNotifynever throws.Left out of scope (tracked)
tasks/backlog/2026-11-16-inbox-error-items-followups.md:max_attempts_exceeded,dead_target) files nothing yet. Undelivered answers to inbox items and permission requests do file.pendingAttentiondo not list open wake-failure asks. Slice G left questions in the same state, so one fix covers both.Added D1 round trips
toStatus: failedonly): filing ≈ settings + member + task check + insert (+ dedupe read + update on a repeat), run before the notification inside the existingwaitUntil, never thrown. The callback response is not delayed.4 × inbox.errorSweepBatchSizerows (idx_tasks_failed_updated), stopping oncebatchitems are filed, at about 5 trips per filing. Then one UPDATE for closes, driven from tasks changed in the window (tasks(updated_at, id)), and one scan for undelivered answers (≤ batch filings). At the defaults: 200 rows read and 10 items filed per minute. Normal endings starve a genuine failure only past 200 of them in 30 minutes, installation-wide.idx_trigger_executions_failed_completed), at most4 × batchstreak reads, ≤ batch filings. Then one close/refresh page whose per-item latest-run read is one seek (idx_trigger_executions_trigger_finished). Each candidate leaves by filing, closing, or ageing out of the lookback window. Each step and each half is isolated. Both steps run in the five-minute operational cron (*/5).blockConcurrencyWhilenext to that lock's existing D1 read (moving both out is in the backlog file). A wake-ready signal adds one UPDATE, run alongside the signal.Validation
pnpm lint(0 errors),pnpm typecheck(all 36 tasks), migration ordering + safety checksinbox-interaction-notifications3,inbox-capability14,wake-failure-item-lifecycle4,vm-wake-event-delivery-handoff; project-data 548, worker-core 98, operations 42, shared 974;provider-limit-lifecycle53canWake, wake-ready close, chat-message close, wake assignee chain209335119passed. Attempt 1 was cancelled when Durable Object Workers shard 3/7 hung inactions/checkoutfor 30 minutes (job timeout, no test ran); attempt 2 re-ran only that shard and passed. E2E Smoke passed.pnpm typecheckon the exact merged tree passed (36/36).Staging Verification (REQUIRED for all code changes — merge-blocking)
Staging Verification Evidence
All on staging2 as
staging2-agent-admin(smoke-token session), project01M7JEQ3Z6V03E1CYBJE0M0G61, 2026-11-16 15:31–16:25Z.01M7JG4D76SGFCP2WBDFVA3F0P, "standalone git clone failed".ask:01M7JG97A5F8Z4STF1F56CR06H:git cloneandexit status)[retry, open_chat]; links: task and chaterrornotification was sent, opening/projects/…/inbox?item=ask%3A….doneand the retry task01M7JGCVG1NP3YMMBSWJBGA9MXwas created.agent_prompt_failedcallback on task01M7JG20EKZ14CF6TW7XY4M1H9filed "… stopped before it finished" (the agent had started) at the next tick.01M7JHN1T536J0A84H4EJSR733ran on a VM Codex profile. Three runs failed for real (agent_prompt_failed, 16:05–16:09Z).trigger-admission.ts). The same item was updated in place to "… was paused after 3 failed runs" with[resume].POST …/answerreturned 200{"outcome":"resumed"}, the "Resumed" receipt showed, the trigger went back toactive, and the item becamedone.archived,agentNotified: false, and the inbox count went to 0.After staging: main was merged in at 17:56Z (
c803c47c3): inbox slice D, Insights F and the staging lease queue. Conflicts were resolved by keeping both sides. Slice D's rule that only a blocking question pauses a chat now also applies to slice E's two-arm reader and to the chat index ranking. The slice E paths verified above are unchanged. The merged tree passes the full API suite (1,058 files, 16,017 tests), the inbox Workers suites, the package suites, and lint.Second merge of main (20:40Z,
209335119, third owner). Main had gained the provider-limit watchdog fix (#2815), Inbox slice F2 (#2793) and the outbound-fetch guard (#2751). The only textual conflict was the export list inpackages/worker-core/src/index.ts(slice E'sAskAttentionSummaryexport block next to #2751's newnetwork-hostsexports; both kept). No file is changed by both this branch and #2815, F2 or #2751 except that index and the two docs pages, which merged cleanly. #2815 changesholdTaskForProviderLimit,resumeProviderLimitTask,recoverStuckTasksandtransitionTaskToTerminal, none of which this slice edits. Its behaviour is kept unchanged: a task waiting on a usage limit staysqueued, so the failed-task sweep files nothing for it. Its new queued-timeout text ("Task stuck in 'queued' without recorded orchestration progress …") still classifies as diagnosable (stalled,/task stuck in/), so a real watchdog failure still files one item. The failed-start and failed-wake filing paths and the inbox answer route's Retry, Wake and Resume actions are untouched by this merge, so the staging2 verification above still applies; no new staging turn was spent. Re-run on the merged tree: typecheck (36/36), lint (22/22), operations 42, worker-core 98, Workers suites (inbox-*,wake-failure-item-lifecycle,session-wake-ready,vm-wake-event-delivery-handoff,provider-limit-watchdog,provider-limit-event-delivery,provider-limit-full-restore,notification-push-do: 10 files, 100 tests), full API suite (1,061 files, 16,234 tests).Found on staging and stated, not fixed here (in
tasks/backlog/2026-11-16-inbox-error-items-followups.mditems 8–12, andtasks/backlog/2026-11-16-staging2-observations-during-inbox-e.md):in_progress / awaiting_followup, so no item is filed. Slice F2 has been told on feature.inbox.session-wake-ready.test.tswas caused by running the wake-item close in parallel with the readiness signal; it now runs after the signal (a49cc6c).UI Compliance Checklist (Required for UI changes)
N/A: no UI changes (server only; slice C renders the items).
End-to-End Verification (Required for multi-component changes)
Data Flow Trace
tasks.status='failed', thenrunInboxSystemErrorSweep(apps/api/src/services/inbox/system-errors.ts) runsclassifyTaskFailure,fileSystemError(packages/operations/src/inbox-error-core.ts),createAskand theasksrow, andnotifyFiledsends theerrornotification with the inbox ref. The VM-agent callback path isroutes/tasks/callback.tstofileTaskFailuretonotifyTaskFailed({inboxRef}).POST /api/projects/:id/inbox/items/ask:<id>/answer {action:'retry'}(routes/inbox.ts),answerInboxItem, the error action port (services/inbox/port.ts),retrySubtaskwith the caller's authority, thenresolveSystemErrorcloses the item.raiseSessionWakeFailure(packages/project-data/src/do/wake-failure.ts),projectDataPorts().inboxErrors.fileWakeFailure(apps/api/src/project-data-ports/inbox-errors.ts),fileAndNotify, and theasksrow. The chat list reads it throughreadOpenQuestionAttention(packages/worker-core/src/question-asks.ts). It closes on wake (session-wake-ready.ts), on a person's chat message (closeChatErrorAsksForHumanMessage), or on a provider-limit block (closeWakeErrorAskForProviderLimit).syncTriggerExecutionStatusrecords the failed run,runInboxAutomationErrorSweep(automation-errors.ts) files at the threshold, and auto-pause adds Resume.{action:'resume'}callsupdateScheduleand closes the item.Untested Gaps
retrySubtaskitself is mocked at the far edge in the inbox retry tests. Its owner check is existing code, and the item offers Retry only to the project owner. The claim race and the route are tested.idx_asks_open_wake_errorand lacksidx_trigger_executions_trigger_finished, which only makes it slower. Production and primary staging have never applied 0248.Post-Mortem (Required for bug fix PRs)
N/A: not a bug fix
Specialist Review Evidence (Required for agent-authored PRs)
Re-run on the rebased head (
f3cc79dd3); earlier results on the pre-rebase head do not carry over.fileAndNotifyguard (2fe59c8, 2fce75c, 5e56f83).blockConcurrencyWhile) deferred with reason in the backlog file: the lock already holds a D1 read.CodeRabbit Review Evidence (Required for agent-authored PRs)
CodeRabbit Notes
Requested at 14:46Z when the PR was marked ready (
coderabbit-reviewlabel; workflow runs 43889219424 / 43889230759 succeeded). CodeRabbit replied "Review rate limited" and its check reportsskipping. Per rule 25 the wait ends on a rate-limit reply: no CodeRabbit review arrived, nothing to resolve.Agent Preflight (Required)
Classification
External References
N/A: no external API. Internal code paths only (see task file
tasks/active/2026-11-16-inbox-slice-e-system-errors.md).Codebase Impact Analysis
packages/shared(inbox types),packages/operations(inbox error core, answer/archive dispatch, list/item reads, settings),packages/worker-core(schema, open-ask attention reader),packages/project-data(wake failure as an ask, chat error closes, provider-limit supersede),apps/api(migration 0248, cron steps, task callback, retry paths, sleep fallback, InteractionStore projection, notifications, inbox route, ProjectData port).Documentation & Specs
Updated:
apps/www/src/content/docs/docs/guides/notifications.md,apps/www/src/content/docs/docs/guides/admin-settings.md,apps/www/src/content/docs/docs/reference/api.md(System error items).Constitution & Risk Check
Principle XI: limits are admin runtime settings (
inbox.automationFailureThreshold,inbox.errorSweepBatchSize,inbox.errorLookbackMinutes). Risks: filing on failure paths (isolated, never throws), notification noise (one per new item), tenancy (assignee-bound reads, project-bound writes).🤖 Generated with Claude Code