agent: Account for max_output_tokens in compaction threshold (#59469)

Follow up to #58883

This makes sure that we subtract the max output tokens before checking
the threshold for auto compaction was reached, we had that logic before
#58883 but we lost it when introducing the settings. Without this GPT
models will run out of tokens before auto-compaction is run

Release Notes:

- (Preview only) Fixed an issue where auto compaction would not be
triggered
ea035a7a46Bennet Bo Fenner committed on 6/17/2026, 11:56:44 AM· committed by GitHubparentc7ad65e
1 file changedLine totals unavailable