Repository navigation
Expire restorable capped projection holds behind a dark switch - #24916
Conversation
Route opted-in restorable holds at the existing release cap through the same one-time deadline and expiry CAS as unrestorable holds. Preserve all eligibility fences, retained state, and cap semantics; never release during the expiry pass. Failure-Class: FC-state-deadline-without-reader-exit
When the dark restorable-cap expiry switch is on, refuse ordinary release transactions carrying an expiry stamp. This fences the jobs scan leg and later ordinary passes after the results leg resets attempts. Preserve OFF behavior and all existing nightly eligibility and cutoff checks. Failure-Class: FC-state-deadline-without-reader-exit
With the dark restorable-cap expiry switch enabled, refuse summary or part privacy markers before release, gate-failure expiry, or capped expiry can write. Preserve flag-off behavior and all cap semantics. Cover summary, quarantined and ready part markers, explicit refusal, nightly redrive, and one-time non-privacy expiry. Failure-Class: FC-state-deadline-without-reader-exit
Codex Review Summary: ✅ CompletedThis 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. |
…wedge # Conflicts: # backend/config/policy/kill_switches.py # backend/tests/unit/test_batch_pipeline_projection_release.py # config/feature-flags.yaml
There was a problem hiding this comment.
1 issue found across 9 files
Confidence score: 3/5
- With the flag on, this guard in
backend/database/batch_pipeline_projection_release.pyblocks normal-pass release for every expired row, so restorable non-capped holds wait until the nightly redrive. Limit the guard to the same-pass cross-leg case.
You’re at about 98% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/database/batch_pipeline_projection_release.py">
<violation number="1" location="backend/database/batch_pipeline_projection_release.py:193">
P2: This guard blocks normal-pass release of every expired row when the flag is on, not only capped ones. Restorable non-capped expired holds now wait for the nightly redrive. Limit the guard to the same-pass cross-leg case, or to capped rows, so the flag changes only what the PR describes.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| # may already have expired this row and reset its attempt count. | ||
| if ( | ||
| dead_before is None | ||
| and entry.get('held_expired_at') is not None |
There was a problem hiding this comment.
P2: This guard blocks normal-pass release of every expired row when the flag is on, not only capped ones. Restorable non-capped expired holds now wait for the nightly redrive. Limit the guard to the same-pass cross-leg case, or to capped rows, so the flag changes only what the PR describes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/database/batch_pipeline_projection_release.py, line 193:
<comment>This guard blocks normal-pass release of every expired row when the flag is on, not only capped ones. Restorable non-capped expired holds now wait for the nightly redrive. Limit the guard to the same-pass cross-leg case, or to capped rows, so the flag changes only what the PR describes.</comment>
<file context>
@@ -185,8 +186,24 @@ def release(self, segment_id: str, now: float, *, dead_before: float | None = No
+ # may already have expired this row and reset its attempt count.
+ if (
+ dead_before is None
+ and entry.get('held_expired_at') is not None
+ and projection_restorable_cap_expiry_enabled()
+ ):
</file context>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3500d661d2
ℹ️ 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".
| if projection_restorable_cap_expiry_enabled(): | ||
| # Use the same deadline/one-time CAS as unrestorable holds; | ||
| # any release must wait for a later pass after the reset. | ||
| return self._expire_assignment(transaction, segment_id, entry, now, expired, attempts) |
There was a problem hiding this comment.
Add the required pipeline lifecycle change note
This changes the conversation projection lifecycle by allowing capped, restorable holds to expire and later re-enter assignment, but the commit does not include the pipeline change note required by backend/AGENTS.md. The changed-file inventory and a search of backend/docs/listen_pusher_pipeline/changes/ confirm that this switch has no corresponding note. Add a dated note describing the capped-hold transition, default-off rollout, nightly redrive fence, and verification evidence; updating the batch contract and flag registry does not replace that required lifecycle record.
AGENTS.md reference: backend/AGENTS.md:L164-L164
Useful? React with 👍 / 👎.
…wedge # Conflicts: # config/feature-flags.yaml
With the cap-expiry flag on, the privacy guard returned before ghost classification, so refused rows never reached ghost_classified or ghost_skipped_*. Return the same classification and age bucket the gate-failure branch uses. The tuple is read-only: no release, expiry or settle. Failure-Class: none
Requested by David
Summary
Fixes a wedge on the projection release path. A restorable quarantine_held row that reaches
MAX_RELEASE_ATTEMPTS=3was never released and never expired, so it stayed forever. Measured on 2026-11-08: about 44% of a 120-row assignment_held sample and about 15% of a 400-row quarantine_held sample sat at the attempt cap with no automatic exit.The fix routes that branch through the existing one-time expiry CAS (
_expire_assignment). It saves the capped count, resets attempts to zero once, and waits for the nightly redrive. It never releases in the same pass.Dark by default. Behind
BATCH_PIPELINE_PROJECTION_RESTORABLE_CAP_EXPIRY_ENABLED, default OFF. With the switch OFF, behaviour is identical to origin/main.Safety
MAX_RELEASE_ATTEMPTSstays 3. The requeue cap (PR fix(batch,sync): explicit backlog state machine with owners, deadlines and attempt budgets #24893) is not touched.dead_beforestrictly after the marker) releases a marked row.projection_privacy_refusaland any non-emptyprivacy_reasonon the summary or any part refuse release and expiry before any write.kill_switches.py,flag_budget.json,config/feature-flags.yaml, and the generated registry doc.Verification
Failure-Class: none
test_batch_pipeline_projection_release.py: 215 passed. Flag-budget test: 24 passed. Unit policy: 82 passed. New cases each under 0.5 s.make preflight: 41 checks passed. Typecheck: 0 errors.718cd64cf6, GLM flash blocked by a host timeout): both APPROVE, no findings.Not verified: CI, production behaviour, integration with newer origin/main. No deploy: enabling the switch is a prod flag flip and waits for David's morning gate.
🤖 Generated with Claude Code