Keep the request prefix stable when an extension is enabled or disabled mid-session
- Ngôn ngữ chính
- Rust
- Star
- 54.2k
- Fork
- 6.2k
- Merge trung bình
- 3 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 240
Mô tả
**What problem would this solve?**
Enabling or disabling an extension mid-session rewrites the `# Extensions` section of `system` and grows or shrinks `tools` in place. Every toggle busts the prompt cache on every provider, and on Anthropic it drops all preserved thinking, since signatures are bound to the exact `system` and `tools` that preceded them (#11800, area 3). Confirmed under enforcement on Fable 5.1.
**What would a good outcome look like?**
After the first assistant turn, an extension toggle leaves `system` and the existing `tools` entries byte-identical, and the model still learns about the change. Same behavior in both agent loops. Nothing lost on cancel, retry, or compaction.
**Possible approaches**
- Send the extension's instructions as an agent-only message instead of re-rendering the extensions section, mirroring #11284 for hints.
- On Anthropic, append new tools with `defer_loading: true` and describe the change with `tool_addition` / `tool_removal`; both are prefix-safe on the wire. Prior art in #10743.
- Disabled tools stay in `tools` and are refused at dispatch until the next compaction resets the prefix.
**Additional context**
Supersedes the "revive #10743" line and the general freeze in #11864 / #11839.
- [x] I have verified this does not duplicate an existing feature request
Hướng dẫn đóng góp
Hướng nghiên cứu
The issue is about the agent's request prefix and tool management. Look at the code handling the `system` prompt and `tools` list when extensions are toggled, likely in the agent loop or session management. Review the linked issues (#11800, #11284, #10743) for context on prefix stability and Anthropic's `defer_loading` and `tool_addition`/`tool_removal`. The goal is to modify the extension toggle logic to keep the prefix byte-identical while still informing the model of the change. Check for existing tests related to extension toggling or prompt caching.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust
- Lĩnh vực
- ai-infra-agents
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100