Skip to content

Inbox slice E: SAM files system error items - #2781

Merged
simple-agent-manager[bot] merged 20 commits into
mainfrom
sam/implement-slice-e-inbox-9ck5xt
Nov 16, 2026
Merged

simple-agent-manager[bot] merged 20 commits into
mainfrom
sam/implement-slice-e-inbox-9ck5xt

Conversation

@simple-agent-manager

@simple-agent-manager simple-agent-manager Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Inbox slice E (spec idea 01M7G03ZCQ6TM6CMEYDRKQ8ST9, section 1 decision 3): SAM files error inbox 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 01M7JC1MTRFT8PWRQ8BNFP8D6W took over from 01M7HDVC5BV0MZ91V0AR9CK5XT, which stopped at its account's 5-hour limit and was then failed by SAM while queued. The full work from sam/slice-e-part6-wip was rebased onto main (slices G, C and F1) and brought onto this branch as merge commit a7b01b35c (its tree is the rebased result; no force-push). One gap was finished after the takeover (f3cc79dd3, see below). SAM's assigned output branch sam/take-over-finish-slice-fp8d6w is not used.

  • asks kind error through the shared createAsk, dedupe key error:<source>:<id> (packages/operations/src/inbox-error-core.ts).
  • Sources (code paths in tasks/active/2026-11-16-inbox-slice-e-system-errors.md):
    • failed task: couldn't start, or stopped before it finished. A minute cron scan covers every writer of tasks.status='failed'; the VM-agent callback also files inline.
    • failing or auto-paused automation (cron).
    • failed chat wake: a ProjectData port files an asks row instead of the wake_failed marker. 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.
    • fallback sleep with possible loss.
    • undelivered answers: InteractionStore delivery_unconfirmed, and inbox asks whose notice the sweep gave up on.
  • Closes by itself when the task is retried (both retry tools), leaves 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).
  • Actions in the answer spec ({type:'actions'}): retry (existing retrySubtask), wake (authorizeAgentWake + ensureSessionRecovery), resume (updateSchedule), open_chat (client). Agent sign-in sessions get 403.
  • Normal endings never file: 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.
  • Existing error and cron_failure notifications open the inbox item. ACP permission/form/URL requests send one needs_input notification per request, linking the item.
  • Limits are admin settings: inbox.automationFailureThreshold, inbox.errorSweepBatchSize, inbox.errorLookbackMinutes.

Added after the takeover (f3cc79dd3, 2fe59c8d6, 2fce75c87, 5e56f8333)

  • A provider-limit block now closes the chat's open failed-wake item, as it already resolved the wake_failed marker the item replaced (closeWakeErrorAskForProviderLimit in packages/project-data/src/do/question-asks.ts, called from provider-limit-attention.ts).
  • Integration test through the real task callback route (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.
  • API reference: added the failed-wake and undelivered-inbox-answer rows, the wake action, and the provider-limit behaviour.
  • Fixes from the four reviews of the rebased head:
    • Sweep bounds (rule 47/81). The task sweep pages the failed-task window with a (updated_at, id) keyset cursor, at most 5 pages of 4 × 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.
    • Automation sweep. It reads one row per automation, and 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 the items that can close or need Resume.
    • Chat-list readers. They probe a chat's wake item by its exact dedupe key on the unique (project_id, dedupe_key) index. The partial index the planner never used is dropped.
    • Retry. The item is claimed with a compare-and-set before the new task starts, so a double click starts one task. The item is handed back if the retry is refused.
    • Archive. An agent sign-in session cannot archive an error item.
    • Permission-request notifications go only to current members.
    • Task-failed notification. Its body is always the classified sentence. The callback does not send it when the sweep already filed the item.
    • Failed-wake assignee. The chat creator, else the chat's own task owner, else the project owner; never the owner of the task that sent the message.
    • Unconfirmed interaction answer. Its item is filed before the projection is marked resolved, so a failed write retries.
    • Undelivered answers. Probed by the chat's delivery key (no swap between two given-up asks), and an archived chat files none.
    • Isolation. Each half of each step is isolated, and fileAndNotify never throws.

Left out of scope (tracked)

tasks/backlog/2026-11-16-inbox-error-items-followups.md:

  1. A person's chat message that the durable prompt outbox fails to deliver to an awake chat (max_attempts_exceeded, dead_target) files nothing yet. Undelivered answers to inbox items and permission requests do file.
  2. The account map and the agent-facing pendingAttention do not list open wake-failure asks. Slice G left questions in the same state, so one fix covers both.

Added D1 round trips

  • Task callback (toStatus: failed only): filing ≈ settings + member + task check + insert (+ dedupe read + update on a repeat), run before the notification inside the existing waitUntil, never thrown. The callback response is not delayed.
  • Minute cron, task step. At most 5 keyset pages of 4 × inbox.errorSweepBatchSize rows (idx_tasks_failed_updated), stopping once batch items 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.
  • Minute cron, automation step. One grouped scan (idx_trigger_executions_failed_completed), at most 4 × batch streak 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).
  • ProjectData. A person's chat message adds one D1 UPDATE (close chat error items), sent alongside slice G's question close. A provider-limit block adds one D1 UPDATE; it runs inside the existing blockConcurrencyWhile next 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.
  • Chat list. The question reader gained a UNION ALL arm (same round trip). The ranking EXISTS gained an OR arm, a single-row seek by the chat's exact dedupe key.
  • Inbox archive route. One extra read, only for agent sign-in sessions.

