mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-27 17:58:07 +00:00
feat(compression): stream the summary call on every compression path
The progress-hook streaming from #71508 only activated when a CompressionCommitFence was present (gateway session hygiene). CLI /compress and in-loop auto-compression still used the plain non-streaming summary call, where the SDK timeout is inactivity-based — a byte-trickling provider that keeps the connection alive could outlive auxiliary.compression.timeout indefinitely (the gap #69192/#41397 were built to close). Fenceless compression callers now install a no-op progress hook, which routes their summary call onto the same streamed path: the configured timeout acts on inactivity (slow models finish instead of being cut off mid-generation), and a degenerate trickle stream is bounded by the streamed total ceiling (max(600s, 4× the task timeout)) instead of running forever. No config knob needed — the ceiling machinery ships with the streaming layer and applies uniformly. Supersedes the opt-in wall-clock deadline approaches in PR #69192 (@JabberELF) and PR #41397: same guarantee (bounded total compression wall time even while bytes move) without a daemonized watchdog thread or a new config surface, and without punishing slow-but-healthy models.
This commit is contained in:
parent
5121a2a20e
commit
9de7dfe1cc
1 changed files with 13 additions and 1 deletions
|
|
@ -1767,8 +1767,20 @@ def compress_context(
|
|||
# when it is actually silent, not merely thorough. The hook is
|
||||
# thread-local and the compress call is synchronous on this thread,
|
||||
# so it cannot leak into unrelated auxiliary calls.
|
||||
#
|
||||
# Fenceless callers (CLI /compress, in-loop auto-compress) install a
|
||||
# no-op hook: nobody polls their progress, but an ACTIVE hook is what
|
||||
# switches the summary call onto the streamed path — giving every
|
||||
# compression path the same two guarantees: the configured timeout
|
||||
# acts on inactivity (slow models finish), and a byte-trickling
|
||||
# provider that keeps the connection alive forever is cut off at the
|
||||
# streamed total ceiling (see _aux_stream_total_ceiling) instead of
|
||||
# outliving the SDK's inactivity timeout indefinitely.
|
||||
from agent.auxiliary_client import aux_progress_hook
|
||||
_progress_hook = commit_fence.touch_progress if commit_fence is not None else None
|
||||
_progress_hook = (
|
||||
commit_fence.touch_progress if commit_fence is not None
|
||||
else (lambda: None)
|
||||
)
|
||||
with aux_progress_hook(_progress_hook):
|
||||
compressed = compress_fn(messages, **compress_kwargs)
|
||||
except BaseException as _compress_exc:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue