Skip to content

live demand gate: failed heartbeat retries next loop, unavailable read at decide - #22471

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/live-demand-gate-presence-fu
Oct 19, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/live-demand-gate-presence-fu

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Follow-up to #22465 (merged as ffec86b), from the Grok review lows (SCA-829). Both changes only move toward the vendor.

  1. _presence_published is stamped only after a successful presence write (demand_routing.py, publish()), so a timed-out non-admitted heartbeat retries on the next 1 s loop instead of waiting another 10 s. Without it, two consecutive timeouts could let a hidden sibling entry age out of the 30 s lease and send an admitted sibling to the vendor.
  2. run() evaluates decide(visible=visible or self._presence_unavailable), so an observe()-spawned publish that records a second consecutive miss between the loop's read and decide() forces the vendor in the same iteration rather than one loop later. Trivial, so included rather than deferred.

Admitted routing is otherwise unchanged; can_admit_window stays strict.

How it was verified

Layer: unit, nice -n 19, backend venv. pytest tests/unit/test_live_demand_presence.py test_live_demand_consumers.py test_live_demand_switch.py test_live_demand_telemetry.py -> 99 passed. New tests: failed non-admitted heartbeat retries next loop; first failed heartbeat retried immediately; concurrent unavailable forces vendor in the same iteration. Not verified live; rides the next listen deploy.

Product invariants affected

none

Failure class (fixes)

No fix: commits were detected; no declaration is required.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…d at decide

Follow-up to #22465 review (SCA-829 lows):
- A timed-out non-admitted heartbeat no longer consumes its 10s slot, so
  consecutive timeouts cannot age a hidden sibling entry out of the 30s lease.
- run() folds _presence_unavailable into visible before decide(), so a second
  miss found by an observe() publish forces the vendor in the same iteration.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T10:08:03.339118Z 20eb8f5 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.

@Git-on-my-level
Git-on-my-level merged commit 3a8904e into main Oct 19, 2026
62 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/live-demand-gate-presence-fu branch October 19, 2026 10:27
Git-on-my-level added a commit that referenced this pull request Oct 19, 2026
, #22362, #22461, #22471 sync)

- config/feature-flags.yaml: kept both new rows (LISTEN_LOOP_METRICS_ENABLED from main,
  ENRICHMENT_ROUTE from integration); rendered doc regenerated.
- #21932 moved the legacy sync runner's 500/503 into _run_sync_job_attempt: known gaps and the
  task-target KNOWN set gain the four _run_sync_job_attempt keys (legacy, leave with C11), drop
  the _run_sync_job_body/503 keys and recover_quarantine/503 (fixed by #22476).
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