Skip to content

FIX Stop Copilot and A2A targets from silently losing conversation history - #3078

Open
Utkarsh Bahuguna (u7k4rs6) wants to merge 6 commits into
microsoft:mainfrom
u7k4rs6:fix/stateful-target-history
Open

Utkarsh Bahuguna (u7k4rs6) wants to merge 6 commits into
microsoft:mainfrom
u7k4rs6:fix/stateful-target-history

Conversation

@u7k4rs6

Copy link
Copy Markdown
Contributor

Fixes #3077.

Three parts, one commit each:

  • Copilot: if a conversation already has turns (besides a system prompt) but no live session, raise instead of opening a new session and sending only the last turn. Same idea as A2A's existing "no upstream context" error. A system prompt alone still starts a session normally.
  • A2A: new conversations start with a contextId we generate, so turn 2 continues the same context even when the agent's reply has no contextId or turn 1 errored. If the agent returns its own contextId we switch to it, like before.
  • Repeat-send: submit_async now rejects count > 1 when the target lacks editable history and the conversation already has turns, so it fails up front instead of answering each copy blind. Repeat-send on a new conversation still works.

Checked against the real flows (mocked Copilot SDK, real MessageSendService, in-process a2a-sdk server):

  • main: two of three repeat-send copies got answered by sessions that only saw the last message; A2A turn 2 raised on protocol 0.3 and 1.0.
  • this branch: repeat-send is rejected with a clear error, Copilot raises instead of answering blind, A2A turn 2 works on both protocol versions (the server even adopts our context id).

Tests: Copilot restart case plus system-prompt-only case, A2A own-context and agent-context cases, and the repeat-send reject and new-conversation cases. The new ones fail on main. tests/unit/prompt_target, backend and prompt_normalizer: 3939 passed (4 MCP/tool test files didn't collect locally because httpx2 isn't installed here; they don't touch this code).

This branch has not been deployed

No deployments
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.

Copilot and A2A targets lose conversation history without saying so

2 participants