Repository navigation
fix(maintenance): correct scope previews, replay refusals, and identity transitions - #4582
Conversation
Count empty-session debt over the requested sessions instead of clamping archive-wide debt to the request size, normalize an omitted repeatable --session-id to "no narrowing", and give a refused preview an error plus a nonzero CLI exit. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz
…eplay Refuse an unsupported scope before the offline-write gate so an invalid scoped request is not reported as a retryable blocker, persist a mid-run checkpoint carrying a refusal as FAILED, and judge a resumed operation only by refusals recorded for the targets it still requests. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz
Detect catalog completeness from the tier's schema version so a valid pre-migration-011 user tier is not rejected, leave execution records pointing at the manifest they ran against, make successor creation idempotent, refuse to give a holdout cohort a second manifest identity, and enclose both durable connections in explicit transactions so no savepoint release commits one tier alone. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b97cb570c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Devtools half of the unaddressed-Codex-review sweep (26 findings verified against current master, 41 tests). Sibling PRs: #4580, #4582, #4583, #4587, #4594. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
Summary
Eleven Codex review findings against the maintenance layer (PRs #4522 and #4526), re-confirmed at this branch's base. All eleven held; none were refuted.
Findings and what changed
#4522 — planner / scope / CLI
maintenance/planner.pysetstatus=FAILEDon a scope refusal but nevererror=, andcli/commands/maintenance/_plan.pyprinted onlyresult.error, never the failure samples, and always exited 0. A refused plan read as "Affected: 0 rows", exit 0. → the refusal receipt now carrieserror; plain output prints every failure sample; a FAILED plan exits 1 in both plain and JSON modes.count_empty_sessions_syncand clamped it withmin(total_rows, len(session_ids)), while execution filters bysession_ids. One healthy requested session plus unrelated debris previewed 1 affected row where execution deletes 0. →count_empty_sessions_synctakessession_ids(the same narrowingrepair_empty_sessionsapplies) and the planner counts scoped candidates.session_insightshas no scoped counter yet and keeps the request-size clamp.multiple=Trueyields()for an omitted--session-id, and_coerce_session_idskept(), soscope.pytreated it as a scoped request and refused the defaultpolylogue ops maintenance planforsuperseded_raw_snapshots. → an empty sequence normalizes toNoneat the model boundary, so every surface (CLI, MCP, daemon) agrees.#4522 — replay refusal machinery (4, 5, 6 are one mechanism)
_build_in_progress_snapshotderived COMPLETED fromall_completedalone, ignoringstate.failures, so the checkpoint written between the last target and the final receipt persisted COMPLETED for a permanent refusal. → the snapshot is FAILED when the state carries a terminal scope refusal, matching the final receipt exactly.offline_maintenance_blockersran beforeunsupported_scope_dimensionswas ever consulted (only inside_run_one_target), so an invalid scoped request under daemon write ownership was reported as a retryable blocker. → refusals are recorded and their targets dropped from the pending set before the offline gate; if nothing supported remains, the existing terminal-refusal receipt path handles it._has_terminal_scope_refusalscanned all hydrated samples with no target filter, so resuming with a narrowed, succeeding target set still returned FAILED from a stale excluded-target sample. → the check is scoped to the targets the current invocation requests.#4526 — durable identity transitions
_has_complete_durable_schema_markerchecked onlyquery_unit_frame_state(migration 010) while_validate_reference_catalogthen requiredquery_excision_ledger(migration 011), rejecting a valid v10 archive. →DurableReferenceRelationdeclares thesince_versionthat introduced it, and a versioned file is validated only against relations at or below itsPRAGMA user_version. An unversioned file (ad-hoc or fully-applied DDL with no cursor) still falls back to the marker._repoint_result_set_ownersrewroteretained_query_runs/query_evaluation_receiptsunconditionally, butput_retained_query_runtreatsresult_set_idas exact-retry identity, so a retry after a transition raised a spurious conflict. → execution records keep naming the manifest they ran against (which is retained); only the forward-lookingwatched_query_baselinesmoves._clone_holdout_policygave a holdout cohort a second manifest id whilehas_holdout_contaminationis scoped strictly byresult_set_id, so contamination under one id was invisible under the other. → a result set under a holdout policy is refused a successor outright, so the cohort keeps one identity._insert_result_set_successorwas a plain INSERT with no existence check, so a retried application with the same deterministic successor id raisedIntegrityError. →INSERT OR IGNOREfor the manifest and its members; the id is a hash of the content, so a colliding id already carries exactly this content.audit_conn, two connections released savepoints sequentially with no coordination; if the savepoint was outermost, the release committed the user tier by itself and a crash before the audit release stranded a durable transition with no audit record. → both connections are placed in an explicit transaction first, so every release is nested and neither tier is durable until the caller commits.Verification
Anti-vacuity was measured, not asserted: reverting
polylogue/maintenance/replay.pyto its pre-change state turns the pre-gate and narrowed-resume tests red, mutatingclean = all_completed and not _has_terminal_scope_refusal(...)back toclean = all_completedturns the checkpoint test red, and revertingpolylogue/maintenance/assertion_transition.pyturns all five new transition tests red.Three tests that existed before this branch encoded the fixed behavior and were updated with it: the two
retained_query_runs/query_evaluation_receiptsrepoint assertions intest_result_set_member_transition_clones_the_manifest_and_repoints_owners, and thesession_idsclamp assertions inTestPlannerNarrowsBySessionIds.Residual risk
empty_sessions;session_insightsstill falls back to the request-size clamp._run_one_target's own scope-refusal branch is now unreachable fromexecute_replayand is retained as defense in depth.Not in scope: findings 12-20 (surfaces / api / cli), owned by another lane.