mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-16 11:59:26 +01:00
> [!NOTE] > Opened by Prospector's automated issue-fix pipeline. A maintainer reviews and decides; nothing here merges on its own. > [!WARNING] > This change crosses a trust boundary. See Risks. ## Thinking Path - Issue #20116 reports a defect in paperclipai/paperclip. - Root cause, as the fixing agent read it: Cancellation awaited the lifecycle event append after cancelling the run and wakeup. An append failure rejected the stop before issue release, agent finalization, and queue advancement. - This pull request: Complete run cancellation when lifecycle event append fails ## What Changed - `server/src/services/heartbeat/run-control.ts`: Log cancellation event append failures and continue essential cleanup, matching lease-release terminalization. - `server/src/services/heartbeat/run-control-event-failure.test.ts`: Cover queued and running cancellation with an injected append failure and the real issue-release adapter. Confirmed regression failures before the fix; regression tests, neighboring tests, and final typecheck pass. ## Verification - Reproducing test(s), added in this PR: `server/src/services/heartbeat/run-control-event-failure.test.ts`, `server/src/__tests__/heartbeat-lock-release-on-reassignment.test.ts`, `server/src/services/heartbeat/run-control.test.ts` - They fail on the base commit and pass with the fix, each twice in a fresh sandbox. - 3 independent attempts wrote 3 reproductions; this fix passes every one of them. - The repository's compile command passes with the fix applied. - 9 existing test file(s) near the change passed. - The full test suite passes except for the 16 file(s) that already fail on the base commit. ## Risks - Written by an automated pipeline, not a person: review it as you would an outside contribution. - Risk tier of the touched paths: 2. - It crosses a trust boundary. Check each crossing against what the issue asked for, and against who asked: - logging (server/src/services/heartbeat/run-control.ts:1665): Logs the event-append error and run ID to the server log when cancellation event recording fails. ## Model Used - codex:gpt-6.1-sol, opus, sonnet (Anthropic Claude, via Claude Code; OpenAI, via the Codex CLI), writing and checking the change in an isolated sandbox. - opus (Anthropic Claude, via Claude Code), reviewing it independently. ## Linked Issues Fixes #20116 The reviewer found the base already handles: - A closed request socket produces a misleading PATCH 200 log that hides the failure. (server/src/middleware/logger.ts:89–91 detects aborted or unfinished responses and formats 'request aborted'; lines 150 and 157–158 log these at warn level with that message instead of the default status-based success message.) A search of paperclipai/paperclip's open and closed pull requests found no other pull request that names #20116. ## 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) - [ ] 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) - [ ] 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 - [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 - [ ] I will address all Greptile and reviewer comments before requesting merge <!-- prospector:issue-fix v1 issue=20116 base=ca34bed25797 report=e2609f9803f7cc0c --> Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com>