copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

HydraFusion: after a 400 on the routed model, the session is re-routed to a small-context model that cannot load the static prompt; tool set changes mid-session

Open zekariasasaminew opened this issue 2 months ago • 2 comments

Summary

With HydraFusion selected, a session that had run for 37 minutes on the routed model (gpt-5.6-sol) got a 400 The requested model is not supported. On the next user turn the router re-resolved and switched the same session to mai-code-1.1-flash, whose context window cannot hold Copilot's own static system prompt and tool definitions. Every turn after that failed with compaction_static_context_blocked and No response was returned, so the session was unrecoverable without abandoning 372 AI credits of context. The fallback also replaced the tool set mid-task.

Environment

  • Copilot CLI 1.0.91, Windows 11, PowerShell 7
  • Enterprise endpoint (api.enterprise.githubcopilot.com)
  • Model: HydraFusion (picked in /model; policy: max, routeSource: capi_plan, pattern: single)
  • Session id a1200a27-25bf-4981-b556-788df9b3e211
  • Request ID of the 400: D852:1368A9:1B5D885:1D72AED:6ABFFD3A (serviceRequestId 21db88d8-c245-4158-b37f-4124608cdc35)

Timeline (from session-state/<id>/events.jsonl)

time (UTC) event
18:13:52 session.model_change source model_picker: auto → hydrafusion
18:13:57 session.fusion_resolved policy max, routeSource capi_plan, pattern single; the solver is gpt-5.6-sol (session.usage_checkpoint.modelCacheState)
18:14 to 18:51 76 assistant turns, 114 tool calls, all on gpt-5.6-sol; totalNanoAiu reaches 372,060,920,000
18:51:38 session.error: Execution failed: 400 The requested model is not supported.
18:58:58 user sends continue. The transformed message carries <tools_changed_notice>The model has been switched from gpt-5.6-sol to mai-code-1.1-flash. New tools available: create, edit, grep. Tools no longer available: apply_patch, rg</tools_changed_notice>
18:58:58 session.warning compaction_static_context_blocked: "Static system messages and tool definitions exceed the model's usable context budget. Reduce static context or switch to a larger-context model." then session.error "No response was returned. Send your message again to retry."
18:59:12 second continue: identical warning and error

What went wrong

  1. Fallback ignores the session's context requirements. A session carrying 372 credits of conversation on a 1M-window model was re-routed to a model that cannot even load the static prompt. The router treats "which solver" as a per-turn choice while the session carries state that constrains it. Whether a candidate fits the static context is knowable before the call.
  2. The 400 itself. The model the router had been calling successfully for 37 minutes became "not supported" mid-session. The router should retry within the same capability class rather than surface the 400 and then fall to the smallest model.
  3. Tool set swapped mid-task. The fallback changed the available editing tools (apply_patch/rg removed, create/edit/grep added) while the agent was in the middle of editing files. Even when a fallback fits, this is a correctness hazard for long autonomous runs.

Expected

  • A re-route never selects a model whose usable context is smaller than the static prompt plus the live conversation; if none fits, say so and keep the previous model selected so the user can /compact or continue.
  • After a 400 on the routed model, retry with an equivalent-class model (same or larger context) before anything else.
  • No tool-set change inside a session without the user choosing it.

Workaround

Pin a large-context model for long autonomous sessions instead of HydraFusion.

I can share the full events.jsonl privately if useful.

zekariasasaminew avatar Oct 02 '26 19:10 zekariasasaminew

I am seeing the reverse direction of this on Copilot CLI 1.0.91: HydraFusion selects mai-code-1.1-flash, receives an empty HTTP 400 before any request is counted, then hands the work to a gpt-5.6-sol repair phase.

Since October 2, my local event history contains five of these failures across three sessions, alongside eight successful MAI phases. Each failure reports requestCount: 0, zero input/output tokens and zero AI credits. All five repair phases on Sol succeeded.

MAI to Sol is not a lateral retry. It moves from the small, inexpensive primary selected by the cascade to a much more capable and expensive model. One of these repair phases ran for 43 minutes and used 565.7 AIC. The others used between 75.2 and 137.8 AIC.

Lerna is installed in these sessions, however, it explicitly bypasses mai-code-1.1-flash, so the failing MAI requests are going directly to Copilot. The session events contain only an empty 400 plus a GitHub request ID, so there is no client-visible validation error to diagnose.

This appears to be the same underlying problem from the other side: the fallback or repair path is crossing model classes rather than retrying with an equivalent model. In this direction the session recovers, but the cost and behavior change considerably.

sirredbeard avatar Oct 04 '26 04:10 sirredbeard

Related fallback evidence — not a reproduction of the context-window failure

[!WARNING] I observed a transition to mai-code-1.1-flash, but not the HTTP 400 → static-context failure sequence described here. I am posting this as a related routing path to investigate, not as confirmation of the full bug.

Observed on my setup

Field Value
Host macOS, VS Code 1.141.2 integrated Copilot agent host
Runtime 1.0.92-4.unstable.r37397886721.gad270aa
Event session.fusion_route_failed
Policy / reason max / invalid_response
Rejected routed model gpt-6.1-sol
Reported fallback model mai-code-1.1-flash

The error was fusion route references a model outside the selected policy universe. The directly matching router defect and a second rejected-model example are documented in #5097.

Why this may be relevant

This shows another entry point into a small-model fallback: policy-validation failure, rather than an HTTP 400 from an already-running model. If fallback compatibility checks are being added for this issue, it would be useful to cover this path too, including the existing static prompt/tool footprint.

Limits of my evidence
  • No compaction_static_context_blocked marker appeared in the five audited sessions during the inspected window.
  • I have not verified that the tool set changed mid-session.
  • The fallback model's capacity being insufficient in this particular session is not established.
  • My slow/expensive day also involved excessive custom-agent handoffs, reported separately in #4849; I do not attribute that whole experience to the context-window bug.

No raw chats, private project details, credentials, or session identifiers are attached.

pimmink avatar Oct 17 '26 14:10 pimmink