fix(session): make GET /sessions/{id} reflect on-disk archives when counter is stale (#1550)#2665
Open
yeyitech wants to merge 1 commit into
Open
fix(session): make GET /sessions/{id} reflect on-disk archives when counter is stale (#1550)#2665yeyitech wants to merge 1 commit into
yeyitech wants to merge 1 commit into
Conversation
…ounter is stale (volcengine#1550) Sessions written through the async Hermes provider produced archive directories on disk but left the persisted counter record at zero. GET /api/v1/sessions/{id} read the record verbatim and reported message_count=0 / commit_count=0, contradicting the on-disk evidence. The read path now derives archive_count from the actual on-disk archive directories. When the persisted message_count or commit_count is zero but archives exist, the derived value is surfaced so callers and the CLI no longer see "nothing happened" for sessions that clearly did. The persisted counters are still authoritative for the synchronous write path; this only kicks in when they're stale relative to disk. Closes volcengine#1550 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes #1550. Sessions written through async / out-of-band paths (e.g. the Hermes OpenViking provider) materialize archive directories on disk but leave the in-record
message_count/commit_countat zero.GET /api/v1/sessions/{id}then read those zeros verbatim, contradicting the on-disk evidence.The read path now also computes
archive_countfrom the on-disk archive directories. When the persisted counters are zero but archives exist, the derived value is surfaced so the API and CLI no longer report "nothing happened" for sessions that clearly did.The persisted counters are still authoritative for the regular synchronous write path; this fallback only fires when persisted state is stale relative to disk — so the fix self-heals already-wedged sessions in the wild.
Test plan
pytest tests/server/test_session_counters.py -x -qpasses.GET /api/v1/sessions/{id}→ response reportsarchive_count > 0.tests/server/test_api_sessions.pystill passes (no regression on the synchronous path).Closes #1550