Skip to content

Fix notetaking Responses samples losing notes on new hosted sessions - #1067

Closed
Hui Miao (huimiu) wants to merge 2 commits into
mainfrom
fix/notetaking-responses-session-id
Closed

Hui Miao (huimiu) wants to merge 2 commits into
mainfrom
fix/notetaking-responses-session-id

Conversation

@huimiu

Copy link
Copy Markdown
Member

Fixes #1038

This re-submits the fix proposed in #1039 on a branch in microsoft-foundry/foundry-samples.

When a hosted Responses agent starts a new session, the platform provides the session ID through FOUNDRY_AGENT_SESSION_ID; the request body may not contain agent_session_id. The Python and C# handlers now resolve IDs in this order:

  • agent_session_id from the request body
  • FOUNDRY_AGENT_SESSION_ID from the hosted environment
  • The existing "default" fallback

This keeps the initial note write and later reads on the same session-specific file while preserving local and direct-call behavior.

Validation:

  • Python syntax check passed.
  • dotnet build passed with 0 warnings and 0 errors.
  • Not tested against a live hosted deployment.

When a hosted invoke omits agent_session_id from the request body, fall
back to the platform-supplied FOUNDRY_AGENT_SESSION_ID before the shared
"default" key, so notes are keyed to the session that actually runs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5669b012-ea21-4939-93f9-ea72266b7852
Copilot AI balanced review requested due to automatic review settings October 13, 2026 03:16

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.

🟢 Approval recommended

Both implementations consistently apply the documented fallback order without introducing unresolved issues.

0 open findings

What changed in this PR

Fixes session-scoped note persistence when hosted Responses requests omit the session ID from the body.

Changes:

  • Falls back to FOUNDRY_AGENT_SESSION_ID in Python and C#.
  • Preserves body-provided IDs and the local "default" fallback.
File Description
samples/​python/​.../​main.py Adds hosted environment session-ID fallback.
samples/​csharp/​.../​Program.cs Adds equivalent session-ID resolution for .NET.

🧠 Review effort: Balanced


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

This branch was successfully deployed

1 active deployment
L4-validation — aa43a867 Deployed Oct 13, 2026 by huimiu via trusted #518
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.

Note-Taking Agent does not invoke tools when starting a new session in remote

3 participants