feat(scheduler): allow explicit project binding on task creation and update by wgnrai · Pull Request #1940 · agent0ai/agent-zero · GitHub
Skip to content

feat(scheduler): allow explicit project binding on task creation and update - #1940

Open
wgnrai wants to merge 3 commits into
agent0ai:mainfrom
wgnrai:feat/scheduler-explicit-project-kwarg
Open

wgnrai wants to merge 3 commits into
agent0ai:mainfrom
wgnrai:feat/scheduler-explicit-project-kwarg

Conversation

@wgnrai

@wgnrai wgnrai commented Oct 6, 2026

Copy link
Copy Markdown

What

The scheduler tool currently derives a task's project exclusively from the active chat context (get_context_project_name), so agents cannot register scheduled tasks in any project other than the one they're chatting in. This PR adds an optional project argument to create_scheduled_task, create_adhoc_task, create_planned_task, and update_task that overrides the context-derived project. Behavior when the argument is omitted is unchanged (falls back to context project), and unknown project names produce a loud error instead of silently mis-filing the task.

Why

Cross-project orchestration is a common pattern: an infrastructure agent builds scheduled tasks on behalf of other projects (an assistant, a monitoring agent, a content team). Today the only way to place a task in project B is to open a chat inside project B — otherwise the task silently binds to the wrong project and surfaces in the wrong chat grouping with the wrong default agent.

How

  • New _project_metadata_from_kwargs() helper on the scheduler tool: resolves an explicit project kwarg (validating via load_basic_project_data), else falls back to _resolve_project_metadata().
  • All three create actions and update_task route through it; update_task additionally writes project_name/project_color when the arg is supplied.
  • Unknown project → Response error, no task created/modified.

Testing

  • Compiles clean under the project runtime.
  • Live-verified in production: two scheduled tasks rebound from a different project's chat; list_tasks shows the intended project.
  • Backward-compat: omitted arg still binds to context project (existing tasks unaffected).

Rebased onto v2.13 (e3051fb) from an earlier internal build.

Filed from wgnr.ai Ops. Dev-ticket: dev-ticket-2026-10-05-scheduler-project-binding-from-context.md

@chatgpt-codex-connector

Copy link
Copy Markdown

wgnr-ai-ops and others added 2 commits October 8, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant