mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 11:47:42 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Image publication requires source verification for the same commit. > - The maintenance suite checks work committed during an idle drain. > - Managed channel pools batch change notifications for 50 ms. > - The test API helper freezes the child clock when a response ends. > - A notification can then retain its work token while its timer cannot fire. > - This change advances the existing test clock before measuring quiet drain. ## Linked Issues or Issue Description Refs #23415 and #22523. **What happened?** [Source verification failed](https://github.com/paperclipai/paperclip/actions/runs/46783252165/job/143126872561) in `maintenance-server-routes.test.ts`. The case `processes the first ordinary external-object producer committed during idle drain and becomes quiet again` timed out with one tracked work token. The image watcher then canceled [Docker publication](https://github.com/paperclipai/paperclip/actions/runs/46783252123). The issue write notifies the managed channel pool worker. That worker batches notifications for 50 ms. The API helper freezes the child clock after the response. The test then waits for quiet without advancing that timer. Response timing determines whether the worker finishes first. **Expected behavior** The test must let bounded change notifications finish their drain reconciliation. It must still prove that provider work does not start during drain, that the database stays quiet across the measured drain windows, and that deferred work resumes afterward. **Steps to reproduce** Run `pnpm exec vitest run server/src/__tests__/maintenance-server-routes.test.ts -t 'processes the first ordinary external-object producer'` with the required local runtime outputs prepared. The unchanged test failed locally with `idle.active: 1` and no pending database request. Temporary local tracing identified the retained token at the managed-channel-pool notification in `notifyIssueRecovery`. That tracing is not part of this change. ## What Changed - Use the existing bounded `settleClock` helper after the held producer request completes. - Keep the existing provider-request, quiet-window, restart, and retry assertions. ## Verification - Red: the unchanged case failed locally with the same 30-second settling timeout as CI. A second diagnostic run identified the coalesced managed-channel-pool token. - Green: the final focused case passed in 24.82 seconds on Node 24.23.0 with pnpm 9.15.4 and embedded PostgreSQL 18.1. - The complete maintenance file passed on `58ccfb513f7`: 17/17 cases in 246.23 seconds. The subsequent change only removes the added comment; the focused case was rerun after that cleanup. Command: `pnpm exec vitest run server/src/__tests__/maintenance-server-routes.test.ts`. This includes the real idle windows, committed-during-drain producer, provider-error retry, shutdown recovery, and signed warm-claim cases. - `pnpm verify --base origin/master` selected 1,993 of 2,353 test files. I interrupted that broad local run and ran the complete maintenance file above. Required CI supplies broad verification. - CI attempt 1 on `f2a83ce4ba4` lost the runners for [General tests (server 6/20)](https://github.com/paperclipai/paperclip/actions/runs/46788843123/job/143146044550) and [serialized suites (9/9)](https://github.com/paperclipai/paperclip/actions/runs/46788843123/job/143146044125). Both job logs report a runner shutdown at 01:40:57 UTC, followed by cancellation. These interrupted jobs are not passes. The existing first-attempt runner-loss workflow retries after the parent CI run completes, if no other job has a source failure. - [CI attempt 2](https://github.com/paperclipai/paperclip/actions/runs/46788843123/attempts/2) passed on final head `f2a83ce4ba44e639902ae57db1aba233562e3293`. Both interrupted jobs passed on retry. No failed or pending checks remain among the 72 reported checks; applicable checks passed and optional lanes were skipped. Greptile scored this head 5/5 with no unresolved review threads. Source verification and image publication checks remain enabled. ## Risks The change affects one test. It uses the suite's existing bounded clock-settling helper. The drain assertions still reject provider work and database polling in the measured windows. No production source, timeout, schema, or deployment setting changes. ## Model Used - OpenAI `gpt-6.1-sol` through Codex in T3 Code, with xhigh reasoning, repository tools, shell commands, and local test execution. ## 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: Paperclip <noreply@paperclip.ing>