fix(auto-compact): decide again when the command goes out, and send nothing into a usage-limit pause (#777)

The review items of #777, finished here so the PR can land.

A statusline report fires the trigger in the middle of a turn, and the
command then waits for that turn to end. Until now it went out whatever
had happened meanwhile: with auto-clear at 140k, a report of 150k fired
while the session worked, Claude Code compacted by itself, the report
fell to 20k, the session went idle and /clear wiped the conversation.
Both actions now ask again at that moment and return unsent when the
context is no longer at the threshold, when the option was switched off,
or when its threshold was raised past the context. The skipped command
stamps nothing, so the next report is judged like any other, and the
autoCompact and autoClear events carry the size at the moment of sending.

With auto-resume on, a trigger that fired before a usage limit hit sent
/clear once the pane went idle, and auto-resume then typed continue into
an empty conversation. The checks start nothing from the limit message
until the resume prompt went out, and an action that waited through the
start of a pause returns unsent.

Also: the threshold cap never drops below the 1,000 minimum (a reported
window of 500 stored a threshold of 500), a test pins that a conversation
switch drops the report, and docs/api-reference.md names the new
contextWindowSize session field.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-11 20:23:09 +01:00
1 parent 6fa2dfa549
commit 68e010b887
4 files changed
+267 -11

No files matched your search

+8
View File
@@ -1152,6 +1152,14 @@ that sends the report, decided when the pane starts: `injected` (it does), `coll
`.claude/settings.local.json` sets its own `statusLine`, which Codeman never replaces) or
`remote` (remote and Docker sessions). Absent when unknown.
`contextWindowSize` is the model's context window in tokens from the same report (200000,
or 1000000 with extended context), absent until a report carries it and dropped, like
`promptCache`, on a post-`/clear` conversation switch. It is the upper bound for
`autoCompactThreshold` and `autoClearThreshold` (1000000 while it is absent): a higher value
is stored as the window, and Session Options stops its two inputs there. The thresholds
themselves are compared with the report's `context_window.total_input_tokens`, cache reads
included, and with the session's token counter for a launch without the exporter.
## Placing a new session in a tab group (`tabGroupId`)
`POST /api/v1/sessions` and `POST /api/v1/quick-start` accept an optional