Repository navigation
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Scheduled tasks currently inherit the ambient model configuration: when a task fires, its context is (re)built from whatever the global settings happen to be at that moment. If the ambient preset's provider quota is exhausted at fire time, the unattended task dies with a
RateLimitErrorand lands in error state — even though other presets in the instance are healthy. Unattended jobs should not inherit ambient config drift between dispatch and fire (the scheduler has no way to express "this task was created to run on model X").Related prior discussion: #1058. A previous attempt (#1462) was closed by the stale bot without review; this PR is an independent, minimal implementation against current
main.Solution
Opt-in
pinned_preseton scheduler tasks:BaseTask.pinned_preset: str | None = None(pydantic; existingtasks.jsonround-trips unchanged, defaultNone).create_scheduled_task/create_adhoc_task/create_planned_taskaccept an optionalpinned_preset; invalid names are rejected up front with the list of available presets.update_taskacceptspinned_presettoo (empty string unpins), so existing tasks can be pinned without recreation.TaskScheduler._get_chat_context()resolves the pin via the framework's own_model_configpreset lookup and applieschat_model_overrideon the context — the same mechanism the/modelcommand uses — to both freshly created and already-existing dedicated contexts, so pinning viaupdate_tasktakes effect without a restart.Testing
Verified on a live instance (framework runtime) plus a clean worktree of
main:tasks.jsonwith 5 pre-existing tasks loads and re-validates unchanged (allpinned_preset=None)._get_chat_contextreturns a realAgentContextwhosechat_model_overrideequals the pinned preset, and the resolved chat model matches that preset.pinned_preset='does-not-exist'): loudValueErrornaming task/uuid/preset, refusing ambient fallback; no context created.tests/test_task_scheduler_timezone.py: 4/4 pass._get_chat_context(context creation + override consumption path) passes;import helpers.task_scheduler, tools.schedulerclean under the framework runtime.Compatibility notes
pinned_presetdefaults toNoneand is omitted from serialization when unset, so oldtasks.jsonfiles load unchanged and old tool callers see no difference._model_configplugin (sameget_preset_by_name+chat_model_overridepath used by/model), so pinned tasks automatically respect any future changes to preset resolution or override handling.prompts/agent.system.tool.scheduler.md) documents the new parameter for the scheduler tool.