Skip to content

fix(sync): size the cap-hold bound to one sweep and log a full ledger as backpressure (SCA-2886) - #25745

Merged
Git-on-my-level merged 1 commit into
mainfrom
agent/omi-control-opencode-deepseek/ec436d17dede
Nov 19, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
agent/omi-control-opencode-deepseek/ec436d17dede

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

What this fixes

#25697 released a cap-hold reservation when its projection is observed and made a full ledger run the terminal-outcome settle pass before refusing. Verify found it serving (a6824b8, 2026-11-19T00:49Z) but the Done check unmet: MAX_OPEN = 200 still refused owners who legitimately hold 201-205 live reservations, so ValueError: cap-hold reservation bound exceeded could not reach zero.

The bound was sized for a backlog page (PAGE = 10), but one sweep admits up to 100 turns x 10 items for a single owner before any batch outcome can settle. A page-sized bound therefore sat below a legitimate burst, and the refusal was logged as a generic worker failure with a traceback, which made the deadlock class uncountable.

The change

  • MAX_OPEN 200 -> 1000, matching the sweep ceiling. The ledger document stays ~150 KB, far under Firestore's 1 MiB limit. The settle pass keeps terminal entries out, so the bound now counts live work only.
  • A full ledger raises ReservationBoundExceeded (a ValueError) carrying live and settled, and logs outcome=bound_exceeded. The worker catches it and logs outcome=reservation_full without a traceback. settled=0 is backpressure (every entry is live); settled>0 is the deadlock signature.
  • open_units() and reserve() share one settle pass (_open_ledger), so the two cannot drift.

No schema change; no change to what a committed hold means; revert by reverting the commit.

Done check (revised)

After this serves, ValueError: cap-hold reservation bound exceeded in backend-sync logs is zero over 24 h. If any refusal appears, its outcome=bound_exceeded live= settled= line must show settled=0 and never settled>0. batch_admitted holds track live batch work against the 18,951 baseline (2026-11-17T22:25Z), with READBACK: on SCA-2789 quoting both numbers.

Verification

  • python3 -m py_compile on the three changed files.
  • Backend unit shards run in CI; this host has no backend venv (SCA-2134 places heavy checks on m1/multica-worker-1).
  • New tests: a full ledger of live entries refuses with live=MAX_OPEN, settled=0 and logs outcome=bound_exceeded; the worker logs outcome=reservation_full and no outcome=deferred; the existing full-ledger recovery test still passes.

Failure-Class: FC-cap-bound-pins-owner-without-release-path

View guided diff Turn on auto-fix

… as backpressure (SCA-2886)

Verify found the projection release serving but the Done check unmet: owners
legitimately hold 201-205 live reservations, so MAX_OPEN = 200 refused them on
every sweep. One sweep admits up to 100 turns x 10 items for a single owner
before any batch outcome can settle, so a page-sized bound sat below a
legitimate burst.

- MAX_OPEN 200 -> 1000, matching that sweep ceiling; the ledger document stays
  ~150 KB, far under Firestore's 1 MiB limit.
- A full ledger raises ReservationBoundExceeded (a ValueError) carrying the
  live and settled counts and logs outcome=bound_exceeded. The worker logs
  outcome=reservation_full without a traceback, so a legitimate refusal is no
  longer counted as a worker failure. settled=0 is backpressure; settled>0 is
  the deadlock signature.
- open_units() and reserve() share one settle pass (_open_ledger).
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-19T02:19:15.378876Z
We couldn’t complete this review. Comment @codex review to try again.
a7f6cc5 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Git-on-my-level
Git-on-my-level merged commit 1bdf17c into main Nov 19, 2026
67 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/omi-control-opencode-deepseek/ec436d17dede branch November 19, 2026 02:43
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