Skip to content

Mark turns interrupted when compression is cancelled - #13

Open
uuzzrm wants to merge 1 commit into
nullcache:minfrom
uuzzrm:fix/context-compression-cancellation
Open

Mark turns interrupted when compression is cancelled#13
uuzzrm wants to merge 1 commit into
nullcache:minfrom
uuzzrm:fix/context-compression-cancellation

Conversation

@uuzzrm

@uuzzrm uuzzrm commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

What breaks

If a turn is cancelled while the context compressor is waiting on its LLM summary, Agent.chat() rejects before it reaches the existing cancellation handler. The new user message remains as a bare trailing user message, so a later request can treat the cancelled task as unfinished.

What changed

  • Move the initial user-message append and maybeCompress() call inside the existing try block.
  • Reuse the current [interrupted by user] history marker for cancellation during compression.
  • Add a regression test that cancels a summary request and checks the resulting history.

Verification

  • npm test — 55 passed, 1 skipped (the existing platform-specific SIGKILL test)
  • git diff --check

The failure was reproduced locally with a cancellable LLM stub before the fix. This change was AI-assisted and reviewed against the current min branch.

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