fix: suppress nudge when all content is protected - #158
Closed
ranxianglei wants to merge 2 commits into
Closed
ranxianglei wants to merge 2 commits into
ranxianglei wants to merge 2 commits into
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
ranxianglei
added a commit
that referenced
this pull request
Jul 18, 2026
…io A coverage Dual-agent review (Oracle #2) found that 4 "all protected" tests included userMsg("u1", ...) which made compressible non-empty, so tests passed via filterSuppressed instead of the allProtected branch added in PR #158. Fix: remove userMsg from allProtected tests so compressible is genuinely empty. Add Scenario A test: voluntary compress after suppression correctly skips proportional baseline adjustment (wasNudgeTriggered=false).
ranxianglei
added a commit
that referenced
this pull request
Jul 18, 2026
* fix: suppress nudge when all content is protected (nothing to compress) Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * docs: devlog for suppress-nudge-no-compressible Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * fix: advance nudge baseline when suppressed for discrete 5% check intervals When nudge is triggered but suppressed (nothing to compress), advance the baseline to currentTokens so the next check fires at +5% instead of every turn. Also clear pending nudge (lastNudgeShownTokens) so threshold resets to full. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * docs: devlog for compressible-growth baseline advance Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * test: fix allProtected tests to exercise intended branch + add Scenario A coverage Dual-agent review (Oracle #2) found that 4 "all protected" tests included userMsg("u1", ...) which made compressible non-empty, so tests passed via filterSuppressed instead of the allProtected branch added in PR #158. Fix: remove userMsg from allProtected tests so compressible is genuinely empty. Add Scenario A test: voluntary compress after suppression correctly skips proportional baseline adjustment (wasNudgeTriggered=false). --------- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Owner
Author
ranxianglei
added a commit
that referenced
this pull request
Jul 18, 2026
…rotected label + nudge fixes (#160) * release: v1.12.10-dev.1 — protected label + nudge suppression + discrete intervals Bundles PRs #157 (protected label accuracy), #158 (allProtected suppress), #159 (discrete 5% check intervals). Prerelease for testing on npm dev tag. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> * chore: remove stray Gitea API dump from release branch * docs: changelog includes PR #73 (decompress range mode) and #155 (token classification) --------- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When all context is protected (e.g., user puts
readinprotectedToolsand all messages containreadcalls), the nudge still fires uselessly — model receives "go compress" but has nothing to compress.PR #147's
filterSuppressedonly handles the case where compressible ranges exist but are filtered out. This PR adds the missing case:compressible.length === 0 && protected.length > 0→ all protected → suppress nudge.Emergency override (98% context) still fires regardless.
Fix
lib/messages/inject/inject.ts:The
protected.length > 0check distinguishes "all protected" from "no refs assigned yet" (both arrays empty — edge case, not suppression).Tests
752/752 tests pass.