mirror of
https://github.com/block/buzz.git
synced 2026-10-31 22:41:12 +00:00
Finding A: clear model_capabilities in SwitchModel worker handler so return_agent preserves Unknown instead of restoring the outgoing model's stale Supported snapshot. The pool was already set to Unknown in handle_switch_model_control; the worker's own cleared field prevents the cancelled return from overwriting it before the requeued switch lands. Finding B: introduce ModelSwitchOutcome enum (Applied/Rejected) to replace the overloaded Value::Null sentinel. On Rejected, the pre-switch capabilities and cache are preserved (session is still on default model), switch_succeeded is false, and a terminal control_result failure is emitted so Desktop ModelPicker rejects the live pick immediately. The optionless-success and rejection paths are now distinct: optionless success drops to Unknown, a rejection preserves existing capabilities. Two lifecycle regressions added (no manual capability injection): - test_busy_switch_clears_capabilities_so_return_preserves_unknown: starts Supported, simulates SwitchModel handler clearing caps, calls return_agent, asserts Unknown preserved. - test_switch_rpc_rejection_preserves_pre_switch_capabilities: scripted ACP returning a JSON-RPC error from the switch RPC; asserts pre-switch caps intact, modelOverridden false, control_result failure emitted. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>