-
Notifications
You must be signed in to change notification settings - Fork 228
feat(hermes): honor the pre-compress checkpoint API v2 contract #1737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AlexStocks
wants to merge
2
commits into
oceanbase:master
Choose a base branch
from
AlexStocks:feat/hermes-pre-compress-checkpoint-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+287
−23
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Do not advertise a successful required checkpoint for a truncated transcript
With
capture_pre_compress=Trueandrequire_checkpoint=True,on_pre_compress()still serializes new entries withlimit=30_000, then records every entry in_precompress_snapshotand returns normally. A direct public-hook reproduction with a 31,000-character user message followed by an assistant tail marker stores exactly 30,000 characters, omits the marker, and makes no additional capture on retry.The truncation predates this PR, but advertising v2 now makes that normal return satisfy the host's required-checkpoint gate (Hermes contract). Compression can therefore proceed without a complete checkpoint, leaving the omitted tail unavailable from that checkpoint. Persist the complete window before reporting success, or raise in required mode when it cannot be fully stored; do not mark unsaved entries as captured. The reproduction used a recording client, not a full Hermes session.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed on
78b39e68with the plugin's real HTTP client against a temporary SQLite-backed PowerContext server. Withcapture_turns=false, a 30,001-character user message followed by an assistant tail marker returned normally withrequire_checkpoint=True, but the persisted Source contained only 30,000 characters and no marker. Retrying created no additional Source, and the marker was still absent after restarting the server.The required checkpoint should fully persist the filtered evidence or raise before advancing the snapshot. Otherwise the v2 success signal allows compression while part of the evidence remains unsaved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in
da00759e. Required pre-compress checkpoints now fail before snapshot advancement when the complete new transcript window cannot fit in the bounded capture payload. Optional captures can still persist a bounded prefix, but only the actually captured fingerprints are used for idempotency/snapshot advancement; required mode raises instead of advertising a successful partial checkpoint.Added regression coverage for oversized required checkpoints and Scope changes during capture.
Validation:
python -m pytest tests/integrations/test_hermes_provider.py -q(86 passed),ruff check,ruff format --check, andty check --python-version 3.11on the changed files.