acp_thread: Clarify max token limit error message (#52724)
Om Chillure
and
Bennet Bo Fenner
created
When generation stops due to the per-response output limit, Zed was
surfacing "Max tokens reached", which implies the full context window
was exhausted. In reality, `max_output_tokens` (the per-response cap)
may have been hit a different condition.
This change distinguishes between the two cases: if `output_tokens >=
max_output_tokens`, it surfaces "Maximum output tokens reached";
otherwise it falls back to "Maximum tokens reached".
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Closes #50254
Note : Reopens #50372 suggested by @bennetbo
Release Notes:
- Fixed misleading "Max tokens reached" error by distinguishing between
per-response output token limit and total context window limit.
---------
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>