686f6c61
c0aaa238f6
feat(compression): usage anchor survives DB reloads and process restarts (salvage #99585 )
...
The usage anchor (real usage.prompt_tokens + delta estimate of what was appended since)
identified the priced transcript by id() of the last message, so it was None on EVERY
gateway turn (history is re-read from the DB each turn) and in every fresh process
(--resume, desktop per-turn serve). Those are exactly the surfaces where the bytes/4
estimate then fired local compression against payloads the provider priced far under
threshold (#99421 , #104462 ).
- agent/usage_anchor.py owns the anchor: content fingerprint instead of id(), persisted on
the session row (model_config._usage_anchor) via set_usage_anchor(), restored on the first
resumed turn while the durable transcript still matches, cleared with the row on
compaction / codex-native rewrite / session reset.
- Callers repointed from model_metadata (the compat table follows).
Design and persistence slot from #99585 by @686f6c61; re-authored against the Sep 2026
layout (the branch predates the model_metadata / agent_init split).
2026-09-06 13:21:17 -07:00
..
2026-09-03 17:13:22 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 00:15:16 -07:00
2026-09-06 05:42:22 -07:00
2026-09-06 20:50:02 +05:30
2026-09-02 13:29:48 -07:00
2026-09-03 13:16:47 -07:00
2026-09-02 18:56:06 -07:00
2026-09-03 09:44:26 -07:00
2026-09-06 13:21:17 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 02:12:35 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 13:16:47 -07:00
2026-09-06 05:37:03 -07:00
2026-09-06 05:37:03 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 20:10:26 -07:00
2026-09-02 21:38:20 -07:00
2026-09-03 17:13:22 -07:00
2026-09-07 00:41:09 +05:30
2026-09-03 13:29:35 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 08:15:22 -07:00
2026-09-02 18:18:18 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 18:49:57 -07:00
2026-09-02 18:49:57 -07:00
2026-09-02 18:49:57 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 00:15:16 -07:00
2026-09-05 10:54:19 +05:30
2026-09-07 00:41:09 +05:30
2026-09-05 06:09:24 -07:00
2026-09-02 18:47:54 -07:00
2026-09-06 09:09:00 -07:00
2026-09-06 13:21:17 -07:00
2026-09-06 22:45:31 +05:30
2026-09-02 18:18:18 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 09:44:26 -07:00
2026-09-06 13:21:17 -07:00
2026-09-06 09:09:00 -07:00
2026-09-03 09:44:26 -07:00
2026-09-05 16:44:23 +05:30
2026-09-06 13:21:17 -07:00
2026-09-06 13:21:17 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 18:57:14 -07:00
2026-09-05 17:43:45 +05:30
2026-09-03 22:00:01 -07:00
2026-09-03 13:48:49 -07:00
2026-09-03 09:44:26 -07:00
2026-09-04 08:15:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 18:58:42 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 04:31:46 -07:00
2026-09-06 05:48:39 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 13:29:48 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 18:22:13 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 19:23:20 -07:00
2026-09-02 19:32:53 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 18:58:42 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 18:53:53 -07:00
2026-09-05 13:51:06 -07:00
2026-09-03 13:28:22 -07:00
2026-09-02 18:22:13 -07:00
2026-09-02 18:58:42 -07:00
2026-09-02 18:22:13 -07:00
2026-09-02 20:02:44 -07:00
2026-09-03 22:00:01 -07:00
2026-09-02 19:22:42 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 18:22:13 -07:00
2026-09-02 18:29:05 -07:00
2026-09-02 22:21:06 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 19:50:13 -07:00
2026-09-02 18:28:38 -07:00
2026-09-02 18:28:38 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 19:10:21 -07:00
2026-09-06 13:21:17 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 18:33:06 -07:00
2026-09-06 09:09:00 -07:00
2026-09-04 00:15:16 -07:00
2026-09-06 09:11:04 -07:00
2026-09-02 22:21:06 -07:00
2026-09-02 19:05:15 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 02:44:24 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 15:07:39 -07:00
2026-09-02 19:10:21 -07:00
2026-09-02 18:22:01 -07:00
2026-09-03 13:28:22 -07:00
2026-09-06 13:08:31 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 18:33:06 -07:00
2026-09-02 19:10:21 -07:00
2026-09-02 18:44:36 -07:00
2026-09-02 19:10:21 -07:00
2026-09-02 19:22:52 -07:00
2026-09-02 19:18:18 -07:00
2026-09-02 18:51:24 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 13:48:49 -07:00
2026-09-02 19:18:18 -07:00
2026-09-02 18:31:56 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 19:16:38 -07:00
2026-09-02 19:19:44 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 19:18:18 -07:00
2026-09-03 04:56:59 +05:30
2026-09-03 09:44:26 -07:00
2026-09-06 05:35:12 -07:00
2026-09-03 13:46:50 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 19:19:44 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 19:51:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 17:13:22 -07:00
2026-09-03 03:31:03 -07:00
2026-09-03 10:40:25 -07:00
2026-09-03 12:29:52 -07:00
2026-09-03 13:29:35 -07:00
2026-09-02 19:42:28 -07:00
2026-09-03 03:31:03 -07:00
2026-09-04 02:03:08 -07:00
2026-09-02 19:36:47 -07:00
2026-09-06 22:45:31 +05:30
2026-09-03 13:24:04 -07:00
2026-09-04 00:15:16 -07:00
2026-09-02 19:45:03 -07:00
2026-09-02 19:19:44 -07:00
2026-09-02 19:42:28 -07:00
2026-09-03 10:40:25 -07:00
2026-09-03 13:29:35 -07:00
2026-09-05 00:10:26 -07:00
2026-09-03 10:40:25 -07:00
2026-09-06 22:56:51 +05:30
2026-09-02 22:23:45 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 00:15:16 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 09:44:26 -07:00
2026-09-04 00:15:16 -07:00
2026-09-02 18:51:40 -07:00
2026-09-02 19:39:27 -07:00
2026-09-03 09:44:26 -07:00
2026-09-06 09:09:00 -07:00
2026-09-06 13:21:17 -07:00
2026-09-03 13:12:23 -07:00
2026-09-03 03:31:03 -07:00
2026-09-03 13:29:35 -07:00
2026-09-03 13:29:35 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 13:48:14 -07:00
2026-09-06 12:02:58 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 13:12:23 -07:00
2026-09-02 18:53:04 -07:00
2026-09-06 09:09:00 -07:00
2026-09-06 21:37:47 +05:30
2026-09-06 13:21:17 -07:00
2026-09-03 13:12:23 -07:00
2026-09-02 18:40:01 -07:00
2026-09-03 17:13:22 -07:00
2026-09-02 19:30:27 -07:00
2026-09-02 19:26:50 -07:00
2026-09-03 09:44:26 -07:00
2026-09-02 18:45:32 -07:00
2026-09-03 09:44:26 -07:00
2026-09-06 13:21:17 -07:00
2026-09-06 13:21:17 -07:00
2026-09-06 05:42:22 -07:00
2026-09-03 13:46:50 -07:00
2026-09-02 19:19:54 -07:00
2026-09-02 18:29:10 -07:00
2026-09-02 19:07:07 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 00:15:16 -07:00
2026-09-03 09:44:26 -07:00
2026-09-03 17:13:22 -07:00
2026-09-04 07:17:00 -07:00