Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): agent-launched threads inherit the app default's effort #48200

Closeddakshcodez(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48200/headopened View on GitHub

Problem

Threads created by an agent via t3_thread_launch don't inherit the app's default model selection (defaultModelSelection). The server resolves a new thread's selection as agent-passed ?? calling-thread ?? app-default. Steps 1 and 2 return their selection as-is, so when it carries no effort, the app default is never consulted and the provider falls back to its catalog default (Medium) — even when the app default is High. Hand-opened threads start from the full default selection, so they correctly get High. Addresses #48183.

Change

A guarded helper withDefaultEffort() in the t3_thread_launch handler fills effort from defaultModelSelection when the chosen selection has none — but only when: the default is on the same provider instance, the launched model actually exposes a reasoning/effort picker, the selection doesn't already set that option, and the default's value is a valid choice for that model. The filled selection is stored on the thread, so the stored selection and the UI show the right effort. No other default options (fast mode, context window, session modes) are copied, so an agent can't gain capabilities it wasn't launched with. Supporting moves: REASONING_EFFORT_OPTION_IDS → @t3tools/shared/model (re-exported from client-runtime, existing imports unchanged); advertisedModel exported from OrchestratorMcpService.

Scope

One problem: the t3_thread_launch path. create_threads / delegate_task resolve models through a separate path (resolveTarget in OrchestratorMcpService.ts) with no app-default step. #48183 mentions create_threads, so I've left it as a documented follow-up rather than widening this diff — happy to fold it in here if you'd prefer.

How I found / verified it

  • Traced the selection order in handlers.ts and compared it to the hand-open path (resolveNewThreadModelSelection, packages/shared/src/usageLimits.ts), which returns the default with its options — confirming why hand-opened threads get High and launched ones don't.
  • Added a test (apps/server/src/mcp/toolkits/project/handlers.test.ts, app default Opus/High) covering: agent passes Opus w/ no effort → High; agent passes nothing + calling thread has Opus w/ no effort → High; agent picks Low → stays Low; model without high in its choices → unchanged; default on a different provider instance → unchanged.
  • Confirmed it fails without the fix (test fails at the effort assertion with only handlers.ts reverted) and passes with it (27/27).
  • vp run check:changed green: format, lint, knip, graphql, typecheck (37 packages), tests (7 files, 211 tests).

No UI code changed; the effort the UI shows comes from the stored selection this corrects.

    1. tanstack-source added labelsbug

    2. Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — Agent-launched threads that omit reasoning effort will now inherit a supported effort value from the app/project default. This changes product-default behavior and requires human confirmation of the intended latency and resource-use implications.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. Thanks for this. #48196 makes the same change and is the one being kept.

      Thanks for the work on #48200. #48196 is the better pull request to keep: it implements the same t3_thread_launch default-effort fix in the handler and regression test, with a smaller two-file change and the maintainer-authored branch already in a clean, passing state.

      Your guarded capability matching and broader test matrix are useful considerations, but they overlap the same fix rather than addressing a separate issue. Please fold any desirable safety improvements into #48196 or use them in a follow-up once that implementation is settled.

      Closing as a duplicate.

    4. juliusmarminge closed this

Sign in to join this conversation.