feat(assertions): consolidate candidate judgment into root judge command#3138
Conversation
External GPT-Pro delivery ann-04 (37t.12 + mrxt + 41ow), applied verbatim at its declared authority snapshot 536a53e before rebase. Core fix: reserve the SQLite writer slot before reading existing judgment state (BEGIN IMMEDIATE standalone; SAVEPOINT + zero-row write upgrade when nested), with a real two-connection race regression proving an automated replay cannot silently revert an operator acceptance. Ref polylogue-41ow Co-Authored-By: GPT-Pro external agent <noreply@openai.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ
Problem: rebasing feature/assertions/judgment-transaction onto current master auto-merged cleanly at the text level but left a real defect: the branch's own SAVEPOINT+zero-row-write mechanism (_assertion_write_transaction/ _judge_assertion_candidate_locked/_configure_assertion_write_connection) survived alongside master's already-merged, independently-implemented _immediate_user_write_transaction (polylogue-41ow, PR #3101) wrapping judge_assertion_candidate in two redundant transaction layers. The branch's own TOCTOU regression test duplicated master's existing test_cross_connection_replay_inside_caller_owned_deferred_transaction_ cannot_resurrect_operator_accept coverage for the same race. What changed: - user_write.py: removed the redundant mechanism entirely; judge_assertion_ candidate now matches master's single-layer shape exactly (byte-identical diff against origin/master for this file). Kept the delivery's genuinely new test_upsert_assertion_owned_transaction_rolls_back_on_write_failure (no equivalent coverage existed on master); dropped the redundant TOCTOU race test plus its now-unused `time` import. - Fixed 5 mypy errors surfaced by the rebase (missing return type annotations, Literal-narrowing losses in two test fixtures) and one degrade-loudly finding (assertion_candidate_queue_status_summary's except handler needed a log call, not just an embedded caveat string). - Fixed one query_shape doc string (`--list|--accept|...`) that the doc-commands verifier corrupted via markdown pipe-escaping into a bogus `--list\` flag token; rewrote without literal `|` in the flag list. - Regenerated docs/cli-reference.md and docs/product/workflows.md. Verification: devtools verify --quick (lint+mypy+render, green); the full delivery-affected test sweep (api/cli/product/storage/daemon, 793/794 passed — the one failure, test_should_use_plain_contract[False-1-True-True], reproduces identically on clean origin/master via a scratch worktree, confirmed pre-existing and unrelated).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 19 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (31)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR #3138 merged. Lane-g hardening-sweep follow-up (2o3d/0puw/qs0a) complete. Ref polylogue-2o3d
…lution deliveries Ref polylogue-41ow, polylogue-fd2s, polylogue-9gh1, polylogue-2o3d Problem: two files staged at /realm/tmp/gpt-pro-intake-0719/ (judgment-*.md/.diff, config-*.md/.diff) were flagged as fresh wave-2 deliveries needing triage, targeting snapshot 536a53e (#3046). Master has since moved ~180 commits including 33 merges. Solution: verified pairing first (judgment-* files cross-reference polylogue-41ow/37t.12/mrxt and match mission ann-04; config-* files cross-reference polylogue-fd2s/9gh1 and match mission misc-01). SHA-256 of every file was then found byte-identical to the already-recorded results/ann-04/r01 and results/misc-01/r01 packages -- these are not new deliveries, they are exact re-submissions of packages already triaged 2026-07-18. Re-verified git apply --check against both the stated snapshot (passes cleanly for both) and current origin/master (fails on every production file for both -- confirms drift). Cross-referenced current source against each package's claims: - ann-04 (judgment-transaction): bd polylogue-41ow (closed, PR #3101+#3110) independently fixed the writer-slot TOCTOU race; bd polylogue-2o3d (closed, PR #3138) independently ported the delivery's entire additive scope (evidence previews, queue health, judge consolidation, capture idempotency) after its own line-by-line audit. Supersession is now total, not partial as r01 judged it before those PRs landed. Recorded as r02 (state=superseded). - misc-01 (config-resolution-closure): PR #3079 (merged 2026-07-18, explicitly sourced from an earlier revision of this same packet family) already shipped ResolvedRuntimeConfig/single-resolver/archive_root-fix. Live-checked polylogue/config.py:1514 -- deep-merge for nested health tables (polylogue-cxlk) is already landed. Genuine residual found: uu8r-scope env-bypass migrations (daemon/backup.py, pipeline/services/archive_ingest.py, and ~5-6 more files this delivery's own bypass-caller table names) are still unmigrated on current master, but must be re-derived against the already-landed config API rather than applying this patch's hunks (no shared ancestor). Recorded as r02 (state=superseded, with residual noted for polylogue-uu8r). Verification: sha256sum on all 8 delivered files cross-checked against existing r01 records (identical); git apply --check run against both 536a53e (clean) and origin/master e963e87 (fails, 20-73 files per patch); bd show on polylogue-41ow/fd2s/9gh1/cxlk/uu8r/2o3d to confirm current close/open state and what each merged PR actually covers; grep -rl ResolvedRuntimeConfig and read of _merge_toml/_deep_merge_table in polylogue/config.py to confirm the architecture is live, not just claimed. Triage notes appended to polylogue-41ow and polylogue-fd2s via bd update --append-notes. No patch was applied to master; no bead was closed or reopened by this change. Co-Authored-By: Claude <noreply@anthropic.com>
… deliveries Ref polylogue-41ow, polylogue-fd2s, polylogue-9gh1, polylogue-2o3d Problem: two files staged at /realm/tmp/gpt-pro-intake-0719/ (judgment-*.md/.diff, config-*.md/.diff) were flagged as fresh wave-2 deliveries needing triage, targeting snapshot 536a53e (#3046). Master has since moved ~180 commits including 33 merges. Solution: verified pairing first (judgment-* files cross-reference polylogue-41ow/37t.12/mrxt and match mission ann-04; config-* files cross-reference polylogue-fd2s/9gh1 and match mission misc-01). SHA-256 of every file was then found byte-identical to the already-recorded results/ann-04/r01 and results/misc-01/r01 packages -- these are not new deliveries, they are exact re-submissions of packages already triaged 2026-07-18. Per results/README.md custody policy ("Duplicated browser downloads with identical SHA-256 values are deliberately not copied twice", precedent: lin-01/r01), this revision does NOT mint a second package-revision identity (r02) or duplicate the raw/extracted artifact bytes. Instead the 2026-07-20 reassessment is recorded as a dated `reassessments` entry inside each existing r01 receipt.json, alongside an updated top-level `state` where the evidence changed: - ann-04/r01: state needs_rebase_review -> superseded. bd polylogue-41ow (closed, PR #3101+#3110) independently fixed the writer-slot TOCTOU race; bd polylogue-2o3d (closed, PR #3138) independently ported the delivery's entire additive scope (evidence previews, queue health, judge consolidation, capture idempotency) after its own line-by-line audit found the MCP-surface hunks obsolete (six-tool cutover) and the delivery's transaction mechanism redundant with #3101. Supersession is now total, not partial as originally judged before those PRs landed. - misc-01/r01: state stays superseded, rationale now explicit. PR #3079 (merged 2026-07-18, sourced from an earlier revision of this same packet family) already shipped ResolvedRuntimeConfig/single-resolver/ archive_root-fix/deep-merge. There is no viable rebase target for this patch against the current config API -- #3079 shipped a differently shaped ResolvedRuntimeConfig with no common ancestor, so any further work must be re-derived, not revived from this diff. The genuine residual (uu8r-scope env-bypass migrations, e.g. daemon/backup.py, pipeline/services/archive_ingest.py, still unmigrated on master) is tracked durably as polylogue-uu8r directly, not as a pending state on this package. Re-verified git apply --check against both the stated snapshot (passes cleanly for both) and current origin/master, checked twice: once at the original triage base (e963e87) and again after rebasing onto the latest tip (1c0f4ec, three commits later -- #3175 CLI onboarding convergence plus two beads-filing commits, none touching the affected files). Both patches fail identically both times. Verification: sha256sum on all 8 delivered files cross-checked against existing r01 records (identical); git apply --check as above; bd show on polylogue-41ow/fd2s/9gh1/cxlk/uu8r/2o3d to confirm current close/open state and what each merged PR actually covers; grep -rl ResolvedRuntimeConfig and read of _merge_toml/_deep_merge_table in polylogue/config.py to confirm the architecture is live, not just claimed; devtools verify --quick 16/16 green (pre-push hook). Triage notes appended to polylogue-41ow and polylogue-fd2s via bd update --append-notes, including a correction note for the earlier (superseded) r02 framing. No patch was applied to master; no bead was closed or reopened by this change. Co-Authored-By: Claude <noreply@anthropic.com>
…lution deliveries (#3177) ## Summary Re-triages two ChatGPT-Pro handoff packages staged at `/realm/tmp/gpt-pro-intake-0719/` (`judgment-*.md/.diff`, `config-*.md/.diff`), targeting snapshot `536a53efac0cbe4a2473ad379e4db49ef3fce74d` (#3046). Both are byte-identical duplicate downloads of packages already on file as `results/ann-04/r01` and `results/misc-01/r01`. Per the custody policy (`results/README.md`: "Duplicated browser downloads with identical SHA-256 values are deliberately not copied twice", precedent: `lin-01/r01`), this PR does **not** mint a second package-revision identity or duplicate raw/extracted artifact bytes — it records the 2026-07-20 reassessment as a dated `reassessments` entry inside each existing `r01` receipt, with the top-level `state` updated where the evidence changed. No patch is applied to master; no bead is closed or reopened. ## Problem Both files were flagged as fresh wave-2 deliveries needing triage. Master has moved ~180 commits (33+ merges) past the stated snapshot. ## Solution **Pairing verification (step 0):** `judgment-*` files cross-reference polylogue-41ow/37t.12/mrxt and match mission `ann-04-judgment-transaction`; `config-*` files cross-reference polylogue-fd2s/9gh1 and match mission `misc-01-config-closure`. The mapping was correct as staged. **Commission identification (step 1):** both missions already have `r01` result entries on disk. SHA-256 of every one of the 8 delivered files is byte-identical to the corresponding `results/ann-04/r01` and `results/misc-01/r01` artifacts (`diff -q` reports no differences) — these are re-submissions of packages already triaged 2026-07-18, not new deliveries. **Triage (step 2), recorded as `reassessments` entries in the existing `r01` receipts:** - `git apply --check` passes cleanly for both patches against the stated snapshot (integrity confirmed) and fails for both against current `origin/master`, re-checked three times as master advanced during triage (`e963e87f5` → `1c0f4eccd` → `610ce8d9`, none of the intervening commits touch the affected core files). - **ann-04 (judgment-transaction): `r01` state `needs_rebase_review` → `superseded`.** bd `polylogue-41ow` (closed, PR #3101+#3110) independently fixed the writer-slot TOCTOU race; bd `polylogue-2o3d` (closed, PR #3138) independently ported the delivery's entire non-overlapping additive scope (evidence previews, queue health, judge-command consolidation, capture idempotency) after its own line-by-line audit found the MCP-surface hunks obsolete (six-tool cutover) and the delivery's transaction mechanism redundant with #3101. Supersession is now total — every acceptance-matrix row this delivery claims already has an independent, merged, adjudicated master implementation. - **misc-01 (config-resolution-closure): `r01` state stays `superseded`, rationale now explicit.** PR #3079 (merged 2026-07-18, explicitly sourced from an earlier revision of this same GPT-Pro packet family) already shipped `ResolvedRuntimeConfig`, the single resolver, the `archive_root` TOML fix, and deep-merge for nested health tables (live-checked `polylogue/config.py:1514` `_merge_toml`/`_deep_merge_table`). `needs_rebase_review` does not apply here: there is no viable rebase target for this patch against the current config API — #3079 shipped a differently-shaped `ResolvedRuntimeConfig` with no common ancestor, so any further work must be **re-derived against the landed API, not revived** from this diff. The genuine residual (bd `polylogue-uu8r`'s env-bypass migration scope — spot-checked `polylogue/daemon/backup.py:695` and `polylogue/pipeline/services/archive_ingest.py:48`, both still direct `os.environ.get()` reads on master) is tracked durably as `polylogue-uu8r` directly, not as a pending state on this package. Also noted, out of scope for this PR: `polylogue-fd2s`/`polylogue-9gh1` still read `status=open` in `bd` despite #3079's landing — likely bookkeeping lag, flagged in the bead notes for a separate housekeeping pass. A stray `clipboard-current.txt` in the intake directory is unrelated leftover clipboard text for the already-integrated `mandate-01` delivery (same SHA as `results/mandate-01/r01`, PR #3088, merged) — not part of either package, not touched by this PR. ## Verification - `sha256sum` on all 8 delivered files, cross-checked against existing `r01` records: identical. - `git apply --check` against `536a53efac0cbe4a2473ad379e4db49ef3fce74d`: clean for both patches (detached worktree). - `git apply --check` against `origin/master`, checked at `e963e87f5`, `1c0f4eccd`, and `610ce8d9` as master advanced during triage: fails identically every time (20 production files for judgment, 21 for config; some judgment files/tests no longer exist post six-tool MCP cutover). - `bd show polylogue-41ow/fd2s/9gh1/cxlk/uu8r/2o3d --json` to confirm current close/open state and what each merged PR actually covers. - `grep -rl ResolvedRuntimeConfig polylogue/` plus a read of `polylogue/config.py:1514` (`_merge_toml`/`_deep_merge_table`) to confirm the architecture is live on master, not just claimed by a PR title. - `devtools verify --quick`: 16/16 green (pre-push hook, this branch, each push). - Triage notes appended to `polylogue-41ow` and `polylogue-fd2s` (plus a correction note on both retracting the earlier, policy-violating `r02` framing) via `bd update --append-notes` + `bd export`. Ref polylogue-41ow, polylogue-fd2s, polylogue-9gh1, polylogue-2o3d Co-authored-by: Claude <noreply@anthropic.com>
Summary
Ports the remaining additive components of the parked ann-04 delivery
(
feature/assertions/judgment-transaction) that were not alreadyindependently absorbed by prior lane-g work — bounded evidence previews
shared by CLI+API, a non-destructive judgment-queue health surface, and
actor-scoped terminal-capture idempotency — and consolidates candidate
assertion review from the
mark candidatessubcommand group into theexisting root
judgecommand.Problem
polylogue-2o3d tracked ~1700 lines of a stale (base
536a53efa, ~20commits behind at rebase time) delivery branch: bounded evidence previews
for CLI/MCP, queue health in judge/status, mark-candidates dedup,
actor-scoped capture idempotency, and an operator canary route. A prior
lane-g investigation (2026-07-18) determined most of the delivery's
mechanism-adjacent diff was either obsolete (MCP-surface hunks, retired by
the six-tool cutover) or superseded (the writer-slot TOCTOU fix, separately
landed as polylogue-41ow / PR #3101) — leaving this scoped, real feature
surface to reconcile and land as one coherent PR.
Note on the branch's own commit message (
443f236f8): it describes thedelivery's "core fix" as the SAVEPOINT+zero-row-write transaction
mechanism. That mechanism is not in this PR — the rebase auto-merged it
alongside master's already-independently-implemented
_immediate_user_write_transaction(41ow), producing two redundanttransaction layers. This PR's first fixup commit removes the delivery's
copy entirely;
user_write.pyis now byte-identical to master except forone genuinely new test (
test_upsert_assertion_owned_transaction_rolls_ back_on_write_failure) that had no prior coverage. The actual content ofthis PR is the additive feature surface below.
Solution
judgecommand consolidation (cli/commands/judge.py,cli/query_verbs.py): themark candidates list/review/accept/reject/ defer/supersedesubcommand group is removed fromquery_verbs.py'smarkverb (239 lines, mostly deletions — confirmed relocation, notdrop, via line-by-line diff against both old and new call surfaces) and
its functionality is folded into the existing root
judgecommand,which gains
--review,--status,--defer,--supersede,--target-ref,--candidate-status,--until,--limit,--actor-ref,--replacement-kind/--body, plus an interactiveaccept/reject/defer/edit-and-accept/skip prompt flow.
polylogue judge --helpverified live.api/archive.py,surfaces/payloads.py):list_assertion_candidate_reviewsnow resolvesup to 5 evidence refs per candidate via the existing
resolve_reffacade, producing
AssertionEvidencePreviewPayloadrows (state:resolved/missing/unsupported/pending/error) with per-ref failure
isolation — one resolver exception degrades only that preview, not the
whole review (
test_one_evidence_resolution_failure_degrades_only_that_ preview).api/archive.py,daemon/status.py,cli/commands/status.py):assertion_candidate_queue_health()projectspending/status/kind/source counts, retention, and producer/scheduler
telemetry from
user.db+ops.dbinto ahealthy-empty/empty-unverified/pending/stale-pending/producer-stalled/unavailablestate, surfaced viajudge --status,daemon statusJSON, and
polylogue status.api/archive.py,cli/commands/note.py):--idempotency-keyonpolylogue notederivesa deterministic assertion id from
author_ref + key; a replay withidentical content returns the original row, a replay with different
content raises a conflict — protected by a
BEGIN IMMEDIATEreservation around the lookup-then-write so two racing replays can't
both observe absence.
mechanism and its redundant test (see note above); fixed 5 mypy errors
and one degrade-loudly finding the rebase surfaced; fixed a doc string
(
--list|--accept|...) that the doc-commands verifier corrupted viamarkdown pipe-escaping.
Verification
devtools verify --quick— green (lint + mypy --strict + render +doc-commands + degrade-loudly, all clean)
794 tests) — 793 passed, 1 pre-existing failure
(
test_should_use_plain_contract[False-1-True-True]) confirmed toreproduce identically on clean
origin/mastervia an isolated scratchworktree — unrelated, not touched by this PR
polylogue judge --help— live CLI wiring confirmed workingRef polylogue-2o3d
Ref polylogue-41ow