Repository navigation
Commit 5b08fc2
committed
Python: Clear service_session_id in AgentExecutor on full-history replay (microsoft#3295)
Defense-in-depth follow-up to 31d126c. When a coordinator hands an
AgentExecutor an AgentExecutorRequest carrying function-call or
function-result items and the executor's session already has a
service_session_id from a prior run, clear the id before invoking.
This stops the chat client from pairing the supplied messages with a
previous_response_id that points at a different conversation.
The wire-level "Duplicate item" error was already closed by the
chat-client strip in microsoft#3295. This change makes the executor wiring
reflect intent: the executor is replaying a conversation it does not
own, so it should not present continuation context from a prior
response at all.
Decisions:
- Trigger only when the request carries function_call/function_result
items. Plain text replays do not need the clear.
- from_response handoff path is unchanged. The companion test
test_from_response_preserves_service_session_id continues to lock the
inverse case.
- No new public API. A small helper _carries_tool_items keeps the run()
body readable.
Files:
- python/packages/core/agent_framework/_workflows/_agent_executor.py:
add _carries_tool_items helper and clear-on-replay branch in run().
- python/packages/core/tests/workflow/test_full_conversation.py: drop
the strict xfail on test_run_request_with_full_history_clears_service_session_id;
the test now passes for the reason its name describes (executor
clears the id) rather than masked by the chat-client strip.
Notes for next iteration:
- pytest was not run in this iteration; uv-based pytest commands
required interactive approval. Validation rests on careful reading
and the existing strict-xfail contract. Next iteration should run the
core test suite to confirm.1 parent 3aa4a28 commit 5b08fc2
2 files changed
Lines changed: 14 additions & 10 deletions
File tree
- python/packages/core
- agent_framework/_workflows
- tests/workflow
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
32 | 39 | | |
33 | 40 | | |
34 | 41 | | |
| |||
205 | 212 | | |
206 | 213 | | |
207 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
208 | 222 | | |
209 | 223 | | |
210 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
428 | 427 | | |
429 | 428 | | |
430 | 429 | | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | 430 | | |
441 | 431 | | |
442 | 432 | | |
| |||
0 commit comments