Skip to content

fix(cron): #13288 inherit runtime provider defaults on job create#14555

Open
MaHaoHao-ch wants to merge 1 commit into
NousResearch:mainfrom
MaHaoHao-ch:fix/13288-weixin-cron-provider
Open

fix(cron): #13288 inherit runtime provider defaults on job create#14555
MaHaoHao-ch wants to merge 1 commit into
NousResearch:mainfrom
MaHaoHao-ch:fix/13288-weixin-cron-provider

Conversation

@MaHaoHao-ch

Copy link
Copy Markdown

What does this PR do?

This PR fixes cron jobs created from gateway sessions (for example Weixin) inheriting an invalid legacy provider at execution time.
When provider or base_url is omitted on cronjob(action="create"), the tool now resolves runtime defaults from the active session and persists them into the job.

Related Issue

Fixes #13288

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Updated tools/cronjob_tools.py to resolve runtime defaults for cron create when provider/base_url are not explicitly passed.
  • Preserved explicit provider and base_url values when users provide them.
  • Kept runtime-resolution failures non-fatal to preserve existing behavior in constrained environments.
  • Added regressions in tests/tools/test_cronjob_tools.py for gateway-session inheritance and explicit-override preservation.

How to Test

  1. Run uv run --frozen --python 3.11 --extra dev pytest -o addopts= tests/tools/test_cronjob_tools.py -q
  2. Verify new tests pass:
    • test_create_inherits_runtime_provider_when_missing
    • test_create_preserves_explicit_provider_and_base_url
  3. Optionally create a cron job from a gateway session without explicit provider/base_url and confirm the stored job fields inherit runtime provider settings.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Windows 10 (Git Bash/PowerShell with uv-managed Python 3.11)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

  • uv run --frozen --python 3.11 --extra dev pytest -o addopts= tests/tools/test_cronjob_tools.py -q -> 27 passed

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cron Cron scheduler and job management comp/tools Tool registry, model_tools, toolsets labels Apr 23, 2026
Ensure gateway-created cron jobs persist runtime provider/base_url defaults when not explicitly supplied, preventing fallback to invalid legacy provider values in execution.

Closes NousResearch#13288
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #13337 — same fix for #13288 (inherit runtime provider on gateway-created cron jobs). Also related to #13171 (same area, config-based inheritance).

@MaHaoHao-ch MaHaoHao-ch force-pushed the fix/13288-weixin-cron-provider branch from f09257a to 6965d80 Compare April 23, 2026 13:18
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/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 微信创建的定时任务执行失败

2 participants