lekt8
8c376d2b0e
feat: adapt agent_input_token_budget to the model context window ( #1170 ) ( #1230 )
...
The agent soft-trims input context to `agent_input_token_budget` (default 6000).
The old computation `min(context_length or budget, budget)` made the 6000 default
a hard ceiling for every model, so 128K/1M context models were silently capped at
6000 input tokens — now that num_ctx is sent correctly (#1056 ), this was the last
barrier to actually using a long context window.
This derives the default budget from the model's discovered context window
(~85%, capped at a generous hard max) while honouring an explicit user setting
exactly (clamped to the window). When the window is unknown it falls back to the
previous value, so behaviour is unchanged for that case.
- src/context_budget.py: pure `compute_input_token_budget()` (unit-testable)
- src/settings.py: `is_setting_overridden()` to tell an explicit user value from
the merged default (load_settings merges DEFAULT_SETTINGS, so equality alone
can't distinguish them)
- src/agent_loop.py: use the helper in the soft-trim path
Covered by tests/test_context_budget.py (6 cases).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-03 00:13:53 +09:00
..
2026-05-31 23:58:26 +09:00
2026-05-31 23:58:26 +09:00
2026-06-01 14:32:41 +09:00
2026-06-02 20:35:57 +09:00
2026-06-02 13:06:09 +09:00
2026-06-02 20:28:26 +09:00
2026-06-02 20:42:32 +09:00
2026-06-02 01:32:00 +02:00
2026-06-01 02:22:17 +00:00
2026-06-02 05:48:59 +09:00
2026-06-02 20:42:10 +09:00
2026-06-02 06:02:49 +09:00
2026-06-02 05:55:03 +09:00
2026-06-02 12:40:28 +09:00
2026-06-02 23:14:52 +09:00
2026-06-02 20:42:37 +09:00
2026-06-01 13:42:44 +09:00
2026-06-02 20:55:30 +09:00
2026-06-02 21:00:58 +09:00
2026-06-02 20:52:03 +09:00
2026-06-02 20:52:08 +09:00
2026-06-01 22:33:35 +09:00
2026-06-01 22:22:41 +09:00
2026-06-02 20:42:21 +09:00
2026-06-02 20:29:37 +09:00
2026-06-02 13:15:22 +09:00
2026-06-01 22:24:27 +09:00
2026-06-03 00:13:53 +09:00
2026-06-01 12:38:35 +09:00
2026-06-02 12:59:29 +09:00
2026-06-03 00:09:48 +09:00
2026-06-02 23:17:16 +09:00
2026-06-02 22:52:37 +09:00
2026-06-02 12:25:56 +09:00
2026-06-02 11:50:03 +09:00
2026-06-02 20:34:25 +09:00
2026-06-02 23:52:22 +09:00
2026-06-02 12:41:25 +09:00
2026-06-02 11:48:54 +09:00
2026-06-02 20:35:27 +09:00
2026-06-02 06:00:02 +09:00
2026-06-02 23:11:04 +09:00
2026-06-02 20:28:01 +09:00
2026-06-02 13:15:06 +09:00
2026-06-02 23:28:24 +09:00
2026-06-03 00:09:48 +09:00
2026-06-02 11:10:43 +09:00
2026-06-01 14:23:22 -04:00
2026-06-02 22:34:52 +09:00
2026-06-02 22:35:30 +09:00
2026-06-02 20:32:56 +09:00
2026-06-02 20:34:05 +09:00
2026-06-01 22:35:24 +09:00
2026-06-02 11:36:01 +09:00
2026-06-02 21:01:42 +09:00
2026-06-01 22:47:47 +09:00
2026-06-02 23:12:34 +09:00
2026-06-02 13:07:20 +09:00
2026-06-02 22:36:12 +09:00
2026-06-02 23:02:28 +09:00
2026-06-02 11:12:54 +09:00
2026-06-02 11:14:31 +09:00
2026-06-02 05:54:23 +09:00
2026-06-02 11:37:25 +09:00
2026-06-02 20:27:24 +09:00
2026-06-02 11:48:17 +09:00
2026-06-02 20:44:13 +09:00
2026-06-02 11:39:40 +09:00
2026-06-02 20:58:33 +09:00
2026-06-02 23:04:58 +09:00
2026-06-02 23:01:04 +09:00
2026-06-02 20:36:54 +09:00
2026-06-02 11:47:58 +09:00
2026-06-02 11:49:44 +09:00
2026-06-02 22:41:27 +09:00
2026-06-02 11:28:52 +09:00
2026-06-02 11:50:17 +09:00
2026-06-02 11:46:06 +09:00
2026-06-02 11:27:31 +09:00
2026-06-02 23:31:09 +09:00
2026-06-02 20:33:09 +09:00
2026-06-02 23:41:04 +09:00
2026-06-02 21:00:50 +09:00
2026-06-02 20:51:16 +09:00
2026-06-02 20:31:35 +09:00
2026-06-02 11:41:33 +09:00
2026-06-02 12:24:18 +09:00
2026-06-01 18:27:17 +09:00
2026-06-02 20:35:44 +09:00
2026-06-02 11:28:52 +09:00
2026-06-01 22:33:35 +09:00
2026-06-01 22:36:53 +09:00
2026-06-02 20:45:48 +09:00
2026-06-02 20:32:08 +09:00
2026-06-02 23:43:53 +09:00
2026-06-02 20:42:43 +09:00
2026-06-02 11:11:17 +09:00
2026-06-02 12:53:50 +09:00
2026-06-02 22:42:23 +09:00
2026-05-31 23:58:26 +09:00
2026-06-02 23:33:22 +09:00
2026-06-02 23:18:15 +09:00
2026-06-02 11:42:20 +09:00
2026-06-02 20:42:15 +09:00
2026-06-02 22:51:25 +09:00
2026-06-02 11:30:53 +09:00
2026-06-02 11:27:31 +09:00
2026-06-01 23:25:38 +01:00
2026-06-01 22:26:37 +09:00
2026-06-02 05:58:58 +09:00
2026-06-02 12:24:50 +09:00
2026-06-02 20:37:14 +09:00
2026-06-02 11:43:30 +09:00
2026-06-02 10:53:33 +09:00
2026-06-02 23:37:15 +09:00
2026-06-02 20:53:07 +09:00
2026-06-02 21:02:26 +09:00
2026-06-01 23:09:41 +09:00
2026-05-31 23:58:26 +09:00
2026-06-02 20:29:56 +09:00
2026-06-02 23:09:15 +09:00
2026-06-02 12:34:42 +09:00
2026-06-02 21:02:26 +09:00
2026-06-02 20:51:26 +09:00
2026-06-01 16:55:09 +09:00
2026-06-02 11:39:01 +09:00
2026-06-01 23:11:50 +09:00
2026-06-01 22:38:56 +09:00
2026-06-02 23:20:00 +09:00
2026-06-02 11:15:45 +09:00
2026-06-02 20:28:36 +09:00
2026-06-02 11:21:27 +09:00
2026-06-02 10:44:39 +09:00
2026-06-02 20:36:13 +09:00
2026-06-02 20:36:37 +09:00
2026-06-02 20:43:24 +09:00
2026-06-02 20:51:21 +09:00
2026-06-02 11:29:29 +09:00
2026-06-02 20:32:20 +09:00
2026-06-02 23:13:30 +09:00
2026-06-02 23:22:57 +09:00
2026-06-02 20:44:27 +09:00
2026-06-02 20:43:29 +09:00
2026-06-02 12:57:45 +09:00
2026-06-02 20:51:39 +09:00
2026-06-02 20:42:26 +09:00
2026-06-02 23:46:33 +09:00
2026-06-02 12:25:43 +09:00
2026-06-02 23:03:46 +09:00
2026-06-01 13:09:21 +09:00
2026-06-01 22:26:13 +09:00
2026-06-02 20:28:12 +09:00
2026-06-02 11:23:40 +09:00
2026-06-02 20:45:32 +09:00
2026-06-02 20:44:24 +09:00