mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-16 03:31:44 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Company decision models admit model calls against a budget, and the server test suite checks this admission > - The test "admits concurrent work from the same budget observation and records both obligations" fails sometimes on loaded CI runners > - Cloud readiness runs this test, and any Cloud readiness failure stops the Core image from being published > - On 2026-11-13 this test failed in Cloud readiness for two master commits and stopped image publication > - This pull request makes the test wait for the real condition instead of a 1-second poll > - The benefit is that a slow runner no longer fails the test, so the release gate does not stop on a timing flake ## Linked Issues or Issue Description No public issue exists. This is a test flake. **What happened?** The test failed in Cloud readiness "verify / General tests (server (4/10))" on master. The failure was `AssertionError: expected "vi.fn()" to be called 2 times, but got 1 times` at the second `vi.waitFor`. It happened for master commit11840f9904(run 43435593630, attempt 3, 14:03Z) and fore3faf579a1(run 43427997745, 13:00Z). The other 3661 tests in that run passed. **Expected behavior** The test passes on a slow runner. After the lock is released, both decisions commit their reservations and call the provider. On a loaded machine this can take more than 1 second. **Steps to reproduce** Run `server/src/__tests__/decision-models.test.ts` on a heavily loaded runner. The second `vi.waitFor` uses the default 1000 ms timeout. The line before it uses 3000 ms. If both provider calls do not start within 1 second of the unlock, the test fails. **Paperclip version or commit** master at6917d0568d## What Changed - The test provider mock now counts the calls that start. It resolves a promise when the second call starts. - The test awaits that promise instead of polling `toHaveBeenCalledTimes(2)` with a 1-second timeout. The test timeout still applies if the calls never start. - No product code changed. ## Verification - `cd server && npx vitest run src/__tests__/decision-models.test.ts`: 37 passed locally. - A red/green proof is not practical. The failure depends on runner load, and the old code passes on an idle machine. The new code has no timer between the unlock and the check, so it cannot time out early. ## Risks - Low risk. This is a test-only change. - If a regression stops the second provider call, the test now fails at the test timeout instead of after 1 second. The failure is still reported. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude Code with tool use (shell, GitHub CLI, AWS CLI) and extended reasoning. ## 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 - [ ] I have updated relevant documentation to reflect my changes (not applicable: test-only) - [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>