Repository navigation
Serialize updates to the pull request body - #1230
Conversation
Carry forward the reviewed change and tested merge resolution from #1099. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on 15878aeec12be040edd0b4195a54a474c95c5249, 37.3s: approve (0 critical, 0 important, 2 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| assert text in updated | ||
|
|
||
|
|
||
| def test_delayed_check_preserves_review_summary(wt, gh, fake_bin, capsys, monkeypatch): |
There was a problem hiding this comment.
suggestion: Regression test checks the stale-read fix but not the lock
test_delayed_check_preserves_review_summary runs review inside the patched _update_pr_checks, before the real function takes the lock. It fails on the old code, because the old code wrote back the stale pr.body read before the update. But the new code would still pass this test if the _lock_task_state call were removed from _update_pr_checks, cmd_pr or cmd_review. The fix here comes from reading the body again just before writing, so nothing tests the serialization guarantee. Smallest fix: add a test that holds _lock_task_state(wt) (or patches fcntl.flock to record calls) and asserts that each writer's pr_view/pr_for_branch read and its update_body both happen while the lock is held.
| reviews, finding threads, check statuses and merge state. CI and branch protection | ||
| reviews, finding threads, check statuses and merge state. Within a task worktree, | ||
| PR body writers lock the state directory from the live read through the update. | ||
| CI and branch protection |
There was a problem hiding this comment.
suggestion: Paragraph has an awkward line break
The new sentence leaves 'CI and branch protection' alone on a short line, with 'provide the hosted enforcement' on the next line. Reflow the paragraph so the Markdown source reads normally.
Carry the already-landed receipt rendering change from #1160 into the delta. Keep the check lookup and write under the shared lock and render from the freshly read PR when publishing. Architecture-Review: unchanged; receipt verification and serialized body updates retain their documented behavior. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 3f5a27cba2113a4fa6ccca16044f065134aa54cd, 41.3s: approve (0 critical, 0 important, 3 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
| body = "# PR\n\n## Notes\nHuman evidence.\n" | ||
| gh.respond_pr_list([pr_json(headRefOid=head, body=body)]) | ||
| git(wt, "push", "-q", "-u", "origin", "lz/t1") | ||
| refresh = cli._refresh_pr_checks |
There was a problem hiding this comment.
suggestion: Delayed-check test no longer exercises a stale read
The test now wraps _refresh_pr_checks and runs review to completion before calling the real refresh. Because of that, the refresh's pr_for_branch read always happens after the review summary has been written. The test would also pass on the pre-#1003 code, which had no lock and read the body in the same place, so it doesn't show that the lock prevents a lost update. The old version injected the delay after the PR snapshot was taken. With the read now inside flock, running review in-process at that point would deadlock, because each call to _lock_task_state opens a new file description. Smallest fix: keep this test as an ordering smoke test. Separately, add a test that holds _lock_task_state from a thread or subprocess and checks that _refresh_existing_pr_checks doesn't call pr_for_branch until the lock is released. Another option is to assert that github.pr_for_branch is called while the lock is held.
| if loaded is None: | ||
| return "(no `loopzero check` run recorded)" | ||
| recorded, results = loaded.head, loaded.results | ||
| lines = [f"Recorded for `{recorded[:12]}`" + ("" if recorded == head else " (not current head)")] |
There was a problem hiding this comment.
suggestion: Stale-head receipts get two annotations
_check_report_matches already requires report.head == head. So a receipt for an older head gets both suffixes: "Recorded for abc… (not current head) (unverified, run loopzero check)". Fix: add "unverified" only when recorded == head, or merge both into a single suffix.
|
|
||
| def cmd_pr(args: argparse.Namespace) -> int: | ||
| wt, config = _context(args) | ||
| wt, config = _context(args, pin_checks=True) |
There was a problem hiding this comment.
suggestion: Receipt-verification and check-pinning changes are outside this task's scope
The task is about serializing PR body updates under the task-state lock. This delta also changes how cmd_pr behaves for users. It switches to pin_checks=True, which can print "checks are unpinned because --config was provided" and reads the base workflow. It also adds an "unverified" marker to the generated Validation block. Both changes look reasonable, but they aren't in the acceptance criteria or the PR description, which makes the change harder to review and to revert. Fix: list them in the PR body, or move them to their own PR. Also, github.PR.body is always a str (github.py:101, :537), so the new pr.body or "" guards at lines 530, 676 and 696 do nothing. Line 697 still uses live.body.replace without the guard, so the code is inconsistent. Remove the guards.
…-pr-body-replacement
|
Owner queue route: the full sandboxed check passed on |
|
@Mergifyio queue |
❌ Left the queue ·
|
|
No description provided. |
|
Mergify candidate #1273 failed the source size budget at 7,514 lines against the 7,500 cap. The exact source head passed the installed b0ab7dd check and both required hosted checks. The current clean integration tree still measures 7,514 source lines. Requeue after the owner-approved cap update in #1272 lands. |
…-pr-body-replacement
|
Owner queue route: |
|
@Mergifyio queue |
✅ Merged into
|
Preserve review summaries when check refreshes a PR
Context and goal
Closes #1003
Acceptance
Notes
Use the existing task state directory for the lock. Keep check execution, reviewer dispatch, and Git push outside the lock.
Supersedes #1099 and carries its reviewed diff plus the conflict resolution tested at e935bf9.
Base
main @ e2a56e2
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review