Validation

  • pnpm lint (0 errors), pnpm typecheck (all 36 tasks), migration ordering + safety checks
  • Focused suites on the rebased head: API unit/integration 36 files / 653 tests; inbox system errors 40; Workers inbox-interaction-notifications 3, inbox-capability 14, wake-failure-item-lifecycle 4, vm-wake-event-delivery-handoff; project-data 548, worker-core 98, operations 42, shared 974; provider-limit-lifecycle 53
  • Each new guard was removed once and its test went red: sweep paging, delivery key probe, archived-chat skip, project-bound close, archived automation slot, Retry claim, archive agent-sign-in guard, member check, sleep-loss filing call, canWake, wake-ready close, chat-message close, wake assignee chain
  • Full CI on the ready PR: run 43952249489 on 209335119 passed. Attempt 1 was cancelled when Durable Object Workers shard 3/7 hung in actions/checkout for 30 minutes (job timeout, no test ran); attempt 2 re-ran only that shard and passed. E2E Smoke passed.
  • Main moved again before merge (Insights A: Accounts tab #2810 Insights A, fix(tasks): wait for pinned VM agent readiness during boot #2812, fix(api): trust ingress client IP and share constant-time checks #2813): it merges cleanly, and pnpm typecheck on the exact merged tree passed (36/36).

Staging Verification (REQUIRED for all code changes — merge-blocking)

  • Staging deployment green: staging2 (sammy2.party), run 43893788553 (head 2fce75c), then redeploy 43905747468 of the final head
  • Live app verified via Playwright: 375×667 phone and 1280×800 desktop, the project inbox and item view, no horizontal overflow, 0 console errors
  • Existing workflows confirmed working: task submit, Instant and VM starts, trigger manual runs and the cron fire, inbox list, count, item and archive, chat archive
  • New feature/fix verified on staging: see evidence below
  • Infrastructure verification completed: N/A, no infra changes
  • Mobile and desktop verification notes added for UI changes: N/A, no UI changes (the phone and desktop checks are recorded below anyway)

Staging Verification Evidence

All on staging2 as staging2-agent-admin (smoke-token session), project 01M7JEQ3Z6V03E1CYBJE0M0G61, 2026-11-16 15:31–16:25Z.

  1. Real failed start → one item → Retry from the phone closes it.
    • An Instant Codex start failed at launch: task 01M7JG4D76SGFCP2WBDFVA3F0P, "standalone git clone failed".
    • The next sweep tick filed one item, ask:01M7JG97A5F8Z4STF1F56CR06H:
      • title: “Say hello in one word.” couldn't start
      • body: the classified sentence, with no raw error text (checked the item and the notification JSON for git clone and exit status)
      • actions: [retry, open_chat]; links: task and chat
    • One high-urgency error notification was sent, opening /projects/…/inbox?item=ask%3A….
    • On a 375 px phone I opened the item and tapped Retry. The item became done and the retry task 01M7JGCVG1NP3YMMBSWJBGA9MX was created.
  2. VM failures.
    • The VM agent's agent_prompt_failed callback on task 01M7JG20EKZ14CF6TW7XY4M1H9 filed "… stopped before it finished" (the agent had started) at the next tick.
    • A placement-refused automation run filed "… couldn't start".
  3. Failing → really auto-paused automation → Resume from the phone closes it.
    • Trigger 01M7JHN1T536J0A84H4EJSR733 ran on a VM Codex profile. Three runs failed for real (agent_prompt_failed, 16:05–16:09Z).
    • The 16:10Z tick filed "Automation “E failing automation” failed its last 3 runs" (failure count 3, no action).
    • The 16:15Z cron fire was refused and auto-paused the automation (trigger-admission.ts). The same item was updated in place to "… was paused after 3 failed runs" with [resume].
    • On the phone I tapped Resume: POST …/answer returned 200 {"outcome":"resumed"}, the "Resumed" receipt showed, the trigger went back to active, and the item became done.
    • The 16:20Z tick filed nothing new: the old failures are behind the resume reset.
  4. Never-file liveness. Five runs and tasks I cancelled as the user (one of them alongside genuine failures) filed no items, while genuine failures in the same ticks did.
  5. Archive. Six error items archived through the inbox route returned archived, agentNotified: false, and the inbox count went to 0.
  6. Cleanup. The four test nodes were deleted, the twelve test chats archived, and both triggers disabled.

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 in packages/worker-core/src/index.ts (slice E's AskAttentionSummary export block next to #2751's new network-hosts exports; 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 changes holdTaskForProviderLimit, resumeProviderLimitTask, recoverStuckTasks and transitionTaskToTerminal, none of which this slice edits. Its behaviour is kept unchanged: a task waiting on a usage limit stays queued, 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.md items 8–12, and tasks/backlog/2026-11-16-staging2-observations-during-inbox-e.md):

  • Instant first-prompt failures file nothing. An Instant start whose first prompt fails (staging2's AI Gateway 402) keeps the task in_progress / awaiting_followup, so no item is filed. Slice F2 has been told on feature.inbox.
  • VM failure items wait for a tick. A VM failure's inline filing and notification are skipped when the workspace is already torn down; the next five-minute tick files it.
  • Run items beside the automation item. Failed automation runs file a task item each, as well as the automation item.
  • Archived chats keep their items. Archiving a chat leaves its error items open (spec section 7 applies to all asks).
  • Cancelled runs count as failures. A cancelled run counts toward the automation streak, which the existing auto-pause has always done.
  • The sweeps run every five minutes, not every minute as the earlier text said; the docs are corrected.
  • CI fix. A Workers test failure in session-wake-ready.test.ts was 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

  1. Failed start: a writer sets tasks.status='failed', then runInboxSystemErrorSweep (apps/api/src/services/inbox/system-errors.ts) runs classifyTaskFailure, fileSystemError (packages/operations/src/inbox-error-core.ts), createAsk and the asks row, and notifyFiled sends the error notification with the inbox ref. The VM-agent callback path is routes/tasks/callback.ts to fileTaskFailure to notifyTaskFailed({inboxRef}).
  2. Retry: POST /api/projects/:id/inbox/items/ask:<id>/answer {action:'retry'} (routes/inbox.ts), answerInboxItem, the error action port (services/inbox/port.ts), retrySubtask with the caller's authority, then resolveSystemError closes the item.
  3. Failed wake: raiseSessionWakeFailure (packages/project-data/src/do/wake-failure.ts), projectDataPorts().inboxErrors.fileWakeFailure (apps/api/src/project-data-ports/inbox-errors.ts), fileAndNotify, and the asks row. The chat list reads it through readOpenQuestionAttention (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).
  4. Automation: syncTriggerExecutionStatus records the failed run, runInboxAutomationErrorSweep (automation-errors.ts) files at the threshold, and auto-pause adds Resume. {action:'resume'} calls updateSchedule and closes the item.

Untested Gaps

  • retrySubtask itself 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.
  • The InteractionStore outbox retry after a failed delivery-item write has no dedicated test.
  • Staging2 migration ledger. Staging2 applied an earlier body of migration 0248 at 10:13Z (the previous owner's WIP deploy). The in-place edit therefore does not re-run there: staging2 keeps the dropped idx_asks_open_wake_error and lacks idx_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.

Reviewer Status Outcome
security-auditor ADDRESSED 0 CRITICAL/HIGH. Both MEDIUMs fixed and tested: sweep starvation (keyset paging, SQL exclusion, archived automations) and the Retry double-submit (claim compare-and-set, race test). LOWs fixed: agent sign-in archive, member check on permission notifications, wake assignee, sanitized task-failed body, fileAndNotify guard (2fe59c8, 2fce75c, 5e56f83).
cloudflare-specialist ADDRESSED HIGH-1 wake readers now seek by exact key (unused partial index dropped). HIGH-2 close driven from changed tasks. HIGH-3 automation latest run read in the page SELECT, with new index. MED-4 to MED-6, LOW-7 to LOW-11 fixed. MED-6b (D1 UPDATE inside blockConcurrencyWhile) deferred with reason in the backlog file: the lock already holds a D1 read.
test-engineer ADDRESSED H1 sleep-loss through the real fallback (8 tests). H2/H3 failed wake through the real port, wake-ready close, DO chat-message close, chat index (23 tests). H4 real auto-pause and resume re-sweep. H5 notification assertions. H6 starvation. All proven red under revert.
task-completion-validator ADDRESSED First run FAIL (sleep untested, delivery flip-flop, others) was fixed. Re-run on 2fce75c: PASS. Its remaining MEDIUM (member-check negative test) was added in 5e56f83.

CodeRabbit Review Evidence (Required for agent-authored PRs)

CodeRabbit Notes

Requested at 14:46Z when the PR was marked ready (coderabbit-review label; workflow runs 43889219424 / 43889230759 succeeded). CodeRabbit replied "Review rate limited" and its check reports skipping. Per rule 25 the wait ends on a rate-limit reply: no CodeRabbit review arrived, nothing to resolve.

Agent Preflight (Required)

  • Preflight completed before code changes

Classification

  • external-api-change
  • cross-component-change
  • business-logic-change
  • public-surface-change
  • docs-sync-change
  • security-sensitive-change
  • ui-change
  • infra-change

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

…leeps and undelivered answers (slice E)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codspeed

codspeed Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing sam/implement-slice-e-inbox-9ck5xt (2093351) with main (5d1a247)2

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩

  2. No successful run was found on main (470bfe6) during the generation of this report, so 5d1a247 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

raphaeltm and others added 2 commits November 16, 2026 06:13
…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>
simple-agent-manager Bot pushed a commit that referenced this pull request Nov 16, 2026
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>
@simple-agent-manager simple-agent-manager Bot mentioned this pull request Nov 16, 2026
31 of 35 tasks
simple-agent-manager Bot added a commit that referenced this pull request Nov 16, 2026
* 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>
@simple-agent-manager
simple-agent-manager Bot marked this pull request as ready for review November 16, 2026 14:46
@simple-agent-manager simple-agent-manager Bot added the coderabbit-review Trigger CodeRabbit review for opt-in PRs label Nov 16, 2026
@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

raphaeltm and others added 2 commits November 16, 2026 15:02
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>
raphaeltm and others added 6 commits November 16, 2026 15:15
…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>
@github-actions
github-actions Bot requested a deployment to staging2 November 16, 2026 16:17 Abandoned
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions
github-actions Bot requested a deployment to staging2 November 16, 2026 16:45 Abandoned
raphaeltm and others added 6 commits November 16, 2026 16:46
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>
@sonarqubecloud

Copy link
Copy Markdown

@simple-agent-manager
simple-agent-manager Bot merged commit f3f6462 into main Nov 16, 2026
66 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coderabbit-review Trigger CodeRabbit review for opt-in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant