WONT-FIX: fix: update stale ACP session provider instead of deleting#26
Open
gitricko wants to merge 1 commit into
Open
WONT-FIX: fix: update stale ACP session provider instead of deleting#26gitricko wants to merge 1 commit into
gitricko wants to merge 1 commit into
Conversation
Root cause: ACP server's normalize_result() converts None returns from
load_session into {} (empty dict). The extension sees {} as truthy and
assumes the session loaded, but every prompt then fails with 'session
not found' -- a ghost session that never responds.
Deleting the session from state.db (previous fix) made this worse:
the extension's locally-cached session ID still existed in VSCode
workspaceState, but the DB row was gone. normalize_result still
returned {} (truthy), so the extension stayed stuck on a phantom.
Fix: UPDATE the stale session's billing_provider to the current
configured provider and clear its old messages. The session ID is
preserved so the extension's cached ID resolves. The server creates
a working agent with the current provider. The extension resumes with
a clean conversation.
Closes #25 (replaces the delete approach)
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.
Problem
After every container reboot, the
customprovider used by old ACP sessions no longer exists in the Hermes config. The extension cached these session IDs locally in VSCode workspaceState. On reconnect it triessession/load, but ...The real root cause (found post-merge of PR #25):
The ACP server's
normalize_result()adapter converts anyNonereturn fromload_sessioninto{}(empty dict):The extension checks
if (null != await call("session/load", ...)). Since an empty dict{}is truthy in JavaScript, the extension thinks the session loaded and logs "resumed" — but the agent never actually existed. Every subsequentsession/promptthen fails with "session not found", creating a phantom session that never responds.Deleting the session (previous fix PR #25) made this worse — the DB row is gone, but
normalize_resultstill returns{}(truthy), so the extension stays stuck on the phantom session with no escape hatch.Fix
Instead of deleting stale sessions, UPDATE them:
billing_providerto the current configured provider (e.g.omniroute)billing_base_urlto the current OmniRoute endpointmodel_configto a valid config with the current providerThe session ID is preserved, so the extension's locally-cached ID still resolves. The server creates a working agent with the current provider. The extension resumes with a clean conversation.
How it works
On boot,
self-check.shqueries~/.hermes/state.dbfor ACP sessions (source='acp') whosebilling_provideris no longer in the current config. For each stale session it runs:Sessions with
billing_providerstill configured (e.g.omniroute,modelrelay) orNone(uses current default) are left untouched.Testing
Automated smoke test
Real VSCode test
docker restart <container>