Skip to content

Fix Windows release smoke regressions in SDK ownership and samples - #1160

Open
bmehta001 wants to merge 1 commit into
mainfrom
fix/windows-release-smoke-regressions
Open

bmehta001 wants to merge 1 commit into
mainfrom
fix/windows-release-smoke-regressions

Conversation

@bmehta001

Copy link
Copy Markdown
Contributor

Summary

Fix non-provider regressions found during Windows smoke testing of release 2.1.0 from build 1448702:

  • Retain Python inline bytes, image, and audio buffers until native item destruction, including transfers into requests and queues. The native setters borrow payload pointers; keeping them only on the Python wrapper was insufficient. Add garbage-collection, allocation-churn, empty-payload, input-snapshot, and failure-cleanup regressions.
  • Return every loaded leaf variant from the native catalog, not only the selected variant of each alias. This fixes Rust reporting a successfully loaded model while get_loaded_models() was empty without changing selection.
  • Resolve the ambiguous OpenAI/Foundry ToolChoice in both C# tool-calling samples.
  • Dispose Python, C#, and JavaScript live-audio sessions after draining their streams and before unloading their models.
  • Avoid console cursor APIs in the shared C# spinner when stdout is redirected. This additional failure was exposed while capturing live-sample output.

Update the directly related ownership and lifecycle documentation.

Validation

  • Rebuilt the native Windows RelWithDebInfo SDK with the pinned dependencies.
  • All 23 BaseModelCatalogTest tests pass, including the new regression using checked-in tiny CPU model assets.
  • 92 Python item, native-lifetime, and live-adapter tests pass against both the release native package and the rebuilt native library.
  • The packaged Rust options consumer against the rebuilt library reports loaded_after_load: true and listed_after_load: 1, rather than the release baseline's zero.
  • Both C# tool-calling samples rebuild against release 2.1.0 using existing restored dependencies.
  • Corrected Python, C#, and JavaScript live-audio samples complete their synthetic-input paths and unload cleanly against release native code. The Python sample uses the corrected source Python bindings.
  • Ruff checks, C++ clang-format checks, JavaScript syntax checking, and git diff --check pass.

Synthetic sine-wave input exercises streaming and shutdown, not speech-recognition accuracy. The original Python access violation was reproduced, and borrowed-buffer corruption was independently demonstrated; its exact original native crash frame was not established.

Outstanding provider failures (not changed here)

  • Concurrent overlapping-prefix requests on qwen2.5-0.5b-instruct-openvino-gpu:2 fail with Infer Request is busy, reported by ov_compute.cc:25 and sequential_executor.cc:671.
  • Concurrent requests on qwen2.5-0.5b-instruct-trtrtx-gpu:2 reported CUDA_ERROR_STREAM_CAPTURE_INVALIDATED and stalled. That capture error was observed in the original terminal output, but was not located in the retained logs searched.
  • An isolated smoke-harness per-model lock avoided both concurrency failures. OpenVINO returned the expected 4/5/6; TensorRT completed but returned 4/6/7. The latter is not established as cross-request corruption.

No production provider locking or concurrency behavior is changed. Provider diagnosis/remediation remains separate. Java and Android were excluded as requested. These targeted validations do not establish exhaustive coverage of every API option or the entire sample suite.

Local diagnostic notes

Evidence is retained under the ignored sdk_v2\cpp\build\release-2.1.0-smoke directory, not included in this PR:

Issue or verification Log
Original Python access violation sample-py-live-audio-repro.log:14
Deterministic released-Python buffer corruption debug-buffer-baseline.log
Buffer-corrected sample exposing undisposed-session unload failure debug-live-original-sample-fixed.log
Final live-audio sample runs debug-live-python-final.log, debug-live-cs-final.log, debug-live-js-final.log
C# tool sample baseline compiler errors rebuild-cs-tool-calling-foundry-local-sdk.log, rebuild-cs-tutorial-tool-calling.log
Corrected C# tool sample builds debug-build-cs-tool-calling-foundry-local-sdk.log, debug-build-cs-tutorial-tool-calling.log
Original Rust loaded-model listing discrepancy rust-options-catalog-verified.log
Corrected Rust listing and options debug-rust-fixed-native.log
Native build and catalog regressions debug-native-build-validated.log, debug-catalog-regression-final.log
Python tests against rebuilt native library debug-python-source-native-final.log, debug-python-source-native-lifetimes.log
Serialized provider experiments debug-openvino-serialized-release.log, debug-tensorrt-serialized-release.log

The original OpenVINO busy errors are also in the local Foundry log foundry_local_2026-09-29.log:3-6.

Retain Python inline payloads until native destruction and enumerate all loaded catalog variants. Resolve C# ToolChoice ambiguity, dispose live-audio sessions before unloading models, and handle redirected sample output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 481d3cfe-f201-40de-8105-462a47ad1dec
Copilot AI balanced review requested due to automatic review settings September 30, 2026 07:50
@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
foundry-local Ready Ready Preview Sep 30, 2026 7:50am UTC

Request Review

Copilot AI left a comment

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.

Copilot review overview

🟢 Approval recommended

The ownership, enumeration, and sample lifecycle fixes are coherent and covered by targeted regressions.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes release smoke-test regressions involving native ownership, catalog enumeration, and sample cleanup.

Changes:

  • Retains Python inline buffers until native item destruction.
  • Returns all loaded catalog leaf variants.
  • Corrects sample compilation, session disposal, and redirected-output handling.
File Description
sdk_v2/​python/​test/​unit/​test_items.py Adds buffer lifetime and cleanup regressions.
sdk_v2/​python/​src/​foundry_local_sdk/​items.py Retains buffers through native deleters.
sdk_v2/​python/​README.md Documents inline-buffer ownership.
sdk_v2/​cpp/​test/​internal_api/​base_model_catalog_test.cc Tests loaded non-selected variants.
sdk_v2/​cpp/​src/​catalog/​base_model_catalog.cc Enumerates loaded leaf variants.
sdk_v2/​cpp/​include/​foundry_local/​foundry_local_cpp.h Clarifies loaded-model semantics.
samples/​python/​live-audio-transcription/​src/​app.py Closes the session before unload.
samples/​python/​live-audio-transcription/​README.md Documents session closure.
samples/​js/​live-audio-transcription/​app.js Disposes sessions before unload.
samples/​cs/​tutorial-tool-calling/​Program.cs Disambiguates ToolChoice.
samples/​cs/​tool-calling-foundry-local-sdk/​Program.cs Disambiguates ToolChoice.
samples/​cs/​Shared/​Utils.cs Avoids cursor APIs for redirected output.
samples/​cs/​live-audio-transcription/​Program.cs Disposes the session before unload.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bmehta001 bmehta001 self-assigned this Sep 30, 2026

This branch was successfully deployed

1 active deployment
Preview — 6eddc143 Deployed Sep 30, 2026 by vercel[bot]
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