[Bug] BYOK Anthropic provider does not emit turn lifecycle and reasoning events
- 主要語言
- Shell
- 星號
- 11.2k
- 分支
- 1.9k
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 6
描述
### Describe the bug
When using a BYOK Anthropic provider (`type: "anthropic"`) with the Copilot SDK, several session events are never delivered to the SDK over the JSON-RPC notification channel. The SDK team investigated and confirmed the root cause is in the CLI.
See [github/copilot-sdk#1064](https://github.com/github/copilot-sdk/issues/1064) for the full SDK-side investigation.
The following events fire correctly with the default backend and BYOK OpenAI, but are absent with BYOK Anthropic:
- `assistant.turn_start`
- `assistant.turn_end`
- `assistant.reasoning`
- `assistant.reasoning_delta`
- `session.usage_info`
### Affected version
GitHub Copilot CLI 1.0.24-0.
### Steps to reproduce the behavior
A repro script that creates identical sessions across three backends and compares the set of event types delivered to `on_event` is available in the SDK issue linked above. Summary of output:
```
Default (claude-haiku-4.5): turn_start=2, turn_end=2, usage=2, message=2
BYOK Anthropic (claude-haiku-4-5): turn_start=0, turn_end=0, usage=2, message=2
BYOK Anthropic (claude-sonnet-4-6): turn_start=0, turn_end=0, usage=2, message=2
BYOK OpenAI (gpt-5.4-nano): turn_start=2, turn_end=2, usage=2, message=2
```
### Expected behavior
All backends should emit `assistant.turn_start` and `assistant.turn_end` events. The SDK documentation lists both as non-ephemeral events that are always emitted, and the agent loop documentation states "the number of `assistant.turn_start` / `assistant.turn_end` pairs equals the total number of LLM API calls."
### Additional context
- **SDK:** `github-copilot-sdk==0.2.2`
- **Provider:** Azure AI Foundry with `type: "anthropic"` provider config
- **Models tested:** `claude-haiku-4-5`, `claude-sonnet-4-6` -- both missing events
- **Controls:** Default backend and BYOK OpenAI (`gpt-5.4-nano`) on the same Foundry endpoint emit all events correctly
- **Impact:** Code that relies on turn boundaries for per-turn token accounting gets no turn-level granularity with BYOK Anthropic. `assistant.usage` events do fire, so session-level totals are still available.
貢獻指南
研究方向
從連結的 github/copilot-sdk#1064 調查及其重現腳本開始;比較預設、BYOK Anthropic 和 BYOK OpenAI 工作階段透過 JSON-RPC 通知通道傳遞的事件類型。追蹤 CLI 的 BYOK Anthropic 事件路徑,並在回合生命週期、推理和用量事件與預期的後端行為一致時驗證完成情況。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- azure, shell
- 領域
- api
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100