Skip to content

Agent-scheduled tasks with bindToCurrentThread=false create a thread and worktree on every run #16725

Closed as not planned

Description

@saphid

Problem

An agent scheduled a recurring task with the MCP tool schedule_task and bindToCurrentThread: false. It wanted to keep the watchdog's ticks out of its own context. Every run then launched a new top-level thread and a new git worktree and branch from origin/main. Nothing reused or cleaned them up.

A 45-minute watchdog produced 28 top-level threads and 36 t3code/<title>-N branches with worktrees in about a day. Every branch was 0 commits ahead of origin/main.

Why

OrchestratorMcpService.scheduleTask stores an unbound MCP task as threadId: null with workspace strategy { type: "worktree", baseRef: "main", startFromOrigin: true }. ScheduledTaskService then calls threadLaunch.launch for every run of a threadId: null task, so each run gets its own thread and worktree.

The tool text says false creates "a fresh top-level thread per run". It does not say that each run also creates a worktree and branch. An agent asking for "not in my thread" gets per-run sprawl instead.

Expected

A recurring task an agent schedules away from its own thread should still have one place for its runs: one thread, and at most one workspace, for the task.

Environment

T3 Code Nightly 0.0.46-nightly.20261005.2689, macOS. Agent: Claude Code (Claude Opus 5.5) inside T3 Code.

Activity

  1. juliusmarminge commented on Oct 7, 2026

    @juliusmarminge
    Member

    we prob need better organization but this is working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions