Skip to content

bugfix: show token and cost metrics for failed and cancelled turns - #963

Merged
harshil-2096 merged 2 commits into
mainfrom
bugfix/hv/turndone-with-error-state-has-token-counts-but-ui-does-not
Oct 6, 2026
Merged

harshil-2096 merged 2 commits into
mainfrom
bugfix/hv/turndone-with-error-state-has-token-counts-but-ui-does-not

Conversation

@harshil-2096

@harshil-2096 harshil-2096 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

image image

Closes AGE-2441

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

Low Risk
Display and DTO mapping only; no auth, billing, or server behavior changes.

Overview
Failed and cancelled turns can now surface token and cost metrics in turn headers and session rollups, matching successful turns when the host reports usage before the turn ends abnormally.

The assistant-ui-runtime contract adds optional metrics on TurnStateCancelled and TurnStateError, and the TrueForge server adapter maps SDK terminal states through toUiTurnDoneMetrics for those statuses (not only done). Unit tests cover error/cancelled mapping and error-state session turn views.

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

@changeset-bot

changeset-bot Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 87bbf03

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-assistant-ui-runtime 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

@harshil-2096
harshil-2096 enabled auto-merge (squash) October 6, 2026 06:03
@harshil-2096
harshil-2096 merged commit e452b06 into main Oct 6, 2026
15 checks passed
@harshil-2096
harshil-2096 deleted the bugfix/hv/turndone-with-error-state-has-token-counts-but-ui-does-not branch October 6, 2026 06:08
truefoundry-saas added a commit that referenced this pull request Oct 6, 2026
* bugfix: show token and cost metrics for failed and cancelled turns (#963)

* feat: implement timeout for create-turn SSE writes to enhance reliability (#964)

* feat: implement timeout for create-turn SSE writes to enhance reliability

* fix: ensure proper handling of SSE stream disconnection and draining logic in createTurnsRouter

* Give model fetches a 60s body timeout and shorten the default MCP request timeout to 2 minutes. (#965)

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

* Regenerate OpenAPI document and SDKs

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: trueforge-dev-bot[bot] <trueforge-dev-bot[bot]@users.noreply.github.com>
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.

2 participants