Skip to content

fix(cron): fall back to standalone delivery when live adapter fails silently - #47484

Closed
manus-use wants to merge 1 commit into
NousResearch:mainfrom
manus-use:fix/cron-delivery-active-session
Closed

fix(cron): fall back to standalone delivery when live adapter fails silently#47484
manus-use wants to merge 1 commit into
NousResearch:mainfrom
manus-use:fix/cron-delivery-active-session

Conversation

@manus-use

Copy link
Copy Markdown

What

Fix cron job output being silently dropped when the gateway has an active user session.

Why

When a cron job completes while the user has an active conversation, the live adapter send() can return None or fail in a way that the scheduler still logs as "delivered". The message is permanently lost without any error or retry.

Root cause: the condition if send_result and not getattr(send_result, "success", True) evaluates to False when send_result is None (falsy), causing adapter_ok to remain True. The scheduler reports successful delivery when no message was actually sent.

How

  1. Initialize send_result = None before the try block
  2. Catch ALL exceptions from future.result() (not just TimeoutError) — fall back to standalone
  3. After successful .result(), explicitly check send_result is None → fall back
  4. Guard the success/error field checks with if adapter_ok so they only run when no prior failure occurred
  5. Log specific warnings for each failure mode (timeout, exception, None result)

The standalone fallback path runs in a fresh event loop on a dedicated thread, which is immune to the active-session contention that can cause the live adapter to silently fail.

Testing

The fix is defensive — the standalone path is already proven reliable (it's the non-live-adapter fallback that works for E2EE-exempt platforms). The change ensures it activates when the live adapter misbehaves.

Fixes #47056

… None or raises

When the gateway has an active user session, the live adapter send()
can return None or silently fail while the scheduler logs 'delivered'.
This causes cron job output to be permanently lost without any error.

Changes:
- Treat send_result=None as a delivery failure, triggering standalone fallback
- Catch all exceptions from future.result() (not just TimeoutError) and
  fall back to standalone instead of propagating
- Log specific warnings for each failure mode (timeout, exception, None)
- Initialize send_result before try block to avoid UnboundLocalError

The standalone path uses a fresh event loop in a dedicated thread,
which is immune to the active-session contention that affects the live
adapter path.

Fixes NousResearch#47056
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/cron Cron scheduler and job management duplicate This issue or pull request already exists labels Jun 16, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #47127 — same fix for #47056 (the live-adapter send() returning None is treated as successful delivery, silently dropping cron output; both PRs fall through to the standalone delivery path when delivery is not explicitly confirmed). #47127 is the earliest open PR with this mechanism.

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Thanks for this. The silent-failure-on-live-adapter case (#47056) is now fixed on main in #50018 (02a3288) via an explicit delivery-confirmation check. Note the consolidated fix resolves the tension with #38922: an in-flight confirmation timeout is treated as delivered (re-sending would duplicate), while an unconfirmed/None result falls through to standalone. Closing as superseded — thanks for surfacing it.

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 duplicate This issue or pull request already exists P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cron delivery silently dropped when gateway has active user session (origin delivery)

3 participants