mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
b69ac14711
Review found two gaps in the previous commit. `RunAgentInput.context` never reached the model. The bridge puts it on state under `context`, but `CopilotKitState` does not declare the field, so pydantic drops it when the endpoint validates the request into the Flow's state and the "Application context" block rendered without it. That hollowed out the two cells whose whole point is reading application context: readonly-state-agent-context (now on the default `/chat` route) and agent-config. `ChatState` declares the field so it survives validation. Neither existing test caught it: the readonly probe only asserts the browser request body carries its sentinel, the agent-config probe encodes the expected value in the user message, and Flow-level unit tests bypass endpoint state initialization. The new endpoint test drives the real FastAPI route with two context entries and asserts both appear in the model's system message; it fails without the declared field. The Channels setup fragment still told readers the shared crew sits at the server root and set `AGENT_URL` accordingly, which the removed catch-all turned into a dead endpoint. It now points at `/chat` and says Flow rather than crew. Migrating the consumer was preferred over restoring `/`, which would put the silent-fallback trap back in place. Verified: 164 and 166 Python tests pass across the two columns, the docs setup-content tests pass (16), and readonly-state-agent-context, agent-config and agentic-chat are green on D6 replay.