Skip to content

fix(coding-agent): explain compaction cap recovery - #875

Open
rlaope wants to merge 1 commit into
code-yeongyu:mainfrom
rlaope:fix/resume-compaction-feedback
Open

fix(coding-agent): explain compaction cap recovery#875
rlaope wants to merge 1 commit into
code-yeongyu:mainfrom
rlaope:fix/resume-compaction-feedback

Conversation

@rlaope

@rlaope rlaope commented Aug 14, 2026

Copy link
Copy Markdown

Summary

  • preserve the request-specific per-turn-cap rejection across direct prompts, queued retry continuations, post-compaction admissions, and blocked follow-up admissions
  • align the builtin absolute-cap rejection with the actionable runtime recovery message: restart the CLI before resuming the session, or start a new session
  • keep the original cancelled-by-extension regression, add cap-specific coverage for the missed admission paths, and update changelog plus real-CLI QA contracts

Why

A long-lived runtime can accept ten compactions and then reject the next required compaction. Core previously replaced that structured rejection with:

Context remains above the compaction threshold because compaction did not complete

That left the actual reason in debug logs and made a resumed session look hung while prompts remained blocked or queued.

This intentionally corrects the "session" wording introduced in #731. acceptedAbsolute lives in the builtin extension's createInitialState() closure and is not serialized, so the absolute cap is runtime-scoped and resets when the CLI restarts. The extension reason and core fallback now compose to the same byte-identical user message.

Verification

  • npm run check
  • npm run build
  • related admission/queue/retry suite: 9 files, 91 tests passed
  • full compaction + regression review run: 185 files, 794 tests passed
  • .agents/skills/senpi-qa/scripts/scenarios/compaction-absolute-cap-qa.mjs --self-test: 6/6 passed, including ten accepted compactions, the 11th rejection text, post-rejection prompt survival, and unchanged real auth
  • five independent final reviews: goal/constraints, code quality, security, hands-on QA, and upstream context all PASS

Summary by cubic

Explain absolute compaction-cap recovery and preserve the rejection cause in coding-agent.

  • Old: after the runtime hit the absolute compaction cap, core replaced the extension’s structured rejection with “Context remains above the compaction threshold because compaction did not complete,” making resumed sessions look hung. New: core carries the rejection cause into RequiredCompactionError and appends a clear message that the absolute cap is runtime-scoped and how to recover (restart the CLI to resume the session or start a new session). The builtin extension now uses the same wording; both paths produce byte-identical text.

Review notes

  • Core plumbs a rejectionCapture through _checkCompaction, _runPrePromptCompaction, and _runAutoCompaction; RequiredCompactionError now accepts an optional cause and formats a combined message.
  • _blockedPostCompactionAssistant stores rejectionCause so post-compaction admissions surface the same message.
  • The structured cause remains per-turn-cap for API stability; the wording changes from “session” to “runtime.”
  • Updated tests and QA: new rejection needle, and spies now expect the extra argument for _runAutoCompaction.

Migration

  • If you assert on error text or compaction event messages, update expectations to the new runtime-scoped wording:
    “Compaction rejected: the absolute compaction cap was reached for this runtime. Restart the CLI to resume this session, or start a new session.”

Written for commit dc1c94f. Summary will update on new commits.

Review in cubic

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.

2 participants