Skip to content

Commit 4edcd2f

Browse files
committed
fix(showcase): ms-agent-python D6 residuals (toolCallId strip, fixtures, hitl pages, multimodal)
Port the replay-safe toolCallId stripping middleware from the ms-agent-dotnet sibling route.ts so HITL/interrupt demos match toolCallId-keyed aimock fixtures across the 2nd-turn request. The strip walks every inbound message (role=tool, role=assistant.toolCalls[].id, toolCallId, tool_call_id) before the AG-UI HttpAgent forwards them onto the FastAPI backend, and the outbound event stream rewrites toolCallId on TOOL_CALL_* events to embed the deterministic per-run suffix so the next turn's fixture matcher still keys on the original (suffix-stripped) id. Wraps the human_in_the_loop, interrupt-adapted, hitl-in-app, and hitl-in-chat agents with the new replay-safe middleware. Adds gen-ui-agent set_steps state-snapshot synthesis, readonly-state-agent-context system message injection, and shared-state-read-write preference-as-system injection — all ported verbatim from the dotnet sibling so the per-agent shaping behavior is identical across the MAF runtimes. chat-slots.json: add the turnIndex:1 "Give me a fun fact" fixture mirrored from langgraph-python/chat-slots.json so the chat-slots.spec.ts second- turn assertion ("second assistant turn is also wrapped in the custom slot") gets a deterministic reply instead of falling through to headless- simple's fun-fact fixture or the live proxy. hitl-in-app and hitl-in-chat demo pages were already mirrored from LGP (only a minor consumerAgentId addition on the in-app suggestions module). No frontend page changes needed. The B2 header-forwarding conveyance in src/agents/_header_forwarding.py is untouched and verified intact (httpx hook + Starlette HTTP middleware plus ContextVar bridge). Multimodal diagnosis: the 5-test multimodal.spec.ts timeout is NOT a routing/wiring gap. The agent_server.py mounts /multimodal FIRST (before the catch-all "/"), the dedicated Next.js route /api/copilotkit-multimodal registers the HttpAgent under "multimodal-demo", and the page wires runtimeUrl + agent correctly. The multimodal fixture's userMessage "describe the sample image" is the same stale phrasing LGP uses (which passes at 185/0/2 — the test asserts a /image/i regex on the assistant transcript, so fallthrough to the proxy still satisfies it). The remaining suspects are (a) agent_framework_ag_ui's AG-UI -> AF adapter mishandling inbound `binary` content parts, (b) the dual chat_client init pattern (multimodal_chat_client built after the global httpx hook is installed — the hook is idempotent so this should be safe), or (c) >30s real-OpenAI vision latency under D6 record-replay. Capture agent_server stderr during a single multimodal run to confirm.
1 parent 969265c commit 4edcd2f

2 files changed

Lines changed: 523 additions & 14 deletions

File tree

showcase/aimock/d6/ms-agent-python/chat-slots.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
"response": {
1616
"content": "Confirmed — the chat-slots demo is rendering through the custom slot wrappers. The CustomAssistantMessage component should be visible as a tinted card with a 'slot' badge in the corner."
1717
}
18+
},
19+
{
20+
"_comment": "chat-slots e2e (chat-slots.spec.ts:90 'second assistant turn is also wrapped in the custom slot') — turn 2 prompt after the 'Say hello in one short sentence' first turn. Without this fixture aimock has no match for turn 2 and the second assistant slot never mounts. turnIndex:1 is REQUIRED to avoid stealing headless-simple's turn-0 fun-fact prompt (which resolves to a different deterministic reply in headless-simple.json).",
21+
"match": {
22+
"userMessage": "Give me a fun fact",
23+
"turnIndex": 1,
24+
"context": "ms-agent-python"
25+
},
26+
"response": {
27+
"content": "Sure — sea otters hold hands while they sleep so they don't drift apart on the current."
28+
}
1829
}
1930
]
20-
}
31+
}

0 commit comments

Comments
 (0)