Skip to content

Fix chats missing from the remote HTTP endpoint#487

Open
rschmukler wants to merge 2 commits into
editor-code-assistant:masterfrom
rschmukler:rs/fix-chat-ids
Open

Fix chats missing from the remote HTTP endpoint#487
rschmukler wants to merge 2 commits into
editor-code-assistant:masterfrom
rschmukler:rs/fix-chat-ids

Conversation

@rschmukler
Copy link
Copy Markdown
Contributor

  • Persisted chats with no :id in their stored value (typically resumed ones) were permanently absent from GET /session and GET /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 :id on write, and legacy rows are backfilled on load.
  • Resumed (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-chats set marked on prompt/resume/fork, so they list immediately. :chat-start-fired is kept solely for the one-shot chatStart hook, so resumed chats still fire chatStart with :resumed true.

Testing

  • New unit tests for :id stamping (write + load) and open-chat! marking a chat editor-open.

  • eca.db-test, eca.remote.handlers-test, eca.features.chat-test green; clj-kondo clean.

  • I added a entry in changelog under unreleased section.

  • This is not an AI slop.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant