Fix chats missing from the remote HTTP endpoint#487
Open
rschmukler wants to merge 2 commits into
Open
Conversation
8dfb99f to
57cca48
Compare
Chats persisted before they were seeded with an :id had no :id inside their stored value (the map key was the only authoritative id). The remote endpoints filter/identify chats via (:id chat), so such chats — typically the ones being resumed on a fresh server — were permanently absent from GET /session and GET /chats and never corrected. Guarantee the invariant at the source: stamp :id from the map key when writing the workspace cache, and backfill it on load so existing legacy caches are healed in-memory for the current session.
The remote GET /session and GET /chats endpoints only showed chats the editor had open this run, tracked via :chat-start-fired. That flag is only set on the first prompt, so a resumed (chat/open) or forked chat stayed hidden until the user prompted it. Track editor-open chats in a dedicated :editor-open-chats set, marked on prompt, resume and fork, and filter the endpoints on it. Keep :chat-start-fired solely for gating the one-shot chatStart hook, so resumed chats still fire chatStart with :resumed true on first prompt.
57cca48 to
3a17038
Compare
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.
:idin their stored value (typically resumed ones) were permanently absent fromGET /sessionandGET /chats, and never corrected even after prompting — the endpoints identify chats by(:id chat)instead of the authoritative map key. Now every chat is stamped with its:idon write, and legacy rows are backfilled on load.chat/open) and forked chats only appeared after the first prompt, because the endpoint filter used:chat-start-fired(set on prompt only). They're now tracked in a dedicated:editor-open-chatsset marked on prompt/resume/fork, so they list immediately.:chat-start-firedis kept solely for the one-shotchatStarthook, so resumed chats still firechatStartwith:resumed true.Testing
New unit tests for
:idstamping (write + load) andopen-chat!marking a chat editor-open.eca.db-test,eca.remote.handlers-test,eca.features.chat-testgreen;clj-kondoclean.I added a entry in changelog under unreleased section.
This is not an AI slop.