Skip to content

fix(truefoundry): reject incomplete streamed answers - #1093

Open
nik13 wants to merge 1 commit into
mainfrom
fix/truefoundry-stream-completion
Open

nik13 wants to merge 1 commit into
mainfrom
fix/truefoundry-stream-completion

Conversation

@nik13

@nik13 nik13 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow up on merged #1069. The normal TrueFoundry streaming application now refuses to print an incomplete answer as a successful result.

  • Require the requested choice's finish_reason="stop"; EOF, [DONE], empty/usage-only endings, token limits and content filtering do not count as a complete answer.
  • Use the SDK stream context manager so success, iteration failures and local aborts close the stream.
  • Preserve completed answers and trailing usage chunks. main() returns 1 with no partial answer on stdout when completion validation fails.
  • Keep tracing in the maintained package. No copied instrumentation, additional spans or public QA diary.

Verification

  • New application regressions before the change: 8 failed, 1 passed, including the completed-answer control.
  • Entire TrueFoundry recipe suite: 64 passed with the exact existing released requirements (OpenAI 3.42.0, traceai-openai 0.1.11, fi-instrumentation-otel 1.2.2).
  • Same 64 tests pass on OpenAI 1.69.0 and current latest 3.42.1 with the maintained integration fixes.
  • Independent exact main() truncation/completion probes pass at both SDK bounds.
  • Docs integration tests: 20 passed. Link audit: zero broken navigation/content links. Full Astro/Pagefind build passes.
  • Python tests and docs build ran with outbound networking denied and synthetic credentials only. No live gateway or Cloud verification is claimed. No rendered-page changes.

Release dependency

This fixes application behavior without waiting for a package release. The separate span-status/cancellation/privacy fixes remain in future-agi/traceAI#520 and future-agi/traceAI#536. The public registry still reports traceai-openai 0.1.12 and fi-instrumentation-otel 1.2.2, without those fixes. Existing recipe pins are intentionally unchanged: update them to genuine fixed releases when available, not invented versions. This PR is not a claim that the entire released telemetry recall is complete.

E2E coverage

The real SDK application entry point, mock HTTP transport, exit status/stdout, stream closure and existing loopback OTLP recipe tests are exercised; no application UI or e2e harness is changed.

Generated with Claude Code

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
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