Skip to content

fix(coding-agent): required-compaction review fixes for #679 - #684

Merged
code-yeongyu merged 4 commits into
mainfrom
fix/compaction-recovery-loop-review-fixes
Aug 3, 2026
Merged

fix(coding-agent): required-compaction review fixes for #679#684
code-yeongyu merged 4 commits into
mainfrom
fix/compaction-recovery-loop-review-fixes

Conversation

@code-yeongyu

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

Copy link
Copy Markdown
Owner

Summary

Stacked on top of #679 (contains its commit plus fixes). Addresses every verified blocker from the [sisyphus-bot] brutal review (review id 4844512307):

  • Admission-error supersession: an accepted required-compaction recovery now clears the stored admission rejection when its queued continuation is scheduled, so the originating prompt() resolves after the queued steer completes instead of throwing the superseded RequiredCompactionError (reproduced 2/2 runs before the fix).
  • Bounded deterministic-fallback sizing: the retained-message estimator fails closed on accessor-bearing, non-plain, cyclic, or callable values and exits early once the remaining contextWindow - reserveTokens budget is exceeded; previously a 32 MiB retained message cost ~207 MiB peak and persisted property getters executed during sizing.
  • Test hardening: pins the turn-end soft-cap reset across degradation-recovery early returns (mutation-proven RED), closes the unasserted third faux call in the continuation regression, and records the changes in changes.md.

One review item (stale provenance across runs) was declined after reproduction: the harmful path cannot trigger because agent_end classification also requires a still-over-threshold context, which the successful run-2 compaction eliminates.

Verification

  • Changed scope: 5 files, 28 tests green (24 baseline + 4 new regressions), incl. RED-before-fix captures for both production fixes.
  • npx tsc --noEmit (coding-agent) exit 0; root npm run check exit 0.
  • senpi-qa isolated channels: common 9/9, mock-loop 43/43, rpc-drive 4/4, cli-smoke 8/8; real auth unchanged; no leftover processes/ports.
  • Evidence: local-ignore/qa-evidence/20260803-pr-679-brutal-review/.

Summary by cubic

Fixes required-compaction recovery so accepted recovery resumes the queued continuation and the original prompt resolves instead of throwing a stale error. Also bounds deterministic fallback sizing to avoid unsafe executions and large memory spikes.

  • Bug Fixes
    • Supersede the stored admission error after an accepted recovery compaction and schedule the continuation; the originating prompt() resolves after the queued steer/follow-up completes.
    • Track per-turn provenance for required-compaction errors and clear it on agent_start; only retry when the error is confirmed for the current turn, so provider lookalike errors don’t trigger recovery.
    • Reset the soft compaction cap on turn_end (in finally) so later provider turns can compact again; keep enforcing the absolute session cap for all routes.
    • Make deterministic recovery safe and bounded: use a conservative token estimator that fails closed on accessor-bearing/non-plain/cyclic/callable values, exits early when the budget is exceeded, validates retained message envelopes/blocks, measures the reconstructed suffix, and falls back from the prepared boundary to the latest meaningful user turn when needed.

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

Review in cubic

realsigridjin and others added 4 commits August 3, 2026 21:54
Accepted required-compaction recovery clears the stored admission
rejection when its queued continuation is scheduled, so the originating
prompt resolves after the queued steer completes instead of throwing
the superseded RequiredCompactionError.
Retained-message sizing fails closed on accessor-bearing, non-plain,
cyclic, or callable values and exits early once the remaining context
budget is exceeded, instead of eagerly serializing every retained
message and executing persisted property getters.
Pin the turn-end soft-cap reset across degradation-recovery early
returns, close the unasserted third faux call in the continuation
regression, and record the admission-supersession and bounded-sizing
changes in changes.md.
@code-yeongyu
code-yeongyu merged commit 060946a into main Aug 3, 2026
14 checks passed
@code-yeongyu
code-yeongyu deleted the fix/compaction-recovery-loop-review-fixes branch August 3, 2026 13:58
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