Files
PaperClipAI/server
7bd424d50f fix(issues): preserve PATCH result when unblock wake fails (#20425)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The issue API commits status changes before it sends some follow-up
notifications.
> - A blocked transition can therefore commit before the control plane
wakes the named unblock owner.
> - A wake failure currently escapes the route and changes the HTTP
response to 500.
> - The client then sees a failure even though the issue is already
blocked.
> - This pull request contains failures from that post-commit
notification path.
> - The benefit is an HTTP result that stays consistent with the
committed issue update.

## Linked Issues or Issue Description

Refs #3824

Related pull request: #19209

The related pull request maps a routine-slot constraint to HTTP 409.
This change covers a different boundary. The target issue update has
already committed when the unblock notification starts. The route must
not replace that successful result with a notification error.

## What Changed

- Catch wake and delivery-marker failures in the unblock notification
helper.
- Log the post-commit notification failure at the route boundary.
- Persist `blockedOwnerNotifiedAt` only after the wake succeeds.
- Keep the marker empty when delivery fails so a later attempt can use
the same idempotency key.
- Add regression tests for wake failures and marker failures.

## Verification

- Before the service change, the two new failure tests rejected with
their injected errors.
- `HOST=127.0.0.1 node_modules/.bin/vitest run
server/src/__tests__/routable-blocked.test.ts` passes 5 tests.
- `HOST=127.0.0.1 node_modules/.bin/vitest run
server/src/__tests__/routable-blocked.test.ts
server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts`
passes 233 tests. This includes HTTP PATCH regressions for wake and
marker-write failures.
- `pnpm --filter @paperclipai/plugin-sdk build` passes.
- `git diff --check` passes.

## Risks

- Risk is low. This change does not add a migration or change the issue
transaction.
- A failed notification no longer changes the PATCH result. The route
emits a warning with the issue and owner context.
- A failed notification keeps `blockedOwnerNotifiedAt` empty. The
existing idempotency key limits duplicate wake delivery during a later
attempt.

> This is a focused bug fix. It does not duplicate planned roadmap work.

## Model Used

- OpenAI Codex with GPT-5, extended reasoning, tool use, and code
execution. The context window size was not exposed to the agent.

## 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 (no
documentation change is needed for this internal error path)
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green (59 checks on `21ad144`: 56
success, 3 skipped, 0 failures; `ci / verify`, `ci / e2e`, and `review`
passed)
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
(`Greptile Review` success on `21ad144`; 0 open review threads)
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Builder <builder@nublo.net>
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-12-05 03:58:35 -08:00
..