Skip to content

fix(agent): increment ineffective counter on no-op compression (#36624) - #38723

Closed
ashishpatel26 wants to merge 3 commits into
NousResearch:mainfrom
ashishpatel26:fix/compression-exhaustion-noop-36624
Closed

fix(agent): increment ineffective counter on no-op compression (#36624)#38723
ashishpatel26 wants to merge 3 commits into
NousResearch:mainfrom
ashishpatel26:fix/compression-exhaustion-noop-36624

Conversation

@ashishpatel26

Copy link
Copy Markdown
Contributor

Closes #36624. When compress_start >= compress_end (token-budget tail covers all compressible messages), compress() returned early without incrementing _ineffective_compression_count. Anti-thrash guard never fired; tool-heavy sessions looped until provider 413. Fix: increment counter and warn on no-op path. Adds 2 regression tests.

@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels Jun 4, 2026
@ashishpatel26
ashishpatel26 force-pushed the fix/compression-exhaustion-noop-36624 branch from 46a52c4 to f34b676 Compare June 5, 2026 04:09
When compress_start >= compress_end (token-budget tail covers all
compressible messages), compress() returned early without incrementing
_ineffective_compression_count. The anti-thrash guard (>= 2 consecutive)
never fired, so tool-heavy sessions looped until provider 413/context error.

Fix: increment counter and warn on no-op path.

Closes NousResearch#36624
…ath traversal)

sync_back inferred host paths for new remote files under mapped parent
directories without any allowlist check, allowing a malicious remote task
to write files into ~/.hermes/skills/, ~/.hermes/plugins/, or sensitive
config files by creating them on the remote side.

Add _is_safe_sync_back_target() that denies writes to skill dirs, plugin
dirs, config.yaml, and .env. Also add a symlink-escape check that rejects
any resolved path escaping its mapped directory parent.

Closes NousResearch#38026
@ashishpatel26
ashishpatel26 force-pushed the fix/compression-exhaustion-noop-36624 branch from f34b676 to 1d2750f Compare June 12, 2026 18:52
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for this — closing as already-implemented on current main. For #36624, the no-op ineffective-compression counter you proposed already landed on main via b18490b (#40803), which increments _ineffective_compression_count when the transcript fits the tail budget and bails after 2 ineffective passes. Your diagnosis matched the root cause; the fix shipped via the referenced commit. Appreciate the contribution.

@teknium1 teknium1 closed this Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto compression can exhaust context in tool-heavy sessions

3 participants