fix: stop false Compressing-context card for preflight compression
PR #6184 narrowed the agent-status-to-SSE bridge to real compression start notices, but the 'preflight compression:' pattern matches the Hermes agent's preflight check message ("Preflight compression: ~X tokens >= Y threshold"). This fires on every new session where the system prompt alone exceeds the threshold, showing a "Compressing context" card before any model output — a false positive. Remove 'preflight compression:' from the pattern. The preflight check is a one-time pre-model-call estimate, not a mid-conversation compression event that the user needs to see.
This commit is contained in:
parent
dd7f6ac318
commit
9c1c1d8063
2 changed files with 5 additions and 3 deletions
|
|
@ -587,8 +587,7 @@ def _is_agent_compression_start_status(kind: str, message: str) -> bool:
|
||||||
if 'compressed' in m and 'compressing' not in m and 'compression attempt' not in m:
|
if 'compressed' in m and 'compressing' not in m and 'compression attempt' not in m:
|
||||||
return False
|
return False
|
||||||
return (
|
return (
|
||||||
'preflight compression:' in m
|
'pre-api compression:' in m
|
||||||
or 'pre-api compression:' in m
|
|
||||||
or 'compacting context' in m
|
or 'compacting context' in m
|
||||||
or 'context too large' in m
|
or 'context too large' in m
|
||||||
or '— compressing (' in m
|
or '— compressing (' in m
|
||||||
|
|
|
||||||
|
|
@ -473,7 +473,10 @@ def test_agent_status_callback_emits_compressing_and_warning_events():
|
||||||
|
|
||||||
def test_agent_compression_start_status_matches_real_emitters_only():
|
def test_agent_compression_start_status_matches_real_emitters_only():
|
||||||
# Real start notices from hermes-agent emitters
|
# Real start notices from hermes-agent emitters
|
||||||
assert _is_agent_compression_start_status(
|
# Preflight compression is excluded — it fires on every new session
|
||||||
|
# where the system prompt alone exceeds the threshold, producing a
|
||||||
|
# false "Compressing context" card before any model output.
|
||||||
|
assert not _is_agent_compression_start_status(
|
||||||
"lifecycle",
|
"lifecycle",
|
||||||
"📦 Preflight compression: ~101,000 tokens >= 96,000 threshold. This may take a moment.",
|
"📦 Preflight compression: ~101,000 tokens >= 96,000 threshold. This may take a moment.",
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue