Skip to content

Inbox Reviews: server index of review threads - #2629

Merged
backnotprop merged 6 commits into
mainfrom
feat/inbox-reviews-index
Nov 5, 2026
Merged

backnotprop merged 6 commits into
mainfrom
feat/inbox-reviews-index

Conversation

@backnotprop

@backnotprop backnotprop commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

This is PR 2 of about 7 for the approved Inbox Reviews page (DESIGN "Estimate", item 2, "Server index"). It adds the server side only. There is no UI yet.

What it adds:

  • A per-thread review index. It covers every thread where an agent sent a review card, whatever started the thread. For each one it records the first and latest review message, the round, the latest verdict, the person's latest answer, the guide's source (kind, repo, branch, base, PR) and the last update. The index is built from the messages on read. Nothing is stored and nothing is rewritten.

  • Whose move, using the verdict. A review waiting on the person is On you. Once the latest review has a verdict, the verdict decides, whatever chat follows it. Changes requested is With your agents. An approval is Ready to land, unless the forge still holds the person's own PR. A teammate's PR is never Ready to land. This fixes the audit finding that an approved linked PR stays On you.

  • GET /api/inbox/reviews. It returns:

    • one row per review thread (the same thread, never a copy) with the PRs it owns;
    • a row for each PR handed to an agent whose review has not arrived yet;
    • a row for each listed PR, flagged as not reviewed.

    A thread owns a PR the person handed it, or a PR its review is of. A review is of a PR when its source names the PR, or when it reviews the head branch of the person's own PR: not a fork and not a long-lived branch like main. A PR only mentioned in the thread stays its own row. A thread whose PRs all merged leaves Reviews, until a review newer than the merge arrives. An archived thread leaves Reviews until a newer review brings it back. While Code review is off, the endpoint refuses before any git, gh or glab runs.

  • An optional source field on review guide refs. Older reviews get their source from their snapshot when the index reads them.

The docs are in server-and-storage.md (the API table) and inbox-files-and-guides.md ("Reviews").

Tests: packages/core/inbox-reviews.test.ts, packages/server/inbox-reviews.test.ts.

Follow-up (not in this PR, and it must land before the Reviews page PR): the PR list does not read closed PRs, and it reads merged PRs for only 14 days. After that, a thread whose PR landed no longer sees the PR and reads as a local review again. The fix is to record "landed" with the owner link.

Adds the per-thread review index (every thread with a review card: first
and latest review message, round, latest verdict, the guide's source,
updated time), a verdict-aware whose-move rule, and GET /api/inbox/reviews,
which lists review threads merged with the PRs they own plus listed PRs
flagged as not reviewed. Refused before any git/gh/glab runs while Code
review is off. Review guide refs gain an optional source field; older
reviews read it from their snapshot on read. No UI yet.
…ed and mentioned PRs

- A review sent after the archive brings the thread back to Reviews.
- Once the latest review has a verdict, the verdict decides whatever chat follows.
- A thread whose PRs all merged or closed leaves Reviews (the list's merged PRs).
- A URL link claims a PR only when the thread's review is of it (source PR, or
  its branch is the PR's head); an owner link always does.
- A verdict on an earlier review card no longer answers the newest.
- The source cache holds only the indexed threads' latest reviews, so no blob
  is read twice.
Tests for each, and for a deleted thread leaving Reviews.
…h only on the person's own PR

- A thread whose PRs all merged leaves Reviews only while its latest review
  is no newer than the latest merge; round 2 after the merge is listed.
- inboxReviewIsOf matches a review to a PR by branch only for the person's
  own PR, from the repository itself (not a fork), never a long-lived branch
  (INBOX_PULL_LONG_LIVED, now exported from inbox-pulls).
Failing-first tests for each (A, B1, B2, the branch rule).
# Conflicts:
#	docs/agent-guides/server-and-storage.md
#	packages/core/inbox-pulls.ts
#	packages/server/inbox.ts
@backnotprop backnotprop added the ci:full Run the heavy CI tier on this PR (added by the merge script) label Nov 5, 2026
@backnotprop
backnotprop merged commit f0ce068 into main Nov 5, 2026
115 of 117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Run the heavy CI tier on this PR (added by the merge script)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant