Skip to content

feat: allow user message when turn is running - #778

Closed
sr07asthana wants to merge 29 commits into
mainfrom
sr-AGE-2264
Closed

sr07asthana wants to merge 29 commits into
mainfrom
sr-AGE-2264

Conversation

@sr07asthana

@sr07asthana sr07asthana commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #

Changes

How was this tested?

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Medium Risk
Changes core turn/send semantics, LLM context repair, and which threads survive across turns—easy to regress multi-thread sessions or pending-action flows if callers assumed the old blocking behavior.

Overview
Users can start a new turn with a user message while a turn is still waiting on tool approval, a client-side tool response, or an in-flight sub-agent—instead of being blocked or forced to finish pending work first.

Runtime behavior: On a user-message send, the orchestrator drops non-root threads (pending sub-agents) and the main thread runs interrupt-mode open-tool-call repair: unmatched calls on the last assistant message get synthetic tool responses saying the call was cancelled. Resume (empty send or approval/tool batches) still auto-closes only ordinary dangling tools and leaves approval/client-side/sub-agent creation calls open. Validation no longer rejects user messages while those items are pending; interrupt repair runs before validation.

Persistence: capability_states on createTurn is now the authoritative live thread set—threads omitted from it are not copied into the next turn snapshot (in-memory, Postgres, and SQLite). Homogeneous send validation errors use InvalidAgentSendInputError.

Other: Root AGENT_DONE with status: 'error' no longer surfaces as turn output in the orchestrator terminal mapping. Tests cover steering over approvals/sub-agents, live-thread snapshots, and closure modes.

Reviewed by Cursor Bugbot for commit 9f88cdc. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9f88cdc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge-core Patch
@truefoundry/trueforge Patch

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

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread .changeset/steer-session-anytime.md Outdated
Comment thread packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	python/trueforge_sdk/.fern/metadata.json
Comment thread .github/fern/openapi/openapi.json Outdated
Comment thread packages/trueforge-core/src/core/runtime/AgentThread.ts
Comment thread packages/trueforge-core/src/core/runtime/AgentThread.ts Outdated
Comment thread packages/trueforge-core/src/core/runtime/AgentThread.ts Outdated
Comment thread packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts Outdated
Comment thread packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts Outdated
Comment thread packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts Outdated
Comment thread packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts
sr07asthana and others added 9 commits September 17, 2026 17:21
Resolve the session test imports while preserving steering validation and main's active executor coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/trueforge-core/src/core/runtime/OpenToolCallCloser.ts Outdated
Comment thread packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 64133f2. Configure here.

Comment thread .github/fern/openapi/openapi.json
export interface CreateTurnInput<TTurnCustom extends object = Record<string, never>> {
turn: TurnRecordWithoutSnapshot<TTurnCustom>;
/** Threads absent on the previous turn (turn 1: the root thread; else empty). */
/** Live threads absent on the previous turn (turn 1: the root thread; else usually empty). */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Live threads absent on the previous turn (turn 1: the root thread; else usually empty). */
/** Threads absent on the previous turn (turn 1: the root thread; else empty). */

@chiragjn

Copy link
Copy Markdown
Member

#875

@chiragjn chiragjn closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants