Skip to content

fix(auto-handoff): trust context size only after a reply following the last compact - #57

Merged
Jish2 merged 1 commit into
mainfrom
fix/auto-compact-stale-ctx
Oct 29, 2026
Merged

Jish2 merged 1 commit into
mainfrom
fix/auto-compact-stale-ctx

Conversation

@Jish2

@Jish2 Jish2 commented Oct 29, 2026

Copy link
Copy Markdown
Owner

The watcher compacted a thread whose real context was ~6k. After /compact the session log keeps the old assistant usage (201k) until the model next replies, and the follow-up /context made the last-prompt check miss the compact, so the stale size passed --min-tokens.

compacted_since_last_turn now treats a session as compacted from a compact_boundary or /compact command until the next assistant reply with usage. Replaces last_prompt_is_compact.

Dry run on the real logs: 31ec998d now skips as already compacted.

🤖 Generated with Claude Code

…e last compact

A compacted session keeps logging its pre-compact context until the model replies, and
local commands like /context hid the /compact from the last-prompt check, so a 29k thread
read as 201k and was compacted again.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Jish2
Jish2 merged commit 50095ab into main Oct 29, 2026
@Jish2
Jish2 deleted the fix/auto-compact-stale-ctx branch October 29, 2026 18:06
@claude

claude Bot commented Oct 29, 2026

Copy link
Copy Markdown

Claude review: skipped (the PR is already merged, so it is closed)
Checked the PR state only. No code was reviewed.
Not approved: the approval conditions require reading the whole diff, and I did not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant