Skip to content

feat(console): add per-cron-job model override picker - #7050

Open
cillins wants to merge 1 commit into
agentscope-ai:mainfrom
cillins:feat/cron-job-model-override
Open

feat(console): add per-cron-job model override picker#7050
cillins wants to merge 1 commit into
agentscope-ai:mainfrom
cillins:feat/cron-job-model-override

Conversation

@cillins

@cillins cillins commented Aug 15, 2026

Copy link
Copy Markdown

Description

Add a model picker to the Cron Jobs drawer so each agent-type cron job can
run with its own model (request.model_slot_override), instead of silently
following whatever model the agent happens to have active at fire time.

The backend contract already exists and is honored end to end
(model_slot_override on the request takes precedence over the agent's
persisted active model; both the {provider_id, model} dict and the
"<provider_id>:<model>" string forms are accepted). The Console simply had
no way to set it — this PR adds the missing UI:

  • JobDrawer: a searchable, clearable model select shown for
    task_type = agent jobs. Options are built from the /models provider
    list in "<provider_id>:<model>" form (model ids containing : stay
    intact — only the first : separates provider from model). Leaving it
    empty means "follow the agent's active model" and submits no override.
    A previously saved override remains selectable even when the model is no
    longer listed by its provider.
  • Submit/edit mapping: the form value is normalized both ways
    (string | dict → select value; empty → the key is dropped from request,
    so clearing the select reliably removes the override on a full PUT).
  • Types: model_slot_override is now documented on CronJobRequest.
  • i18n: en / zh / ja / ru / pt-BR (vi/id fall back to en, consistent
    with their current partial cronJobs coverage).

Related Issue: Relates to #6316

Complements #6353 (backend validation, CLI --model, and full-PUT request
preservation). #6353 makes the Console preserve an existing override;
this PR lets users set one. The textual overlap is intentionally tiny
(CronJobRequest field declaration + one hunk in index.tsx); happy to
rebase whichever lands second.

Security Considerations: None. The override is a per-request model
reference (provider id + model id) submitted through the existing cron-job
PUT/POST APIs; no credentials, channel auth, or env/config handling changes.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactoring

Component(s) Affected

  • Core / Backend (app, agents, config, providers, utils, local_models)
  • Console (frontend web UI)
  • Channels (DingTalk, Lark, QQ, Discord, iMessage, etc.)
  • Skills
  • CLI
  • Documentation (website)
  • Tests
  • CI/CD
  • Scripts / Deploy

Checklist

  • I ran pre-commit run --all-files locally and it passes
  • If pre-commit auto-fixed files, I committed those changes and reran checks
  • I ran tests locally (pytest or as relevant) and they pass
  • Documentation updated (if needed)
  • Ready for review

Testing

  1. Open Control → Cron Jobs → create/edit an agent-type job: a "Model
    Override" select appears under the request input, listing every
    provider/model from /models as Provider / model entries.
  2. Pick a model, save, reopen the job: the override round-trips
    (request.model_slot_override = "<provider_id>:<model>").
  3. Clear the select, save: the key is removed from the submitted request
    (job follows the agent's active model again).
  4. Edit a job whose stored override is a {provider_id, model} dict: it
    displays as the equivalent "<provider_id>:<model>" option.
  5. Switch task_type to text: the select is hidden and request is
    dropped entirely on submit (unchanged behavior).

Evidence

pre-commit run --all-files
# check python ast / check yaml / check xml / check toml / check json /
# detect private key / trailing whitespace / add-trailing-comma / mypy /
# black / flake8 / pylint / prettier / actionlint — all Passed

cd console && npx tsc -b --noEmit
# clean (0 errors)

cd console && NODE_ENV=development npm run test:run -- \
  src/pages/Control/CronJobs src/api/modules/cronjob.test.ts src/locales
# Test Files  7 passed (7)
# Tests       71 passed (71)
#   includes new modelOverride.test.ts: 12 unit tests covering option
#   building, dedup across models/extra_models, dict<->string
#   normalization, and empty-value key removal

cd console && npx eslint src/pages/Control/CronJobs/ src/api/types/cronjob.ts
# 7 problems (6 errors, 1 warning) — identical count and locations as the
# unmodified baseline (pre-existing `no-explicit-any`/`prefer-const` in
# index.tsx and useCronJobs.ts); this PR adds zero new lint findings

Additional Notes

New helper module components/modelOverride.ts keeps all mapping logic pure
and unit-tested; the drawer and page only call into it. No backend changes.

@github-project-automation github-project-automation Bot moved this to Todo in QwenPaw Aug 15, 2026
@cillins
cillins requested a deployment to ai-review-approved August 15, 2026 06:10 — with GitHub Actions Waiting
@github-actions github-actions Bot added the first-time-contributor PR created by a first time contributor label Aug 15, 2026
@github-actions

Copy link
Copy Markdown

Welcome to QwenPaw! 🐾

Hi @cillins, thank you for your first Pull Request! 🎉

🙌 Join Developer Community

Thanks so much for your contribution! We'd love to invite you to join the official QwenPaw developer group! You can find the Discord and DingTalk group links under the "Developer Community" section on our docs page:
https://qwenpaw.agentscope.io/docs/community

We truly appreciate your enthusiasm—and look forward to your future contributions! 😊

We'll review your PR soon.

@lalaliat
lalaliat self-requested a review August 18, 2026 04:29
@lalaliat lalaliat self-assigned this Aug 18, 2026
The backend already honors request.model_slot_override when a cron job
fires (runtime builder reads it off the request and model_factory's
_resolve_model_slot_override resolves a ModelSlotConfig dict or a
"<provider_id>:<model>" string, taking precedence over the agent's
active model). The console had no way to set it.

- JobDrawer: model select for agent-type tasks, options built from the
  /models provider list in "<provider_id>:<model>" form; clearable,
  empty means follow the agent's active model; a previously saved
  override stays selectable even if the model is no longer listed.
- Submit/edit mapping normalizes string|dict <-> form value and drops
  the key when cleared.
- Document model_slot_override on CronJobRequest.
- i18n: en/zh/ja/ru/pt-BR.
- Unit tests for the option builder and value normalization.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time-contributor PR created by a first time contributor

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants