Skip to content

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

Merged
nik13 merged 2 commits into
mainfrom
fix/truefoundry-stream-completion
Nov 4, 2026
Merged

nik13 merged 2 commits 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

Limit ERROR status guidance to instrumented SDK and transport failures. Explain that application completeness validation cannot change the finished OK span with the existing published pins.

Exercise the real entry point and loopback OTLP for all stream endings while retaining output, closure, flush and shutdown assertions.

Co-Authored-By: Claude Code <[email protected]>
@nik13
nik13 merged commit 00dc3d8 into main Nov 4, 2026
6 checks passed
@nik13
nik13 deleted the fix/truefoundry-stream-completion branch November 4, 2026 17:09
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