Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): schedule_task updates save freshSession #32367

ClosedKarthik-beta(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/32367/headopened View on GitHub

Problem

Updating an existing scheduled task with schedule_task and freshSession: true returns success, but the task keeps its old thread mode. A later list_scheduled_tasks also shows freshSession: false. Switching a routine to fresh sessions currently means deleting and recreating it, which changes its id and loses its run history. Reported in #32258.

Change

The update branch of the schedule_task handler (apps/server/src/mcp/toolkits/orchestrator/handlers.ts) copied each update field into updateScheduledTask except freshSession. It now forwards freshSession too. The input schema and updateScheduledTask already accept it and turn it into the thread mode, so nothing else changes.

Scope and approval

This fixes the bug reported and reproduced in #32258. It also fits the exception for a very small fix of an obvious bug: the tool accepts the field and reports success but never applies it. The change is one handler line plus one test.

Verification

A new test in apps/server/src/mcp/toolkits/core.test.ts calls schedule_task through the in-process MCP server. It updates an existing task with freshSession: true and checks the threadMode the task store saves and the freshSession the caller gets back.

Without the fix (vp test run src/mcp/toolkits/core.test.ts -t freshSession):

× updating a scheduled task with freshSession saves and reports fresh sessions
AssertionError: expected [ 'new_thread' ] to deeply equal [ 'fresh_session' ]
Tests  1 failed | 20 skipped (21)

With the fix (vp test run src/mcp/toolkits/core.test.ts):

Test Files  1 passed (1)
Tests  21 passed (21)

vp fmt --check and vp lint on both files, vp run --filter t3 typecheck, and the pre-commit hook (fmt, lint, knip:check) pass. The test is its own commit before the fix, so the failure reproduces on that commit.

Not checked: I ran these on Node 24.22.2 on Windows, not the pinned Node 26.12.1. I also didn't drive the tool from a live agent session.

Written with Claude Opus 5.5 in Claude Code, and reviewed by me.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at 649ce33

      Macroscope's review found this PR approvable — Scheduled-task updates now save an explicitly supplied freshSession setting through the existing service. Defaults, access checks, and session-transition safeguards remain unchanged.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The scheduled-task update handler now forwards freshSession to updateScheduledTask. A test checks that an update saves "fresh_session" as the thread mode and reports freshSession: true.

      Changes: Scheduled-task update

      Layer / File(s)Summary
      Forward freshSession and verify the update
      apps/server/src/mcp/toolkits/orchestrator/handlers.ts, apps/server/src/mcp/toolkits/core.test.ts
      The update handler passes freshSession to updateScheduledTask. The test checks the saved thread mode and the value returned by the tool.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Possibly related issues

      • pingdotgg/t3code#32258 — Reports that schedule_task updates drop freshSession; this change forwards the field and tests the saved and returned values.

      Possibly related PRs

      • pingdotgg/t3code#30326 — Adds the freshSession input and thread-mode handling that this change forwards through the update handler.
      • pingdotgg/t3code#31696 — Addresses the same update path and adds regression coverage for the resulting fresh_session mode.
      • pingdotgg/t3code#25124 — Adds the schedule_task update branch that this change updates.

      Suggested labels: bugfix

      Suggested reviewers: t3dotgg

      Merge Risk: Minimal · up to 649ce

      No merge-blocking issue is identified; merge after normal checks.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title clearly describes the scheduled task update fix.
      Description checkPassedThe description covers the problem, fix, scope, test results, verification limits, and agent attribution.
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Finishing Touches

      Generate unit tests (beta)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 257e4073c1c51dcae291ecc7ca482dc66900f961 and 649ce3375e0802f10b052bfd46ffbbfbcabe5291.

      Files selected for processing: 2

      • apps/server/src/mcp/toolkits/core.test.ts
      • apps/server/src/mcp/toolkits/orchestrator/handlers.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

    4. Thanks for this. https://git.cafe/pingdotgg/t3code/pulls/31696 makes the same change and is the one being kept: Keep #31696 instead: it forwards the same field through the same update handler, with a smaller regression change that extends an existing test. All 31 reported checks pass, and its patch applies cleanly to current main. It addresses the same bug reported in #32258. Main still drops the field, so this is a duplicate rather than already implemented.

      Closing as a duplicate.

    5. juliusmarminge closed this

Sign in to join this conversation.