Skip to content

code.review_brief rebuilds a brief stored at an older payload version - #2218

Open
zlareb1 wants to merge 4 commits into
mainfrom
fix/brief-rebuild-stale-version
Open

zlareb1 wants to merge 4 commits into
mainfrom
fix/brief-rebuild-stale-version

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Related: #2040
Related: #2046

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

code.review_brief builds a brief stored at an older payload version again on read, and stores the new one when store allows, so a PR briefed before the verdict can settle; when that build fails or notes a fallback, the stored brief is served as before, and degraded names code.review_brief: stored_brief_served.

Why

A brief stored before payload version 2 records no cap or failed read, so brief_verdict answers it unsettled with brief:v1 on every read. The point read served a stored brief exactly as built: no field rebuilt it, and store: false or a measurement consumer still read the stored row. Every merged PR briefed before version 2 could therefore never settle, and a client that acts on the verdict had no way out.

A stored brief of an older version is now treated as a miss: the read builds it through the same path as a PR that was never briefed, and the stored row is replaced (the point read takes the newest built_at). The old payload is served instead when the rebuild returns nothing, raises, or notes any fallback in its own note scope (for example a diff it could not read on a replica without the mirror, which would otherwise replace a complete stored brief with a thinner unsettled one). Its notes are dropped, and the response names stored_brief_served instead.

Scope and risk

  • Touches the stored-brief read in server/code/app/review_brief.py only.
  • The first read of each old brief pays one build, as a miss does today. A measurement consumer, which never stores, pays it on every read of an old brief until another reader stores the new one.
  • Open-PR briefs follow the same rule.

Compatibility, rollout and rollback

  • Wire: no op or field change.
  • Operator steps: none. Old briefs are rebuilt as they are read.
  • Rollback: rebuilt briefs are newer rows of the same key and stay valid.

Tests

  • test_a_brief_stored_at_an_older_payload_version_is_rebuilt_on_read: a version-1 row is rebuilt, stored at the current version and settles like a fresh build; with the diff unreadable, with the build failing, and with a ledger read before it raising, the stored brief is served with stored_brief_served and without brief_missing.
  • Hand-built stored payloads in test_code_review_brief_sections.py now carry the current version; the version-1 rationale cases force the build to fail so they still cover the fallback.

🤖 Generated with Claude Code


Note

Medium Risk
Changes cached-brief serving for all PRs still on pre-v2 payloads (extra build on first read); fallback path must not surface rebuild failures as missing briefs.

Overview
Fixes merged PR review briefs that stayed unsettled forever when cached at payload v < 2 (brief:v<n>), because older stored rows never recorded caps or failed reads and were served unchanged.

On read, _payload_for in review_brief.py now treats an outdated stored brief like a miss: it calls a new _build helper to rebuild (and replace the row when store allows). A successful clean rebuild returns the fresh brief; if rebuild fails or records degradations (unreadable diff, etc.), the old payload is still returned as precomputed, with degraded noting code.review_brief: stored_brief_served and rebuild-time notes suppressed via degradations.scoped().

Docs in history-and-prs.md describe the new read path. Tests cover happy-path rebuild plus fallback when diff, build, or ledger reads fail.

Reviewed by Cursor Bugbot for commit 2d525c7. Bugbot is set up for automated code reviews on this repo. Configure here.

A brief stored before payload version 2 records no cap or failed read, so
brief_verdict answers it unsettled with brief:v1 on every read, and the point
read served it as stored with no way to refresh it. A read now treats it as a
miss: the brief is built again and stored when the caller's store flag allows.
When that build cannot run, the stored brief is served as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Building Building Preview Dec 5, 2026 6:41am UTC
loom-telemetry Ready Ready Preview Dec 5, 2026 6:41am UTC

Request Review

zlareb1 and others added 3 commits December 5, 2026 06:30
… in degraded

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant