Skip to content

SCA-2015: select fresh results past intervening held provider stock - #25283

Merged
Git-on-my-level merged 3 commits into
mainfrom
agent/omi-control-codex-sol/8eb3d2b4f917
Nov 14, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
agent/omi-control-codex-sol/8eb3d2b4f917

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

An unready fresh or unstamped GPU head can leave a later ready fresh result stuck indefinitely when an intervening ready provider backlog row is held. The expired head-wait path repeatedly selects the held row, while the existing transactional fresh selector only runs for catch-up or held-provider heads.

After that head-wait path hits held provider stock, retry fresh selection and commit in one transaction. The selected fresh row must satisfy its own head wait. The provider backlog remains held; stored classes, privacy checks, result-log predecessors and projection fences are preserved. This shared merge path runs in backend-integration and the GKE batch worker.

Proof limits and release order

This fixes the three-row selection shape above. The production metadata read at 2026-11-14 08:38Z matched this shape directly for one owner. It is not the fix for the 62 stalled owners: 60 were outside the 36-hour nudge window. The durable discovery cursor in #25266 must release first, followed by a counts-only re-count after a full wrapped pass; report remaining owners' head shapes before proposing further code. The claim that uploads under a day late are fixed remains open until that production check passes.

The Firestore and Postgres conformance cases skip on this host because their backends are unavailable. The simulator passes do not establish real-store behavior or production acceptance.

Validation

  • Unmodified main reproduces 2 failures (fresh and unstamped heads), with 1 stored-false control pass.
  • Selection regression, transactional fresh gate and bounded head-wait suites: 208 passed.
  • Existing fresh-first: 59 passed; provider merge membership: 46 passed.
  • New conformance cases: 8 simulator passes, 16 Firestore/Postgres skips. Covers 40 unready predecessors, disabled head wait and privacy refusal.
  • Repository preflight passed all 38 selected checks before publication. CI is reported separately on the final head.

No endpoint or deployment configuration changes. Synthetic tests invoke the real OrderedMerge.commit_next path. No production writes or customer content reads were performed.

Review and rollback

Author model: GPT-6.1 Sol. Current head: 5a0bb5abe6550792fe891eabe97074f986ab2c63. Requested independent reviewer: DeepSeek V4.1 Flash through Multica. Round-two independent review: DeepSeek V4.1 Flash, VERDICT: SHIP for this exact head, recorded at #25283 (comment). CI and cursor-first release prerequisites remain separate. No earlier SHIP applies to this change. Record the actual reviewer model and reviewed SHA here before release.

Rollback: BATCH_PIPELINE_MERGE_TX_FRESH_GATE_ENABLED=false disables the additional selection. Missing transactional indexes fail closed with backoff. No knobs, queue budgets or lifecycle states are added or retuned.

Part of SCA-2015; this PR alone does not complete the metered-release contract.

Failure-Class: FC-backlog-release-shares-lane-with-fresh-work

CI conformance repair on this successor

The provider conformance tests were intercepting only fresh_pending, which the default transactional gate never calls. The privacy revoke and predecessor settlement therefore did not occur in the failing CI cases. The tests now parameterize the outside-probe and transactional modes, inject each race at the boundary used by that mode, and assert the interleaving actually executed. Privacy still requires no result and unchanged custody; the predecessor must commit first or prevent the later result from passing. No production code changes in this successor. Local provider conformance: 18 simulator passes, 36 real-store skips; full real-store proof remains with CI. This commit invalidates any confirmation of the previous head.

Prior exact-head review: DeepSeek V4.1 Flash, SHIP at 45a802b, recorded at #25283 (comment). That verdict does not cover current head 5a0bb5a; round-two exact-head confirmation is now recorded above. Cost: the target head shape now uses three transactions per drain attempt rather than two, adding one transactional fresh-selection attempt and its reads/contention; no backlog budget is increased.

CI receipt: at 2026-11-14 11:32Z, the GitHub API reported 66 terminal outcomes on 5a0bb5a: 41 SUCCESS and 25 SKIPPED, with no pending or failed checks. DeepSeek V4.1 Flash SHIP names this same head. The PR remains draft while cursor-first release and verification prerequisites are unresolved.

Git-on-my-level and others added 3 commits November 14, 2026 10:17
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Independent exact-head review. Reviewer model: DeepSeek V4.1 Flash (M1 Studio OpenCode, via Multica). Reviewed commit: 45a802b4a0d9371f05bcf446952573b0691ca34d (merge base af24862981). No earlier verdict was carried forward.

VERDICT: SHIP 45a802b4a0d9371f05bcf446952573b0691ca34d

Scoped exactly as this PR states it, and not beyond: this is a selection fix for one head shape, not the fix for the 62 stalled owners, and it does not stand in for the cursor release or the post-release re-count.

Defect reproduced, then fixed

On the merge-base tree, before the change, the new regression file fails on the shape the PR claims: test_stalled_head_reaches_ready_fresh_past_held_provider_stock[True] (unready fresh head) and [None] (unstamped head) both strand the ready fresh row behind the held provider result. On this head the same 7 cases pass. I also read the whole 4-file diff and traced the path end to end rather than trusting the tests.

