Skip to content

[Bug]: After a fresh-session scheduled run, delegated-task completion wakes go to the context-free session (other half of #36087) #44614

Done

Description

@1kuna

Before submitting

Area

Server: scheduled tasks and orchestration wake routing (claudeAgent provider)

Version

T3 Code 0.1.12 (desktop, macOS), Claude provider.

Steps to reproduce

  1. In a long-running Claude thread that dispatches delegated tasks (delegate_task, async), create a schedule bound to that thread with freshSession: true, for example interval every 60 minutes.
  2. While a few delegated tasks are still running, let one scheduled run happen. T3 starts a new Claude session for it, as documented.
  3. Let the delegated tasks finish. Their completion notifications ("Delegated task … finished") wake the thread.
  4. Send a normal message in the thread.

Expected behavior

The scheduled run gets fresh context for its own turn only. Everything else, including completion wakes and the user's messages, continues in the thread's own session.

Actual behavior

  • After step 2, every delegated-task completion wake runs in the fresh session, which has no history beyond the scheduled prompt. In that session the agent goes on working: it dispatches follow-up tasks, accepts reviews and writes reports to the user, all without the thread's context.
  • At step 4 the user's message goes to the original session (the fix(server): a fresh-session scheduled run no longer takes over the thread's conversation #36103 behaviour). That session has never seen the turns from step 3.
  • The visible thread therefore interleaves two Claude sessions. The user sees the agent deny knowledge of the message it posted minutes earlier. In our case the agent was asked about numbers from its own previous message, replied "I don't see that in anything I've sent today", then guessed the context had been summarised away.
  • With an hourly fresh-session schedule this recurs every hour. On one thread over ~23 hours, 11 of the hourly fresh sessions handled worker completions, the busiest absorbing 132 of them, before the user's next message moved the conversation back.

Evidence

Claude Code's per-session transcripts show it directly. The thread's main session file stops at the scheduled run. A new session file starts with the scheduled prompt, followed by every subsequent Delegated task … finished prompt. The user's next message appears in the main session file again, with its parentUuid pointing at the turn before the scheduled run.

Impact

High. An orchestrating agent makes real decisions (dispatch, review acceptance, merges) with no context, and the main session never learns about them. Users see an agent contradict or forget its own previous message. Nothing in the UI shows that a different session answered.

Workaround

Don't bind freshSession: true schedules to a thread you also chat in or that dispatches delegated tasks. Leave the schedule unbound (it gets its own thread), or turn freshSession off.

Suggested fix

Route completion wakes for tasks dispatched by the original session to that session, as #36103 does for user messages. Alternatively, have schedule_task refuse or warn when a fresh-session schedule is bound to a thread with user messages or running delegated tasks.

Activity

  1. 1kuna commented on Nov 28, 2026

    @1kuna
    ContributorAuthor

    Thanks for fixing delegated-completion routing in #44637. There is a related way for a fresh scheduled turn to enter a conversation without anyone binding the schedule to that conversation.

    1. Create a repeating schedule with fresh sessions and leave it unbound.
    2. Let the first run create its own thread. The schedule attaches to that thread for subsequent runs.
    3. Send a normal chat message in that thread.
    4. Let the schedule fire again. Its next turn shows up in the same conversation, from a fresh provider session that has none of the chat history.

    This occurs before any delegated completion is routed. By the time the schedule fires, the destination can have become a human conversation even if it was dedicated to automation when the schedule was created. Checking the destination at firing time would cover that transition.

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