fix(acp): publish current context and compression depth - #74032
fix(acp): publish current context and compression depth#74032stefanpieter wants to merge 1 commit into
Conversation
|
CI is awaiting the repository-admin approval required for workflows from external forks (run 30442121432). The submitter approval endpoint returns HTTP 403 ( Exact head
|
|
Post-submit live validation found and fixed a restore-only delivery gap: Fresh evidence on the updated exact tree:
|
f709276 to
f001538
Compare
|
@kshitijk4poor this is ready for maintainer action on exact head
Could you please approve the external-fork workflow and review/merge if satisfied? The PR body has the exact base/head, patch hash, local evidence, and live ACP wire proof. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing the ACP usage stream through provider usage, restore delivery, and durable compression state. The current-main premise is real: acp_adapter/server.py:857-867 still prefers the rough estimate and load_session defers its usage update.
Problems
acp_adapter/server.py:1431makessession/loadpublish synchronously, butresume_sessionhas the same in-call replay contract atacp_adapter/server.py:1453-1455and still defers its usage update atacp_adapter/server.py:1466. A resumed client can therefore retain the stale-telemetry behavior this change fixes for loads.
Suggested changes
- Apply the awaited usage publication to
resume_sessionand add a response-boundary regression alongside the new load test. - Current main moved
SCHEMA_SQLtohermes_state_common.py:135in21c7ae8563; preserve the declarative column addition there during salvage.
Automated hermes-sweeper review.
| # request lifetime; deferring it until after return can lose the update | ||
| # during transport/task handoff and leaves a resumed client stale until | ||
| # its first prompt. | ||
| await self._send_usage_update(state) |
There was a problem hiding this comment.
resume_session has the same before-response replay contract at lines 1453-1455, but it still defers _schedule_usage_update(state) at line 1466. Please await _send_usage_update(state) there too and add a response-boundary regression; otherwise resumed clients can still miss the restored telemetry this change guarantees for session/load.
|
Resolved the current review blocker on
Verification:
The exact-head upstream CI run is awaiting maintainer approval for external-fork workflows: https://github.com/NousResearch/hermes-agent/actions/runs/30619238988 @digironin @teknium1 please re-review when available. Formal |
Reimplement NousResearch#74032 on current main without retaining historical merge commits. Persist compression counts, restore them before load/resume usage updates, and publish ACP-native context telemetry.\n\nIncludes contributor mapping from the original branch.
1e0784d to
42040c7
Compare
What does this PR do?
Make ACP context telemetry represent the current effective model window and durably expose completed compression depth.
ACP
usage_update.usednow prefers provider-reportedlast_prompt_tokensand uses the existing request estimator only before real model usage is available. Each completed worker-thread model step schedules a fresh update, including non-negative_meta.hermes.compressionCount.Compression count round-trips through session storage, survives restore and compression-driven internal rotation, and is cleared durably by an explicit same-session ACP
/reset.Restored sessions replay existing history and then await the current usage/compression update before either
session/loadorsession/resumereturns, so a fresh client is current at the response boundary.This complements #70267: that PR changes
PromptResponse.usage.inputTokens; this PR fixes the authoritative ACPusage_updatestream, compression metadata, and durable reset/rotation behavior.Related Issue
Related to #70204 and #70267.
Changes made
acp_adapter/server.py: publish current-window usage/compression depth after model steps and during load/resume restore; persist cleared count on ACP/resetagent/context_compressor.py: load, persist, rotate, and explicitly reset compression depthhermes_state_common.pyandhermes_state.py: add the authoritative schema column plus bounded session accessors after currentmainmovedSCHEMA_SQLinto the common moduleReview remediation
UsageUpdatewas visible whenresume_session()returnedCurrent exact-head verification
1e0784da1333b06370567fa77ca59fed86da4843scripts/run_tests.sh tests/acp/test_server.py tests/agent/test_context_engine_host_contract.py tests/test_hermes_state.py -q— 180 passedgit diff --check, and added-line security scan — passedf3cda0ceb18d8ba7465a6d223098ef0e56c8fee1; livemainlater advanced only intools/file_operations.pyand its test, with no dependency overlap and a cleangit merge-treeproofType of change
Checklist