mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-22 20:29:18 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The restart chaos harness grades agent tasks across server swaps, and the staging-mix workload (#21125) is its staging-shaped load > - On a fix-PR comparison the harness clicked Retry as soon as the banner appeared (once after 11 s), which pre-empted the product's own continuation > - So the wave could not show whether a task would have continued by itself, and the banner itself went uncounted > - This pull request makes staging-mix grading hands-off by default: no Retry click during the wave or the settle, one click only after the settle, and every banner recorded > - The benefit is three honest numbers per wave: completed hands-off / started, Retry banners shown, and Retry worked / clicked ## Linked Issues or Issue Description Refs #21125, #21126, #21139. **What existing behavior does this improve?** Staging-mix Retry handling and the `done_comment_once` check in the restart chaos harness. **Subsystem affected** Test harness only: `tests/restart-chaos/`. No product code changes. **Current behavior** The observer clicks Retry as soon as a task rests with the banner, so a product continuation that would have come is never seen. A banner that heals by itself is not recorded. `done_comment_once` counts every agent comment that mentions `DONE-<nonce>`. A closing summary that quotes the marker therefore failed all 6 tasks of wave `w-20261112T174255-s7101`. The release-swap grader can click a second Retry after the observer's. **Proposed behavior** Hands-off by default. Every banner is recorded with its first-shown time, its duration and its error code. One Retry click happens only after the settle, and only for a task that is still not done and that nobody clicked. The DONE check counts only the comment whose whole body is the marker. A completion summary repeated by a different run becomes its own `completion_once` finding. **Reason and benefit** The product goal is that the Retry banner never appears and that interrupted work continues by itself. The wave now measures exactly that. ## What Changed - `staging-mix.ts`: - The observer step records the Retry banner per task (`retryBanner`: first shown, total shown time, error code). It clicks during an overlap only with the new flag `--mix-retry-during-wave`. - `isDoneComment` counts only the bare `DONE-<nonce>` comment. - `completion_once` fails when more than one run posted a comment that mentions the marker. - Comments are now collected with their run ids. - `observer.ts`: - A staging-mix task with a banner is kept under watch instead of being clicked or rested (hands-off). - `retryAfterSettle` reopens a task for the one post-settle click. - New `staging-mix-retry.ts`: - `shouldClickRetryAfterSettle` is the single click rule. It never clicks a done task, a task with a scheduled retry, or a task already clicked. - `retryAfterSettleStage` waits out the settle (new flag `--mix-settle-minutes`, default 15 after the last fault slot ends), clicks once per stuck task, and follows each click to rest. - The results module writes `staging-mix-results.json` and `staging-mix-summary.md`. Their first three lines are `completed hands-off / started`, `Retry banner shown: N tasks`, `Retry worked / Retry clicked`. Then come the banner list and one end-of-wave read of `GET /api/companies/:id/assigned-work-invariant` (`violationCount`, `violations`, `agentsWithStalledSlots`, `openTasks`). - `release-swap-finish.ts` uses the same click rule, so the swap grader never clicks a task the observer already clicked. When the release-swap cell drives the wave, the staging-mix settle stage does not run; the swap grader makes the one click. The hosted mode can import the same function. - `main.ts`: the staging-mix end-of-wave report moved into `StagingMixRun.report`. The file shrinks from 1,000 to 998 lines. - README: the Retry and results sections, the two new checks, and the local short-form command (without `--ephemeral-server`, which runs only on Daytona). ## Verification - `pnpm exec vitest run --config tests/restart-chaos/vitest.config.ts`: 59 files, 714 tests pass. - `node scripts/typecheck-test-projects.mjs tests/restart-chaos`: passes. - New tests cover: - the default and opt-in flags; - the click rule; - a settle where one task heals by itself (no click), one task gets exactly one click, and one already-clicked task gets none; - the three headline numbers, including the swap grader's clicks; - the invariant read; - the DONE count against the real comments from `w-20261112T174255-s7101` t001 (summary plus bare marker passes; a summary repeated by another run fails `completion_once`). - Not run: a live wave with this change. The Daytona image for current master is still queued. ## Risks - Low risk. Test harness only. - A hands-off task that keeps its banner now waits to its deadline before the post-settle click, so a wave with many banners runs longer. - RS1 waves on other workloads no longer get a second end-of-wave click on a task the observer already clicked. That is intended. - Known master CI failures, not touched here: the storage S3 multipart throttle test (being fixed) and the Runner native-distribution-integrity test. - `ci / Runner support suite` failed on head59b1b37870with no failing test: its log ends with "The runner has received a shutdown signal" and "The operation was canceled" (runner infrastructure). This diff touches only `tests/restart-chaos/`, which that suite does not run. - On head9907c4cdcc, six server jobs in run 43289297870 (General tests server 2, 4, 8, 11 of 12; serialized server suites 6 and 7 of 9) were cancelled the same way at 19:26Z (runner shutdown signal, then operation canceled, no test failure). They were re-run once with `gh run rerun 43289297870 --failed`. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, through Claude Code with tool use (shell, file edits). Extended reasoning was available. ## 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 - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>