Keep the request prefix stable when an extension is enabled or disabled mid-session
- Dominant language
- Rust
- Stars
- 54.2k
- Forks
- 6.2k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 262
Description
**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
Contributor guide
Assessment
This issue has not been assessed yet.