Files
PaperClipAI/doc/testing/coordinator-inbox-test-drive.md
T
627d59c5aa fix(inbox): group repeated provider failures and clear recovered tasks (#22846)
## Thinking Path

> - Paperclip helps people manage work that agents do.
> - The inbox tells a person which tasks need a decision.
> - A provider usage limit can stop several attempts on one task or
affect several tasks.
> - Separate failure cards made it hard to tell which tasks still needed
attention.
> - This change groups failures using the account, reset time, or retry
links that Paperclip can verify.
> - A person can now see which task to retry, which tasks are waiting,
and which ones recovered.

## Linked Issues or Issue Description

**What existing behavior does this improve?**

It improves the Coordinator inbox when a provider limits usage.

**Current behavior**

Repeated run failures can fill the inbox. Resolved failures can still
appear beside open decisions.

**Proposed behavior**

Show personal actions in Needs you, automatic retries and snoozes in
Waiting, and past events in History. Keep an archived retry chain hidden
during automatic attempts. Return it to Needs you when a person must
act.

**Additional context**

Related work includes #18020 on completed tasks, #9704 on archive
behavior, and #21570 on usage limits in chat.

## What Changed

- Group verified account and reset windows. When that evidence is
missing, count linked attempts per task and show the tasks in a
collapsible group.
- Separate the reported reset time from each task’s retry schedule. Keep
unresolved ownership recoveries visible after task closure. Use
persisted native retry requests to preserve the original archive and
increment the attempt count.
- Keep personal archive in the card menu. Put decision receipts and run
logs in History.
- Align inbox filters, tabs, and history. Share empty-state artwork and
placement across Inbox, Goals, Routines, and Secrets.
- Index run-history pages and resumed-work lookups, and rate-limit
history requests per company and viewer. Add synthetic fixtures for both
grouping paths and a manual walkthrough.

## Verification

- The author and a human tester completed the synthetic retry-chain
walkthrough. Chromium also verified archive, repeat failure, exhaustion,
and recovery.
- The 64 focused server tests and the UI and server typechecks passed
before rebasing. See `doc/testing/coordinator-inbox-test-drive.md` to
repeat the manual checks.
- The shared SDK input check and all 64 focused server tests passed
after rebasing. The OpenAPI suite (59 tests), API catalog suite (2,309
tests), and both demo seed paths passed locally after the CI fixes.
- The affected inbox and native-runtime suites passed locally after
merging the upstream conformance test fix in #22854. The browser
access-denial scenarios passed three runs each for 403 and 404.
- The migration checks and 79 focused tests passed, including an
index-plan regression with 5,000 unrelated runs. The migration and query
plan were reverified after renumbering. [Full CI on
`cf52b80161`](https://github.com/paperclipai/paperclip/actions/runs/45529834793)
passed after rerunning a timed-out server shard.

## Risks

The attention feed reads retry ancestry. Long chains can increase query
cost. Task and company checks bound the traversal, and cycle detection
stops repeated visits. Providers that omit the reset time leave the card
with an unknown reset. Migration 0508 adds two indexes concurrently.
Each run-history page returns at most 100 records.

## Model Used

OpenAI Codex, GPT-6 family, with repository editing, local test
execution, and browser verification.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Scott Tong <scott@scotts-mbp-m5-max.local>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-11-24 18:33:27 -08:00

4.6 KiB
Raw Blame History

Coordinator Inbox manual test

Open Inbox Test Drive. The local board user has one launch approval. Two synthetic agents have hit the same provider account’s five-hour limit on four tasks, three failed attempts per task. The fixture uses recorded provider outcomes. No model account is needed.

Open a terminal at the root of this checkout. Paste the function below, press Return, and keep that terminal open for the walkthrough. Run each inbox_demo command there, then switch back to the browser and refresh.

inbox_demo() {
  node --import ./server/node_modules/tsx/dist/loader.mjs server/scripts/inbox-test-drive.ts "$1"
}
Step Action Expected result
1 Run inbox_demo reset and reload Needs you. One launch approval, sidebar badge 1, and Waiting · 1.
2 Open Waiting and expand View 4 tasks. Follow a run log, then go back. One usage-limit row, a retry time, four task links, agent names, and individual run links. History contains the twelve failed runs.
3 In Needs you, open the approval’s ⋯ menu and choose Archive for me. Reload. Open View → Archived and restore it from its menu. Archive it again and click Undo in the toast. Archiving clears the badge and survives reload. Restore and Undo each bring back the pending approval.
4 On the approval, choose ⋯ → Snooze for me → Tomorrow morning. Needs you is empty, the badge clears, and Waiting contains the snoozed approval and the provider limit.
5 Open Waiting. On the card with View 4 tasks, choose ⋯ → Archive for me. Once the card disappears, run inbox_demo repeat in the terminal. Open Archived and click View 5 tasks. IBX-5 Summarize test results appears in the archived group. The repeat failure leaves the group archived. Waiting shows the approval if you snoozed it in step 4.
6 Run inbox_demo one-left, open Needs you, and refresh. The episode returns as 1 task needs a retry after the usage limit. The badge is 1. Open task to retry leads to IBX-4.
7 Run inbox_demo all-recovered and refresh Needs you. The retry row clears automatically. The badge clears. In History, IBX-1 shows Work resumed because its retry succeeded. Opening IBX-1 shows Todo because the task is still open and no run is active. IBX-4 shows Task completed in History.
8 In Waiting, open the snoozed approval’s menu and choose Restore now. Go to Needs you and approve the launch plan. The approval leaves the inbox, the badge clears, and the decision appears in History.
9 Run inbox_demo reset and refresh. The original approval and four-task waiting group are ready for another pass.

The fixture commands write synthetic outcomes directly into the isolated embedded database, so refresh after running one. Actions taken in the UI update the inbox immediately. Reset targets the fixture company in this checkout’s tmp/inbox-drive database and clears the local board user’s dismissals for that company.

Test retries with an unknown reset

These commands use a separate synthetic company. Refresh the page after each command.

  1. Run inbox_demo chains and open Retry Chain Test Drive → Waiting. Expand 3 tasks hit usage limits. Each task has its own retry time and says Reset time unknown.
  2. Archive RCH-1 using its ellipsis menu. Run inbox_demo chains-repeat. Waiting still has two tasks. In View → Archived, RCH-1 now shows 4 attempts.
  3. Run inbox_demo chains-exhausted. Only RCH-1 appears in Needs you. The two other tasks remain in Waiting.
  4. Run inbox_demo chains-recovered. RCH-2 leaves Waiting automatically. RCH-3 is the only waiting card. Run inbox_demo chains to reset this example.

Restart the local server

From this checkout, with port 3917 free, run the following in a terminal and leave it open.

env -u DATABASE_URL -u DATABASE_MIGRATION_URL -u PAPERCLIP_CONFIG \
  PAPERCLIP_HOME="$PWD/tmp/inbox-drive" PAPERCLIP_INSTANCE_ID=default \
  PAPERCLIP_DISABLE_CWD_ENV_FILE=true PAPERCLIP_UI_DEV_MIDDLEWARE=true \
  PAPERCLIP_MIGRATION_AUTO_APPLY=true PAPERCLIP_OPEN_ON_LISTEN=false \
  PAPERCLIP_TELEMETRY_DISABLED=1 PAPERCLIP_DEPLOYMENT_MODE=local_trusted \
  HOST=127.0.0.1 PAPERCLIP_BIND=loopback HEARTBEAT_SCHEDULER_ENABLED=false PORT=3917 \
  pnpm --filter @paperclipai/server exec tsx watch src/index.ts