fix(server): schedule_task updates save freshSession #32367
main fromrefs/pull/32367/head·opened View on GitHubProblem#
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
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
649ce33Macroscope'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).No actionable comments were generated in the recent review.
Walkthrough
-
The scheduled-task update handler now forwards
freshSessiontoupdateScheduledTask. A test checks that an update saves"fresh_session"as the thread mode and reportsfreshSession: true.Changes: Scheduled-task update
Layer / File(s) Summary Forward freshSessionand verify the update
apps/server/src/mcp/toolkits/orchestrator/handlers.ts,apps/server/src/mcp/toolkits/core.test.tsThe update handler passes freshSessiontoupdateScheduledTask. 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 thatschedule_taskupdates dropfreshSession; this change forwards the field and tests the saved and returned values.
Possibly related PRs
- pingdotgg/t3code#30326 — Adds the
freshSessioninput 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_sessionmode. - pingdotgg/t3code#25124 — Adds the
schedule_taskupdate branch that this change updates.
Suggested labels:
bugfixSuggested reviewers:
t3dotgg
Merge Risk:
Minimal · up to649ce-
No merge-blocking issue is identified; merge after normal checks.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly describes the scheduled task update fix. Description check The description covers the problem, fix, scope, test results, verification limits, and agent attribution. Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check 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-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 257e407
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f54bc236-6a73-4c39-8c46-9b9d395f3f38
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.tsapps/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.
-
-
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.
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes