Files
PaperClipAI/server
DottaandClaude Opus 5.5 1480f716c9 test(recovery): pin the 7-day window for chat setup failures; reattach listSuspects docs (#23063)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The assigned-work sweep now continues a blocked chat-channel task
whose latest run failed in setup before provider work (#23059)
> - Review on #23059 left three non-blocking points: the 7-day run-age
limit had no test, the `listSuspects` doc comment was separated from its
function, and the rule has SQL and TypeScript twins
> - This pull request adds the missing boundary test and restores the
doc placement
> - The benefit is that widening or removing the age limit now fails a
test, and the code reads as it did

## Linked Issues or Issue Description

Refs #23059, #23051

**Describe the bug**
Review follow-up, no user-visible bug. The 7-day limit on how old a
setup failure may be for a chat task to continue automatically had no
test, so a regression that widened or removed it would pass. The
`listSuspects` doc comment was split from `listSuspects` by a new
helper.

**Steps to reproduce**
1. Remove the run-age condition from `latestRunFailedBeforeProviderWork`
and `chatFailedBeforeProviderWork`.
2. The existing tests still pass.

**Expected behavior**
A test fails when the 7-day limit is removed.

## What Changed

- `assigned-work-invariant.test.ts`: a recently blocked chat task whose
setup failure ended 8 days ago is not a sweep suspect and is judged a
conversation wait. The test helper takes an optional `blockedAgoMs` so
the block can be recent while the run is old.
- `assigned-work-sweep.ts`: the `listSuspects` pre-filter doc comment
sits directly on `listSuspects` again; the SQL predicate's comment names
its TypeScript twin and the test that covers both.

## Verification

- `assigned-work-invariant.test.ts`: 35/35 pass. With the age condition
removed from both twins, the chat setup-failure test fails (checked),
then passes again with it restored.
- Server typecheck is clean.

## Risks

- Test and comment changes only; no behavior change.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and
code execution.

## 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
- [ ] 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 17:21:06 +00:00
..