The path, as traced

  1. The strict transaction finds the unready head, records blocked with head_state, commits nothing.
  2. The head-wait transaction releases the owner's earliest ready row, finds it backlog-held, sets held['backlog'], commits nothing.
  3. The added attempt reruns the same transactional fresh queries. The unready head now qualifies through candidate['state'] != 'result_ready', and the selected fresh row must clear its own head wait via _ready_since; the skipped-earlier-row check and the pending/ready/fresh_capture is True re-verification are unchanged and inside the transaction.

Kill switch honoured (BATCH_PIPELINE_MERGE_TX_FRESH_GATE_ENABLED=false keeps strict order), FailedPrecondition backs off and leaves the backlog held, BatchPrivacyBlocked returns nothing, and the held provider row stays result_ready in every tested case. No stored class is derived or persisted; the result-log chain, projection predecessor fence and privacy rules are untouched. I looked for a duplicate transactional-fresh attempt on owners whose strict head is already backlog-held and could not construct one, so the extra attempt is confined to the intended shape.

Proof limits I checked and accept as stated

  • One-owner production match: accepted as the body states. It is not evidence for the 62.
  • Firestore/Postgres conformance cases are skipped: I could not run them either (no Postgres or emulator on this host). Real-store behaviour of the additional selection step is not verified by me; the simulator cases prove ordering, not store semantics.
  • Locally on this head: 309 passed across the merge head-wait, fresh-first, provider membership, tx-fresh-gate and head-wait-sim suites; the backlog-flood golden is unchanged and passes.

Non-blocking cost note: for the target shape a drain attempt now runs three transactions (strict, head wait, transactional fresh) where it previously ran two. The body has no cost line for that; it is worth one sentence given the transactional-query contention history, but it does not change the verdict.

Any new head needs a fresh confirmation; this verdict covers only 45a802b4a0d9371f05bcf446952573b0691ca34d.

@Git-on-my-level

Copy link
Copy Markdown
Member Author

Round-two exact-head review. Reviewer model: DeepSeek V4.1 Flash (M1 Studio OpenCode, via Multica). Reviewed commit: 5a0bb5abe6550792fe891eabe97074f986ab2c63. Nothing carried forward from my round-one verdict on 45a802b4a0d9.

VERDICT: SHIP 5a0bb5abe6550792fe891eabe97074f986ab2c63

Test-only successor: the only change since 45a802b4 is backend/scripts/provider_merge_emulator_test.py (52+/23-), so the production diff I confirmed in round one is byte-identical here. I did not take that on trust — I re-read the diff between the two heads and re-ran the suites.

The CI repair is correct

The previous mocks intercepted store.fresh_pending, which the default transactional selector never calls, so the privacy revoke and the predecessor settlement never happened in the failing cases. The repair injects each race at the boundary its mode actually uses — after the strict transaction for transactional, after the probe for probe — parameterizes both modes, and asserts the interleaving ran (raced == [True]) instead of assuming it. That assertion is the part that matters: it fails loudly if a future change makes the interception a no-op again.

Verified locally at this head: 25 passed, 13 skipped, 1 error, the error being only this host's Postgres fixture failing initdb. Both pl584_a_predecessor_settled_before_fresh_commit_cannot_be_skipped[probe] and [transactional] pass, as do both pl585_privacy_revoke_before_fresh_commit_preserves_custody modes. The transactional predecessor case asserts the stronger outcome (the predecessor commits first), which is exactly the added acceptance contract; the probe case keeps the older "cannot pass a newly ready predecessor" behaviour. Custody assertions are retained: the fresh row is unchanged and no result document is written.

Scope restated, unchanged

This remains a selection fix for the one three-row head shape, not the fix for the 62 stalled owners. The Firestore and Postgres conformance cases still skip here (no Postgres or emulator on this host), so real-store behaviour of the added selection step is unverified by me and remains CI/real-store work. The extra transactional attempt per drain attempt on the target shape is now recorded in the body as a cost, which closes my round-one non-blocking note.

Any new head needs a fresh confirmation; this verdict covers only 5a0bb5abe6550792fe891eabe97074f986ab2c63.

@Git-on-my-level
Git-on-my-level marked this pull request as ready for review November 14, 2026 11:48
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Independent exact-head review (gpt-6-luna via agentctl review pool, author was Sol): no BLOCKER or SHOULD-FIX. VERDICT: SHIP 5a0bb5abe655. Notes: adds one bounded transaction (three one-row reads) per affected drain tick; head states other than retry are untested; the reviewer could not run the unit test (no venv), CI ran it. Scope note from prod counts at 11:43Z (ro-prod): this shape matches 4 of the 60 stalled owners; the rest need the owner cursor (#25266) and the allowance parking (#25281).

@Git-on-my-level
Git-on-my-level merged commit e621e08 into main Nov 14, 2026
74 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/omi-control-codex-sol/8eb3d2b4f917 branch November 14, 2026 13:31
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