hermes - ✅(Solved) Fix [Bug]: 微信创建的定时任务执行失败 [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

2026-04-21 09:14:25,506 ERROR cron.scheduler: Job '分钟后新闻测试' failed: RuntimeError: Unknown provider 'openai'. Check 'hermes model' for available providers, or run 'hermes doctor' to diagnose config issues. Traceback (most recent call last):

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #13337: fix(cron): inherit runtime provider on gateway create

Description (problem / solution / changelog)

Fixes #13288.

Root cause: Gateway/Weixin-created cron jobs could be created without explicit runtime provider fields, leaving the persisted job to fall back to the invalid legacy openai provider at execution time. Equivalent CLI-created jobs had a working active runtime provider available.

Fix summary:

  • Fill missing cron create provider and base_url from resolve_runtime_provider() before persisting the job.
  • Preserve explicit cron provider / base_url values when supplied.
  • Keep failures non-fatal: if runtime resolution is unavailable, creation falls back to the previous optional values.
  • Add a Weixin/gateway-session regression proving the stored job inherits the active runtime provider/base URL instead of openai.

Tests:

  • uv run --frozen --python 3.11 --extra dev pytest -o addopts= tests/tools/test_cronjob_tools.py -q -> 26 passed
  • git diff --check -- tools/cronjob_tools.py tests/tools/test_cronjob_tools.py

Changed files

  • tests/tools/test_cronjob_tools.py (modified, +43/-0)
  • tools/cronjob_tools.py (modified, +38/-2)

Code Example

Report
https://paste.rs/vsRHQ

agent.log
https://paste.rs/DNUFN

gateway.log
https://paste.rs/dfIT2

---
RAW_BUFFERClick to expand / collapse

Bug Description

通过微信创建的定时任务,默认 Provider 与 CLI 创建的任务不一致,导致任务在执行时失败;而通过 CLI 创建的同类任务可以正常运行。

Steps to Reproduce

  1. 通过微信/Weixin 创建一个定时任务
  2. 等待任务按计划执行
  3. 观察任务执行结果,任务失败
  4. 通过 CLI 创建一个相同内容的定时任务
  5. 观察 CLI 创建的任务可以正常执行

Expected Behavior

通过微信创建的定时任务,默认 Provider 应与 CLI 保持一致,确保相同任务在不同入口创建时表现一致,并能正常执行。

Actual Behavior

通过微信创建的定时任务在执行时失败,CLI 创建的同类任务可以正常运行。日志中出现 Unknown provider 'openai',表明微信入口创建的任务使用了与 CLI 不一致的默认 Provider。 报错日志: 2026-04-21 09:14:25,506 ERROR cron.scheduler: Job '分钟后新闻测试' failed: RuntimeError: Unknown provider 'openai'. Check 'hermes model' for available providers, or run 'hermes doctor' to diagnose config issues. Traceback (most recent call last): File "/opt/hermes/cron/scheduler.py", line 843, in run_job runtime = resolveruntimeprovider(**runtime_kwargs) File "/opt/hermes/hermescli/runtimeprovider.py", line 692, in resolveruntimeprovider provider = resolve_provider( requested_provider, explicitapikey=explicitapikey, explicitbaseurl=explicitbaseurl, ) File "/opt/hermes/hermescli/auth.py", line 1022, in resolveprovider raise AuthError(msg, code="invalid_provider") hermes_cli.auth.AuthError: Unknown provider 'openai'. Check 'hermes model' for available providers, or run 'hermes doctor' to diagnose config issues.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Debug Report

Report
https://paste.rs/vsRHQ

agent.log
https://paste.rs/DNUFN

gateway.log
https://paste.rs/dfIT2

Operating System

Debian GNU/Linux 13 (trixie) on WSL2 (Linux 6.6.87.2-microsoft-standard-WSL2)

Python Version

3.13.5

Hermes Version

0.10.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The issue can be fixed by ensuring the default provider for tasks created through Weixin is consistent with the one used by the CLI.

Guidance

  • Verify the hermes model configuration to check available providers and ensure 'openai' is listed.
  • Run hermes doctor to diagnose potential configuration issues that might be causing the provider mismatch.
  • Check the code in hermescli/runtimeprovider.py and hermescli/auth.py to understand how the provider is resolved and why 'openai' is considered unknown.
  • Compare the configuration and environment variables used when creating tasks through Weixin and the CLI to identify any differences that could lead to the provider inconsistency.

Example

No specific code snippet can be provided without modifying the existing codebase, but reviewing the resolveruntimeprovider function in hermescli/runtimeprovider.py might offer insights into how providers are resolved.

Notes

The issue seems to stem from a configuration or environment discrepancy between tasks created via Weixin and the CLI, specifically regarding the default provider used. Ensuring consistency in how providers are specified or defaulted across different creation methods should resolve the issue.

Recommendation

Apply a workaround by explicitly specifying the provider when creating tasks through Weixin, if possible, to match the provider used by the CLI, until a permanent fix can be implemented to ensure default provider consistency across all task creation methods.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [Bug]: 微信创建的定时任务执行失败 [1 pull requests]