Load session list dynamically from ACP backend - #23
Open
gitricko wants to merge 3 commits into
Open
Conversation
added 3 commits
June 21, 2026 08:17
The extension stored session metadata only in VS Code workspaceState, which is in-memory only in code-server — lost on browser reload. Now on ACP connect, the extension calls the backend's built-in list_sessions RPC and populates the session list dynamically. Clicking an old session calls session/load to restore Hermes context. No file fallback or dual persistence needed — backend is the source of truth.
The ACP protocol method is session/list (kebab slash), not list_sessions. Confirmed in acp/meta.py: AGENT_METHODS['session_list'] = 'session/list'. Previous build was silently failing — the call returned an error and listSessions() returned empty, so no backend sessions appeared in the UI. Local testing showed only the 2 'hi' sessions (created in the local store on this session) were visible — the 5 backend sessions in state.db were never synced because the RPC call was returning an error response that got swallowed by the empty-array fallback. Field names (sessionId, title, updatedAt) are correct — Pydantic serializes with by_alias=True so camelCase comes over the wire.
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
The extension loses the session list on browser reload because
SessionStorestores everything in VS CodeworkspaceState— which is in-memory only in code-server. The Hermes ACP backend already has alist_sessionsRPC returning all sessions from its ownstate.db, but the extension never called it.Fix: On ACP connection, call
list_sessionsand populate the session list dynamically. Backend is the source of truth — no file fallback, no dual persistence needed.Changes (4 files, +52 lines)
sessionManager.tslistSessions()— calls ACPlist_sessionsRPCsessionStore.tsaddBackendSession()— inserts a backend session without activating itchatPanel.tssyncSessionsFromBackend()— merges backend sessions into the store, deduped byacpSessionIdextension.tspanel.syncSessionsFromBackend()afterclient.start()succeedsHow it works
User clicks an old session →
switchSession→session/loadrestores Hermes context → works immediately.How to test
state.db)Tradeoffs
session/load). The session context IS restored on Hermes side — you can continue chatting from where you left off.session/get_historybackend endpoint later would let us load the previous turns into the UI too.