Files
PaperClipAI/server
DottaandClaude Opus 5.5 397f163c7f fix(issues): show tasks held by a resolved no-replay hold as Blocked (#22215)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for work
> - Agents can schedule a follow-up check (a monitor) on a task. The task then shows as "Monitoring" until the check is due.
> - A failed run can leave a recovery record that blocks replay of its work. The record can have the status `resolved` and still block, because its evidence keeps `automaticRecovery.replay = "blocked"`.
> - Wake admission treats that record as a hold. It refuses every wake for the task, including the due monitor check, and records the skip with `execution_reconciliation_required`.
> - The task display status counts only `active` and `escalated` recovery records. Thus the task shows "Monitoring" with an overdue check, not "Blocked". The board does not see that a person must act. Agents re-arm the check, and the check stays overdue for days.
> - This pull request makes the display status show these held tasks as "Blocked". It uses the part of the wake-admission hold predicate that is always effective and cheap to query.
> - The benefit is that a task whose wakes are held shows as "Blocked" in the list, in search, in counts and in summaries, and the person who must act can find it.

## Linked Issues or Issue Description

(B) No issue exists. Bug report:

**What happened?**
Scheduled follow-up checks on agent tasks stayed overdue for many days. Each due check was skipped with the reason `execution_reconciliation_required`. One skip record had more than 25,000 merged attempts. The tasks did not show as "Blocked". They showed as "Monitoring" (or as in progress) with an overdue check. Agents re-armed the check, but the check never started.

**What did you expect to happen?**
When wake admission holds a task, the task shows as "Blocked", so a person can see it and use the recovery controls.

**Steps to reproduce**
1. Give an agent an `in_progress` task with a monitor.
2. Add a recovery record for the task with status `resolved`, a reconciliation cause (for example `provider_failure_meaning_unverified`) and evidence `automaticRecovery.replay = "blocked"`.
3. Read the task. `getExecutionBlocker` returns the hold and wake admission refuses the monitor wake.
4. See that `displayStatus` is `monitoring`, not `blocked`.

**Paperclip version or commit**
`master` at 8282d386da.

Related open PRs: #14590 and #14156 change how no-replay holds are released. This PR does not change hold release. It only makes the held task visible.

## What Changed

- `server/src/services/issue-display-status.ts`: An agent task with lifecycle status `in_progress` now shows `blocked` when it has a recovery record with these properties:
  - The cause is a reconciliation cause other than `legacy_execution_requires_reconciliation`.
  - The evidence has `automaticRecovery.replay = "blocked"`.
  - The evidence does not have the legacy workspace-restore schema.
  - The task is not a conversation.
- For these records, `executionBlockerPredicate` is always true and `restoreHoldReleasedForCurrentOwnerPredicate` is always false. Thus "Blocked" never shows for a task that wake admission would wake. The exceptions of the full predicate apply only to legacy holds, legacy workspace-restore holds and conversation boundaries. Those keep their current display.
- The full admission predicate is not used in the projection. I tried it first, and list queries became 3 to 4 times slower, because every list, search and count query includes this projection.
- `server/src/__tests__/issue-display-status.test.ts`: New regression test. It also checks that `getExecutionBlocker` agrees with the display status before and after the hold allows replay.

## Verification

- Failing before the fix: `pnpm --dir server exec vitest run src/__tests__/issue-display-status.test.ts`. The new test "shows an overdue monitor behind a resolved no-replay execution hold as Blocked, not Monitoring" failed with `AssertionError: expected 'monitoring' to be 'blocked'`.
- Passing after the fix: the same command. 21 of 21 tests pass.
- Affected suites: `vitest run` on `issue-display-status`, `issue-summaries-routes`, `blocked-inbox-review-wait-scope`, `company-search-service`, `issues-service`, `issue-list-assignee-filter-routes`, `status-cards` and `heartbeat-issue-liveness-escalation`. 8 files, 361 tests pass.
- List cost: a local probe (40 `issueService.list` calls) measured about the same time per call as `master`.
- Typecheck: `pnpm --dir server typecheck` (all layers) passes.
- Not run locally: the full `pnpm verify` selection (2,923 files). CI runs it.

## Risks

- Behavior change: more agent tasks can show as "Blocked". This occurs only when wake admission already refuses their wakes. The task lifecycle status, locks and recovery records do not change. This change does not write data.
- Query cost: the display status adds one small `EXISTS` subquery on `issue_recovery_actions` by company and source task. It runs only for agent tasks that are `in_progress` with no queued or running run and no active recovery record.
- Coverage: tasks held by a resolved legacy reconciliation hold, or by a legacy workspace-restore hold, still show their current status. Their release rules need run-level checks that are too costly for this projection.
- `in_review` and other lifecycle statuses keep their current display.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), with tool use (shell, file edit, test runs).

## 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
- [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>
2026-11-18 15:27:05 -06:00
..