mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-05 14:35:17 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Agent timers use the last checked heartbeat to set their next deadline. > - The watchdog settles a run whose source task has completed. > - Settlement advances an existing heartbeat but preserves a missing first heartbeat. > - The timer test expected an advanced heartbeat without seeding an existing one. > - This pull request seeds that timestamp from the fixture clock. > - The test can then verify that the fold advances the deadline and reschedules the coordinator. ## Linked Issues or Issue Description **What happened?** [Master source verification 47480088300](https://github.com/paperclipai/paperclip/actions/runs/47480088300/job/145548865209), on `3ecc2dffffebf5ad7af54c02ce2a96b90f141e09`, failed in `agent-timer-deadlines.test.ts`. The watchdog rescheduling case dereferenced a null `lastHeartbeatAt`. The other 87 files passed, with 1,395 tests passed. This cancelled [image run 47480088316](https://github.com/paperclipai/paperclip/actions/runs/47480088316). The fixture creates an agent with no recorded heartbeat. Watchdog settlement uses `settledHeartbeat`, which preserves null until a real heartbeat occurs. The fixture therefore did not meet the precondition for its deadline assertion. The earlier [image run 47465426560](https://github.com/paperclipai/paperclip/actions/runs/47465426560) had separate SSH fixture and human-blocker corpus failures. Those are fixed on master by #23830 and #23853. This PR addresses the remaining timer fixture failure. **Expected behavior** The case that checks an advanced heartbeat deadline must start with an existing heartbeat. It must still assert a succeeded run, a later deadline, and the coordinator's rescheduled wake. Settlement must preserve the first-heartbeat behavior. **Steps to reproduce** On master `c8ca682bf28e43d03e836de53b466809cbafb806`, run `PAPERCLIP_VITEST_RETRY=0 pnpm exec vitest run server/src/__tests__/agent-timer-deadlines.test.ts -t 'reschedules after the watchdog folds a completed source run' --maxWorkers=1`. Before this change, the test failed locally with the same null `getTime` error as CI. ## What Changed - Seed this case's prior heartbeat with the fixture's `now` before creating and folding its active run. - Retain the run settlement, later-deadline, and coordinator wake assertions. ## Verification - Red: the targeted test failed locally with retries disabled and the same null timestamp error as CI. - Green: `PAPERCLIP_VITEST_RETRY=0 pnpm exec vitest run server/src/__tests__/agent-timer-deadlines.test.ts --maxWorkers=1` passed all 54 tests with no skips. Environment: macOS, Node v25.6.1, embedded PostgreSQL. - `pnpm exec tsc --noEmit -p server/tsconfig.json` passed. - The test budget check and `git diff --check` passed. - [Greptile rated head `ef9329c36cfbbdfdcb811762e63f5896beed7f25` 5/5](https://github.com/paperclipai/paperclip/pull/23856#issuecomment-7432554160), with no actionable feedback or review threads. Final checks: 64 passed, seven skipped, no pending or failed checks. The [CI verification gate](https://github.com/paperclipai/paperclip/actions/runs/47483205676/job/145559933620) passed. GitHub reports no merge conflicts. - This suite is registered in `scripts/ci/nightly-only-suites.json`. It runs in master readiness and full verification, and ordinary PR CI omits it. The full local owner suite supplies direct coverage for this fixture change; required CI will supply the applicable typecheck, build, and regression coverage. - Final local head: `ef9329c36cfbbdfdcb811762e63f5896beed7f25`. No full local repository suite was run. - The subsequent [master verification attempt](https://github.com/paperclipai/paperclip/actions/runs/47482391206/job/145556677801) also failed in the same watchdog deadline case. That image publication attempt was cancelled. Post-merge master verification and image publication still need confirmation; no gate was bypassed. ## Risks - Low risk. One test fixture gains a prior-heartbeat timestamp. - The fixture uses its seeded clock, so it does not depend on the wall-clock date. - No application contract or documentation change is needed. ## Model Used - OpenAI `gpt-6.1-sol`, through the Codex harness in T3 Code, with xhigh reasoning effort and shell tools. The context window size is not exposed. ## 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>