Skip to content

fix(nudge): restore maxContextLimitPct pressure band + gate pressure nudges on effective pending (fixes #57 regressions) - #70

Merged
ranxianglei merged 7 commits into
masterfrom
2026-08-15_pr57-restore-midband
Aug 15, 2026
Merged

ranxianglei merged 7 commits into
masterfrom
2026-08-15_pr57-restore-midband

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Supersedes #57 (contains all of its commits via merge) — fixes the two regressions found in review (comment).

Regression 1 (high): the 75–95% band was deleted

#57 kept only growthReady + emergencyOverride arbitration; grep overLimit|maxContextLimitPct in its compress.ts = 0 hits. Usage in the over-limit band with growth < floor stopped nudging entirely, and maxContextLimitPct survived in config with no consumer.

Fix: pressure band = usage >= maxContextLimitPct (subsumes emergency): bypasses growth gate + cadence, picks the tier with the MAX pending (keeps #57's tier-aware argmax so pressure can still route to distillation), gated on effective pending. Reason labels OVER-LIMIT vs EMERGENCY by which threshold fired.

Regression 2 (medium): emergency with nothing effective injected every turn

shouldInject = emergencyOverride || … fired at ≥95% with zero effective pending — and when recommendedRanges still held sub-threshold tail groups, the nudge offered ranges the kernel would atomically reject (the endurance-report failure mode, resurfacing under pressure).

Fix: pressure nudges gated on bestPending > 0; the suppressed case does not inject and its reason states why (…no tier has effective compressible content…minCompressRange). The truncate node remains the independent last resort.

Merge notes

  • Merges current master (truncate machinery; emergencyThresholdPct 0.95 + truncate.threshold 0.95 tuning kept, not pr-57's stale 0.80).
  • Keeps everything from fix(nudge): merge small ranges + effective T1 pending + tier-aware emergency arbitration #57: mergeRangesToThreshold, effective T1 pending, tier2GrowthMultiplier (1.5×, non-emergency T2/T3 override), emergency tier-argmax.
  • Verified the cross-gap merge safety in review: soft-protection excludes+warns, covered messages drop from directMessageIds, Bug-39 protected-tool pairing holds.

Tests

295 pass, 0 fail (+ master's two over-limit tests, kept) and two NEW regression tests that are red on unpatched #57:

  • emergency suppresses nudge when only sub-minCompressRange tail ranges remain (asserts non-injection + explanatory reason)
  • emergency with effective pending routes to the max-pending tier

Downstream: adapters are unaffected until they bump their kernel pin; tier2GrowthMultiplier is additive config.

…xContextLimitPct band, gate pressure nudges on effective pending
…nudges on effective pending

Review fixes for #57 (two regressions):

1. The 75-95% over-limit band was deleted — maxContextLimitPct had no
   consumer. Restored as the pressure band: bypasses growth gate +
   cadence, picks the tier with the MAX pending (keeping #57's tier-aware
   argmax and effective-pending semantics), labeled OVER-LIMIT vs
   EMERGENCY by which threshold fired.

2. Emergency with zero effective pending injected every turn — and could
   offer sub-minCompressRange tail ranges that would be atomically
   rejected (the exact failure mode #57 fixes, resurfacing under
   pressure). Pressure nudges are now gated on effective pending > 0;
   the suppressed case reports why instead of spamming.

Also merges master (truncate machinery, emergencyThresholdPct 0.95) into
the branch: pr-57's arbitration is preserved, config keeps master's
tuning + the new tier2GrowthMultiplier.

295 tests (+2 regression tests that are red on unpatched #57).
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