Skip to content

fix(copilot): ensure requests don't end on an assistant prefill - #50055

Closed
arminanton wants to merge 1 commit into
NousResearch:mainfrom
arminanton:fix/copilot-assistant-prefill-trailing-user
Closed

fix(copilot): ensure requests don't end on an assistant prefill#50055
arminanton wants to merge 1 commit into
NousResearch:mainfrom
arminanton:fix/copilot-assistant-prefill-trailing-user

Conversation

@arminanton

Copy link
Copy Markdown
Contributor

Copilot's proxy rejects assistant-message prefill with "This model does not support assistant message prefill. The conversation must end with a user message." _ensure_copilot_request_ends_with_user appends a user turn on any path that would otherwise leave a trailing assistant turn, so reasoning/continuation requests stay valid on Copilot. Two call sites in the (streaming + non-streaming) interruptible API paths.

Copilot's proxy rejects assistant-message prefill with "This model does not support assistant message prefill. The conversation must end with a user message." `_ensure_copilot_request_ends_with_user` appends a user turn on any path that would otherwise leave a trailing assistant turn, so reasoning/continuation requests stay valid on Copilot. Two call sites in the (streaming + non-streaming) interruptible API paths.
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/copilot GitHub Copilot (ACP + Chat) P2 Medium — degraded but workaround exists labels Jun 21, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the Copilot compatibility investigation.

Automated hermes-sweeper review found that current main already provides this guarantee:

  • agent/conversation_loop.py:1904-1946 records a truncated assistant response and then appends a user continuation before issuing the next request.
  • agent/conversation_loop.py:907-917 removes thinking-only assistant prefills from the per-request wire copy, preserving role alternation without fabricating a request-only turn.
  • tests/run_agent/test_run_agent.py:4768-4788 verifies that the continuation request ends with a user message.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 14, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/copilot GitHub Copilot (ACP + Chat) sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants