Wrap streaming callback properly in C++ - #1061
Open
Scott McKay (skottmckay) wants to merge 4 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Copilot started reviewing on behalf of
Scott McKay (skottmckay)
September 2, 2026 00:02
View session
Merged
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The port guide incorrectly states that streamed and final response item types always match.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds an item-oriented C++ streaming callback so consumers no longer need C API queue handling.
Changes:
- Adds
std::function<int(Item)>callback support with RAII ownership. - Deprecates the raw C callback overload and adds callback clearing.
- Updates tests, examples, and documentation.
File summaries
| File | Description |
|---|---|
foundry_local_cpp.h |
Declares callback API and adapter. |
foundry_local_cpp.inline.h |
Implements callback registration. |
streaming_audio_test.cc |
Exercises item-based audio streaming. |
chat_session_test.cc |
Exercises item-based tool streaming. |
examples/tool_calling/main.cc |
Simplifies tool callback usage. |
examples/realtime_audio/main.cc |
Simplifies audio callback usage. |
examples/basic_chat/main.cc |
Simplifies text callback usage. |
docs/CppPortGuide.md |
Documents the new callback contract. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Scott McKay (skottmckay)
enabled auto-merge (squash)
September 2, 2026 02:05
…s://github.com/microsoft/foundry-local into skottmckay/ImproveCppStreamingCallbackWrapping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The callback didn't get full wrapped, forcing users to drop to the C API level. They shouldn't need to do that in general, so fix the wrapping so they can deal in the Item returned.