Skip to content

feat: Write paused instead of done on HITL - #815

Open
sr07asthana wants to merge 5 commits into
mainfrom
sr-AGE-2191
Open

sr07asthana wants to merge 5 commits into
mainfrom
sr-AGE-2191

Conversation

@sr07asthana

@sr07asthana sr07asthana commented Sep 18, 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
This is a breaking API/SDK shape change to turn lifecycle and store CAS rules; clients that relied on done + required_actions must switch to paused + turn.update.

Overview
Human-in-the-loop turns now end in paused with a turn.update event, not done carrying pending approvals. TurnHandle maps orchestrator required_actions to action_required_on_events (event ids only) and persists via the same updateTurnState path, emitting turn.update instead of turn.done.

The public turn model is tightened: TurnStateDone drops required_actions; TurnStatePaused is a first-class TurnState (OpenAPI, Zod, TS/Python SDK). Live updates reuse TurnStatePaused / TurnStateRunning instead of separate TurnUpdateState* types, and ActionRequiredEvent is removed from the spec.

Session store semantics change with pause: the first running → non-running write wins (so a paused turn blocks a follow-up done until resume/freeze flows); session cost/duration metrics are folded only for terminal states, not on pause. Postgres/SQLite and in-memory stores align on that behavior, with new contract and stream tests for HITL approval gating.

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

@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 095ddcc

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

This PR includes changesets to release 4 packages
Name Type
@truefoundry/trueforge-sdk Patch
@truefoundry/trueforge Patch
@truefoundry/trueforge-core Patch
@truefoundry/trueforge-ui 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 packages/trueforge-core/src/agent-session/TurnHandle.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.

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 095ddcc. Configure here.

| TrueForge.TurnStateCancelled
| TrueForge.TurnStateDone
| TrueForge.TurnStateError
| TrueForge.TurnStatePaused

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SDK pause types break UI adapter

High Severity

Regenerated TurnState now includes paused, and TurnStateDone no longer has requiredActions. The in-repo UI adapter still treats HITL as done plus requiredActions and does not map paused, so trueforge-ui typecheck fails and paused turns cannot be shown in chat.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: TrueForge review rules

Reviewed by Cursor Bugbot for commit 095ddcc. Configure here.

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.

1 participant