Skip to content

fix(coding-agent): suppress aborted compaction stream errors - #685

Merged
code-yeongyu merged 2 commits into
mainfrom
fix/compaction-esc-cancel
Aug 3, 2026
Merged

fix(coding-agent): suppress aborted compaction stream errors#685
code-yeongyu merged 2 commits into
mainfrom
fix/compaction-esc-cancel

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Treat a summary stream rejection as expected cancellation when the compaction caller signal is already aborted.
  • Preserve ordinary provider and stream errors unchanged.
  • Add focused coverage for the late stream-result rejection reported after pressing ESC.
  • Document the fork behavior and merge-conflict surface.

Root cause

The compaction watchdog can stop consuming as soon as ESC aborts the caller signal, while the provider stream's final
result rejects a moment later with Assistant message stream consumption was cancelled. That late rejection escaped
runExtensionCompaction() and was reported by the builtin extension runner after the normal cancellation notice.

Verification

  • RED: focused cancellation case rejected with the exact reported error while the ordinary-error case passed.
  • GREEN: test/compaction/speculative-abort-cancellation.test.ts — 2/2 passed.
  • Compaction suite: 47 files, 327 tests passed.
  • npm run check: passed.
  • Latest origin/main merged; post-merge focused tests, compaction suite, and npm run check passed.

Manual QA

Source Senpi TUI in a persistent PTY:

  1. Seeded a clean exact session with two large turns.
  2. Forced pre-prompt compaction with isolated 16K model metadata.
  3. Held an OpenAI-compatible SSE summary stream after its first delta.
  4. Injected ESC only after the server confirmed stream consumption.

Observed:

  • Context overflow detected, compacting... (esc to cancel)
  • Compacting... (esc to cancel) partial held summary
  • Auto-compaction cancelled
  • No Extension "<builtin:compaction>" error
  • No Assistant message stream consumption was cancelled stack
  • Editor accepted SESSION-USABLE-AFTER-CANCEL

Evidence is stored locally under local-ignore/qa-evidence/20260803-compaction-esc/, including an xterm.js-rendered PNG.


Summary by cubic

Suppress spurious compaction errors after ESC by treating late summary stream rejections as normal cancellation when the caller AbortSignal is aborted. Real provider/stream errors still bubble up; adds a focused regression test.

  • Bug Fixes
    • In runExtensionCompaction(), return undefined if generateSummaryMessage rejects and the caller signal is already aborted; otherwise rethrow.
    • Stops the late "Assistant message stream consumption was cancelled" error from surfacing after "Auto-compaction cancelled".
    • Adds speculative-abort-cancellation.test.ts to verify both the aborted and ordinary failure paths.

Written for commit 1116bd8. Summary will update on new commits.

Review in cubic

…ncel

# Conflicts:
#	packages/coding-agent/src/core/extensions/builtin/compaction/changes.md
@code-yeongyu
code-yeongyu enabled auto-merge August 3, 2026 14:45
@code-yeongyu
code-yeongyu merged commit f59be4f into main Aug 3, 2026
14 checks passed
@code-yeongyu
code-yeongyu deleted the fix/compaction-esc-cancel branch August 3, 2026 14:54
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