Files
PaperClipAI/server
DottaandClaude Opus 5.5 f78a6f5ae3 fix(github): a run that ends without its own reply links the latest response (#23111)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Each GitHub request to a review bot gets a comment that must end in
a real reply or an honest, useful notice
> - #22798 made the terminal sweep link the latest response on the same
pull request when a request's own run did not reply
> - A second path settles the same comments: when a run finishes without
a GitHub reply, the publication transport calls `failRun` with a fixed
notice
> - That path never looked for a newer response, so a thread could say
"ended without publishing" while the PR already showed a fresh review
> - This pull request gives `failRun` the same latest-response link
> - The benefit is that both settle paths agree, and readers are pointed
at the review instead of a dead-end notice

## Linked Issues or Issue Description

Refs #22798, #22672

**Describe the bug**
On a pull request the author replied "Fixed in …" on a review bot's
inline finding. The bot re-reviewed and updated the PR's main review
comment to 5/5, then a second run said no new review was needed. The
inline thread settled to "This turn ended without publishing a final
response. See the Paperclip task for details." instead of linking the
updated review.

**Steps to reproduce**
1. An inline request is answered by a run that publishes nothing on
GitHub.
2. A response for the same task and PR was published after the request
arrived.
3. The publication transport settles the run through `failRun` with the
fixed notice.

**Expected behavior**
The thread says "See the latest response" with a link to it.

## What Changed

- `server/src/services/chat-github-response-comments.ts`: for each
request of the run, `failRun` looks up the latest response published for
the task on the same pull request or issue since the request arrived
(`githubLatestTaskResponseUrl`, scoped by base thread) and links it;
otherwise it keeps the given notice.
- New test in `github-review-response-maintenance.integration.test.ts`:
an inline request whose run ends without a reply, with a newer
assessment on the same PR, settles with the link.

## Verification

- New test fails on master ("ended without publishing") and passes here.
- `github-review-response-maintenance`, `github-review-workflow`,
`github-retry-and-recovery` integration suites and the response-comment
unit tests: 99 passed. Server typecheck is clean.

## Risks

- One indexed lookup per request when a run settles without a reply; it
reuses the same query and index as the terminal sweep.

## 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-27 14:31:51 +00:00
..