Skip to content

fix(kanban): run wake-only delivery before cursor advance on push adapters - #85556

Merged
teknium1 merged 1 commit into
mainfrom
fix/kanban-wake-only-delivery-ordering
Aug 13, 2026
Merged

fix(kanban): run wake-only delivery before cursor advance on push adapters#85556
teknium1 merged 1 commit into
mainfrom
fix/kanban-wake-only-delivery-ordering

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Wake-only kanban subscriptions (delivery_mode='wake') on push adapters no longer lose events when the wake fails — the wake now runs BEFORE cursor advance, with rewind/retry on failure. Extracts the residual insight from #84191; Co-authored-by @MaximCrabbe, who identified the ordering gap.

The wake is the SOLE delivery in wake-only mode (the text ping is intentionally skipped), yet the cursor advanced first and the wake ran best-effort after — a failed wake silently lost the event forever. The non-push (api_server) branch already had correct ordering; this brings the push-adapter branch in line.

Changes

  • gateway/kanban_watchers.py (+112/−55): push-adapter wake logic extracted into a shared _push_wake() helper; wake-only mode runs wake → success? → advance (else _kanban_rewind + failure counter, sub dropped at MAX_SEND_FAILURES); notify+wake semantics unchanged (text is the delivery, wake stays best-effort); premature counter-reset at the send_passive skip gate removed
  • tests/gateway/test_kanban_notifier_wake_only_ordering.py: 4 tests — success advance, failure rewind+redeliver+counter, notify+wake unchanged, failure-cap drop

Validation

Before After
wake-only push sub, wake fails event lost forever claim rewound, retried next tick
wake-only push sub, wake succeeds cursor advanced unchanged
notify+wake text is delivery unchanged
targeted tests 44/44 across 5 suites, sabotage-proven

Infographic

wake-only delivery ordering

…h rewind/retry

For a push-adapter subscription with delivery_mode='wake' the visible text
ping is intentionally skipped (the send_passive gate), so the wake injection
IS the sole delivery — yet the event cursor advanced BEFORE the wake, which
then ran best-effort with its failure swallowed. A single failed wake
permanently lost the event.

Apply the same ordering the non-push (api_server) self-post branch already
uses: attempt the wake BEFORE advancing the cursor; on failure rewind the
claim (_kanban_rewind) and bump the per-sub failure counter so the next tick
retries; on success reset the counter; drop the subscription after
MAX_SEND_FAILURES consecutive failures like text sends do. notify+wake mode
is unchanged: the text ping is the delivery and the wake stays best-effort
after the cursor advance.

Extracts the residual delivery-ordering insight from closed PR #84191.

Co-authored-by: MaximCrabbe <crabbemaxim@gmail.com>
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 5d95ba0 — fix(gateway): run wake-only kanban delivery before cursor ad

⚠️ Warnings

OSV vulnerability scan · View job

5 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 6m28s vs 9m36s (-32.6%). 11 job(s) slower, 12 faster, 1 unchanged.

  • Python tests / Run tests slice 3/12: +24.0s
  • Python tests / Run tests slice 4/12: -20.0s
  • Python tests / Run tests slice 1/12: -18.0s
  • Python tests / Run tests slice 9/12: +12.0s
  • OSV scan / Scan lockfiles / osv-scan: +12.0s

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 13, 2026
@teknium1
teknium1 merged commit f57116b into main Aug 13, 2026
49 checks passed
@teknium1
teknium1 deleted the fix/kanban-wake-only-delivery-ordering branch August 13, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants