mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
d6b006dbab
The main /api/copilotkit route wraps its handlers in withForwardedHeaders
(ALS) and its factory builds openaiText(..., { fetch: forwardingFetch }),
so inbound x-aimock-context propagates to aimock on every outbound LLM
call. Every other demo route was missing one or both halves: the dedicated
runtimes were not ALS-wrapped and their factories built openaiText(...)
without the forwarding fetch, so those routes dropped x-aimock-context and
aimock returned 503 strict-mode misses (deterministic ctx-missing).
Apply the working main-route pattern everywhere:
- Add fetch: forwardingFetch to every openaiText(...) construction in the
demo factories (a2ui main + secondary LLM, a2ui-fixed-schema, byoc-hashbrown,
byoc-json-render, mcp-apps, ogui, reasoning, subagent-tools) and the inline
agent-config route factory.
- Wrap every demo route handler in withForwardedHeaders (agent-config,
byoc-hashbrown, byoc-json-render, mcp-apps, reasoning, ogui,
a2ui-fixed-schema, declarative-gen-ui, multimodal, voice, auth).
Verified locally against strict aimock with d6 built-in-agent fixtures:
agent-config and declarative-gen-ui turns went from 503 ctx-missing
(x-aimock-context absent) to 200 fixture-matched (x-aimock-context present)
in the aimock journal.