Repository navigation
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: a858bd3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…the actual model Co-authored-by: Cursor <cursoragent@cursor.com>
PR overviewNo security issues were found in this pull request. Reviews
|
Co-authored-by: Cursor <cursoragent@cursor.com>
| custom: Record<string, unknown> | null; | ||
| } | ||
|
|
||
| export interface CreateTurnInput { |
There was a problem hiding this comment.
fix input for create turn because we only have main thread context from last turn , we won't have multiple threads
There was a problem hiding this comment.
Can we do this in a follow up PR
createTurn no longer takes per-thread models: a thread's model is recorded when the thread is created (the root via createTurn's new threads, a subagent via thread.created) and carried with its row. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Subagent agent_info now carries reasoning_effort, set from the resolved model params on thread.created. A rebuilt subagent resumes on that name and effort, and the root keeps following its spec.
The thread checkpoint model is now { name, effort }. The main thread's model is written on every turn, including the first, so the root's resolved model and effort are recorded even though nothing reads them on rebuild yet.
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4fe5e33. Configure here.
| reasoning_effort: z | ||
| .string() | ||
| .optional() | ||
| .describe('Reasoning effort the resolved model runs at. Omitted when none was resolved.'), |
There was a problem hiding this comment.
OpenAPI and SDK not regenerated
Medium Severity
AgentInfoSchema now includes reasoning_effort, and thread.created emits that field so a rebuilt subagent can restore effort. ThreadCreatedEvent is part of the public OpenAPI document, but .github/fern/openapi/openapi.json, docs/openapi.json, and packages/trueforge-sdk still describe AgentInfo without reasoning_effort. Run pnpm sdk:generate and add a patch changeset that names @truefoundry/trueforge-sdk.
Additional Locations (1)
Triggered by project rule: TrueForge review rules
Reviewed by Cursor Bugbot for commit 4fe5e33. Configure here.
ModelSnapshot and ModelSnapshotSchema name the stored { name, effort } on a thread snapshot, separate from the runtime AgentModel. modelSnapshotFromAgent replaces threadModelFromAgent to match.
Co-authored-by: Cursor <cursoragent@cursor.com>


Summary
A subagent on a different model from its parent should run with its own model's settings, not the parent's, and
THREAD_CREATEDshould save the model the subagent actually runs on.AGE-2841
Changes
Split the model out of
AgentDefinition(refactorcommit, no behaviour change)definition(instructions, messages, tools, response format, iteration limit) and a separatemodel(AgentModel: client, name, provider type, properties and params).resolveAgentDefinitionreturns{ definition, model, extraCapabilities }.AgentThread,builtinsFromSpecandcontextCompactionread the model frommodel.A thread on another model runs on that model's own defaults
TurnResourceResolver, a thread whose model is the spec's model gets the model's defaults and then the spec's params, as before.max_tokens, or none) plusparallel_tool_calls: true. None of the spec's params carry over.Record and restore the model a subagent actually runs on
thread.createdrecords the model the subagent was built with, instead of the requested one (empty when the model is routed).turn_thread.checkpointgets amodelfield: written when a subagent is added (fromthread.created) and on every new turn (through a newthread_modelsinput tocreateTurn).checkpoint.model, falling back toagent_info.modelfor older rows. The root keeps following its spec, so switching models mid-chat still works.20261118_000001_turn_thread_model) setmodel: nullon existing checkpoints, following thepending_mcp_authbackfill.AgentDefinitionis an exported type oftrueforge-core, so code built on the library that constructs it needs updating. The agent spec, the HTTP API and the generated SDKs are unchanged.How was this tested?
parallel_tool_calls, with none of the spec'smax_tokens,temperatureorreasoning_effort, and nomax_tokenswhen the limit isn't known;thread.createdrecords the model the subagent runs on;trueforge-core(604),trueforgeunit (930), SQLite store (251) and Postgres store (255) suites pass; both typechecks, ESLint and Prettier are clean on the changed files.Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locally (ran both typechecks, the core, server, SQLite and Postgres suites, and lint and format on the changed files).env.exampleupdated if configuration or behavior changed (no configuration change)Note
Medium Risk
Touches core thread rebuild, LLM param routing, and durable checkpoint schema with DB migrations; behavior changes for subagents on alternate models.
Overview
Separates execution model from agent config by introducing
AgentModel(client, name, params, properties) alongside a slimmerAgentDefinition, and wiringAgentThread, builtins, andresolveAgentDefinitionto consume both.Fixes subagent model behavior: threads on a model other than the spec use that catalog model’s defaults (plus
parallel_tool_calls), not the parent agent’smax_tokens/temperature/reasoning_effort. Rebuilt subagents restore model and effort viaagent_info.reasoning_effortand saved checkpoint data.Persists model per thread:
ModelSnapshot(name,effort) lives on thread checkpoints—written onTHREAD_CREATEDfor subagents (resolved model, not just the request) and on eachcreateTurnviamain_thread_modelfor the root. Postgres/SQLite migrations backfillcheckpoint.modelon existingturn_threadrows.AgentDefinitionno longer carries model fields—a breaking shape change for consumers that construct definitions directly; HTTP agent spec is unchanged.Reviewed by Cursor Bugbot for commit dc6043f. Bugbot is set up for automated code reviews on this repo. Configure here.