Skip to content

Commit 6766963

Browse files
jodeklotzmsclaude
andcommitted
fix: multi-turn session reuse via raw_body session_id fallback
conversation_id is only set when the request includes an explicit "conversation" field. Most callers (invoke scripts, Playground) only send session_id. The adapter now falls back to context.raw_body ["session_id"] and sets it on context.conversation_id so session reuse and history bootstrap work transparently. Also adds build tag canary for deployment verification. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ac71e54 commit 6766963

File tree

1 file changed

+12
-12
lines changed
  • sdk/agentserver/azure-ai-agentserver-githubcopilot/azure/ai/agentserver/githubcopilot

1 file changed

+12
-12
lines changed

sdk/agentserver/azure-ai-agentserver-githubcopilot/azure/ai/agentserver/githubcopilot/_copilot_adapter.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141

4242
logger = logging.getLogger("azure.ai.agentserver.githubcopilot")
4343

44+
# Version canary — proves which code is deployed. Change this string with every deploy-affecting commit.
45+
_BUILD_TAG = "replat-v2-multiturn-rawbody-fix"
46+
logger.info(f"Adapter loaded: {_BUILD_TAG}")
47+
4448

4549
def _extract_input_with_attachments(request) -> str:
4650
"""Extract text from a RAPI request, including any file/image attachments.
@@ -365,20 +369,16 @@ async def _handle_create(self, request, context, cancellation_signal):
365369

366370
# Resolve conversation identity for multi-turn session reuse.
367371
# Prefer conversation_id from the context (set when the request includes
368-
# a "conversation" field). Fall back to session_id from the parsed
369-
# request so that callers who only pass session_id still get multi-turn.
372+
# a "conversation" field). Fall back to session_id from the raw request
373+
# body so callers who only pass session_id still get multi-turn.
370374
conversation_id = getattr(context, "conversation_id", None)
371375
if not conversation_id:
372-
# Try session_id from the parsed request object
373-
parsed = getattr(context, "request", None) or getattr(context, "parsed", None)
374-
if parsed is not None:
375-
conversation_id = getattr(parsed, "session_id", None)
376-
# Last resort: check the raw request
377-
if not conversation_id:
378-
if isinstance(request, dict):
379-
conversation_id = request.get("session_id")
380-
else:
381-
conversation_id = getattr(request, "session_id", None)
376+
raw_body = getattr(context, "raw_body", None)
377+
if isinstance(raw_body, dict):
378+
conversation_id = raw_body.get("session_id")
379+
if conversation_id:
380+
# Also set on context so downstream code (e.g. history bootstrap) sees it
381+
context.conversation_id = conversation_id
382382

383383
response_id = getattr(context, "response_id", None) or "unknown"
384384

0 commit comments

Comments
 (0)