ACP: a content-filtered model response ends the turn with `stopReason: "end_turn"` and sends no message

未關閉
#5,602 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
68/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python

研究方向

Trace how copilot --acp turns session events into session/update notifications and maps the final result to stopReason; the issue does not name source files or tests. Compare the ACP path with the interactive CLI handling of finishReason: "content_filter" and assistant.message, then reproduce with the described OpenAI or Anthropic stub. Done when the filtering notice reaches the ACP client and the prompt result reports stopReason: "refusal".

由索引模型根據 Issue 內容生成。

描述

area:non-interactive

Summary

When the model's response is blocked by content filtering, copilot --acp sends no session/update for the turn and answers session/prompt with stopReason: "end_turn". The ACP client sees an ordinary finished turn with no reply, and the user gets a blank turn with no explanation.

The interactive CLI handles the same case: the session records finishReason: "content_filter", contentFilterTriggered: true, and an assistant.message that reads "The model returned no content because the response was blocked by content filtering." The ACP layer drops both the message and the stop reason.

Version

GitHub Copilot CLI 1.0.117 (also seen on 1.0.116), Linux x64, ACP protocol version 1 (client offers 2).

Repro

Use a stub BYOK endpoint so no real model call or harmful prompt is needed.

  1. Run an OpenAI-compatible stub that streams an empty assistant delta, then finish_reason: "content_filter". (Or an Anthropic stub that streams message_start, then message_delta with stop_reason: "refusal", then message_stop.)
  2. Start copilot --acp --allow-all with COPILOT_OFFLINE=true, COPILOT_PROVIDER_BASE_URL pointing at the stub, and COPILOT_PROVIDER_TYPE=openai (or anthropic).
  3. Send initialize, session/new, then session/prompt with any text.

Actual

{"jsonrpc":"2.0","id":3,"result":{"stopReason":"end_turn","usage":{"inputTokens":5,"outputTokens":0,"totalTokens":5,"cachedReadTokens":0,"cachedWriteTokens":0}}}

No agent_message_chunk arrives between the prompt and the result. Both stub variants (OpenAI content_filter and Anthropic refusal) give the same output. The session's events.jsonl has the content_filter usage record and the filtering notice as an assistant.message.

A control run with a normal stub reply sends an agent_message_chunk with the text and stopReason: "end_turn", as expected.

Expected

  • session/prompt returns stopReason: "refusal". The ACP spec defines it for this case and asks clients to show it.
  • The filtering notice reaches the client, for example as an agent_message_chunk, or in _meta with the refusal category when the API supplies one.

Impact

ACP clients such as T3 Code already render stopReason: "refusal" as a visible failure. With end_turn they record a completed turn with no reply, and users read it as a lost answer or a hang.

主要語言
Python
星號
11.5k
分支
2k
平均合併
6 小時 34 分鐘
30 天內合併 PR
3

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/copilot-cli 的其他 Issue

查看 github/copilot-cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。