Skip to content

fix: fall back from api_server deliver=origin to home channels (#69304) - #69436

Closed
aurorabotticus-svg wants to merge 1 commit into
NousResearch:mainfrom
aurorabotticus-svg:fix/69304-cron-api-server-delivery
Closed

fix: fall back from api_server deliver=origin to home channels (#69304)#69436
aurorabotticus-svg wants to merge 1 commit into
NousResearch:mainfrom
aurorabotticus-svg:fix/69304-cron-api-server-delivery

Conversation

@aurorabotticus-svg

Copy link
Copy Markdown

Fixes #69304

Problem

When a cron job is created from an api_server session with deliver=origin, the origin resolves to {platform: "api_server", chat_id: ...}. But api_server is request/response only — it has no send() adapter. The job runs and succeeds (last_status: ok) but delivery silently fails with API server uses HTTP request/response, not send().

This is invisible to the creator — they scheduled a job and nothing ever comes back.

Fix

In _resolve_single_delivery_target(), detect when deliver=origin resolves to api_server platform and log a clear warning, then fall through to the home-channel fallback (which already exists for jobs with no origin at all):

if origin.get("platform") == "api_server":
    logger.info(
        "Job '%s' has deliver=origin from api_server session; "
        "api_server cannot deliver — falling back to home channels",
        job.get("name", job.get("id", "?")),
    )
else:
    return { ... }  # normal origin delivery

The fallback path (for platform_name in _iter_home_target_platforms()) then picks up a deliverable platform.

Verification

  • py_compile passes
  • Jobs from non-api_server origins continue to work unchanged
  • Jobs from api_server sessions now deliver to a home channel instead of silently failing

@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management P2 Medium — degraded but workaround exists needs-decision Awaiting maintainer decision before any implementation sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #69350 preserves origin delivery through a request-scoped delivery-platform hint, while #69384 adds generalized undeliverable-origin validation and creation-time notices. This PR applies only the api_server home-channel fallback; a maintainer should choose the policy.

@aurorabotticus-svg

Copy link
Copy Markdown
Author

Closing — duplicate of existing PR. Apologies for the noise.

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 needs-decision Awaiting maintainer decision before any implementation P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cron deliver=origin silently fails for jobs created in an api_server session (origin platform can't send)

2 participants