Skip to content

fix(cron): configurable media-send timeout + non-empty failure reasons (salvages #87965, #87967) - #88787

Merged
teknium1 merged 3 commits into
mainfrom
salv/cron-media-send-timeout
Aug 18, 2026
Merged

fix(cron): configurable media-send timeout + non-empty failure reasons (salvages #87965, #87967)#88787
teknium1 merged 3 commits into
mainfrom
salv/cron-media-send-timeout

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Cron media attachment sends now have a configurable timeout (env var → config.yaml → 300s default) and always record a non-empty failure reason — a timed-out attachment used to log "failed to send media : " with nothing after the colon and no way to raise the fixed 30s window.

Salvages PR #87965 and PR #87967 by @AiwendilInTheWoods (authorship preserved) onto current main, plus a follow-up commit integrating both with the post-#88631 delivery-error surfacing.

Changes

  • cron/scheduler.py: _send_media_via_adapter bounds each send with _get_media_send_timeout() — resolution mirrors script_timeout_seconds: HERMES_CRON_MEDIA_SEND_TIMEOUTcron.media_send_timeout_seconds → 300s. Argument-less exceptions (TimeoutError) fall back to the class name in both the log line and the delivery error recorded on the run.
  • hermes_cli/config_defaults.py: cron.media_send_timeout_seconds: 300 registered.
  • Docs: environment-variables reference row + "Media send timeout" section in the cron user guide.
  • tests/cron/test_media_send_timeout.py: resolution precedence (env wins, config, invalid-input fallbacks) + empty-reason fallback (TimeoutError names its class, real messages preserved).

Validation

Check Result
tests/cron/test_media_send_timeout.py 10 passed
tests/cron/test_media_delivery_parity.py (from #88631) 8 passed
Attribution audit all mapped

Infographic

Cron media delivery: timeout & reasons

AiwendilInTheWoods and others added 3 commits August 17, 2026 17:31
TimeoutError carries no message and str(TimeoutError()) is the empty
string, so the media-send warning rendered with nothing after the colon.
Fall back to the exception class name when str(e) is empty.
The media delivery path used a hardcoded future.result(timeout=30).
Large attachments legitimately exceed it with no way to raise the limit.
Read HERMES_CRON_MEDIA_SEND_TIMEOUT, matching the existing
HERMES_CRON_SCRIPT_TIMEOUT / HERMES_CRON_TIMEOUT /
HERMES_CRON_SESSION_DB_TIMEOUT convention in the same module.
Follow-up on the salvaged commits from PRs #87965 and #87967
(@AiwendilInTheWoods):

- Promote the media-send timeout to the standard resolution pattern:
  HERMES_CRON_MEDIA_SEND_TIMEOUT env var, then
  cron.media_send_timeout_seconds in config.yaml, then 300s default
  (mirrors script_timeout_seconds; .env stays secrets-only).
- Register the config key in DEFAULT_CONFIG and document both surfaces
  (environment-variables reference + cron user guide).
- Fold the empty-str() exception fallback into the error string recorded
  in delivery_errors (post-#88631 the reason reaches the run status, not
  just the log line).
- Tests: timeout resolution precedence + TimeoutError reason fallback.
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 72c8fa5 — feat(cron): configurable media-send timeout + non-empty fail

⚠️ Warnings

CI timings · View report · View job

Wall time 9m35s vs 3m31s (+172.5%). 9 job(s) slower, 12 faster, 4 unchanged.

  • Python tests / Run tests slice 3/12: -53.0s
  • Python tests / Run tests slice 2/12: +46.0s
  • Python tests / Run tests slice 1/12: +38.0s
  • Python tests / Run tests slice 4/12: -31.0s
  • Python tests / Run tests slice 10/12: +20.0s

OSV vulnerability scan · View job

7 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.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cron Cron scheduler and job management area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades P2 Medium — degraded but workaround exists labels Aug 18, 2026
@teknium1
teknium1 merged commit bc76f62 into main Aug 18, 2026
84 of 86 checks passed
@teknium1
teknium1 deleted the salv/cron-media-send-timeout branch August 18, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cron Cron scheduler and job management P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants