Skip to content

Harden per-chat selection isolation and restoration#272

Merged
ericdallo merged 5 commits into
editor-code-assistant:masterfrom
rschmukler:selection-fixes
Jul 15, 2026
Merged

Harden per-chat selection isolation and restoration#272
ericdallo merged 5 commits into
editor-code-assistant:masterfrom
rschmukler:selection-fixes

Conversation

@rschmukler

Copy link
Copy Markdown
Contributor

Harden model, variant, agent, and trust handling across multiple chats and ECA
sessions.

Pairs with editor-code-assistant/eca#533

  • Route selection updates and commands to the correct active chat.
  • Isolate variant catalogs per chat and normalize “no variant” to nil.
  • Scope inherited selection defaults to each ECA session.
  • Hydrate restored chat selections atomically when supported by the server.
  • Improve chat deletion, agent cycling, and local test reliability.

Details

Per-chat routing

Preserve chatId from config/updated notifications so scoped server updates
only affect their target chat.

Selection commands now prefer the current live, registered chat buffer before
falling back to the session's last chat. This also fixes agent selection from
source buffers and prevents eca-chat-delete from deleting a stale last-chat
buffer.

Agent cycling now handles empty agent lists and selections that are no longer
available.

Variant isolation

Variant catalogs are now buffer-local because available variants can differ by
chat and selected model.

The UI sentinel "-" is normalized to nil internally and is never sent as a
protocol variant. Scoped variant updates affect only their target chat, while
legacy unscoped catalogs continue to act as session defaults.

Session-scoped defaults

Replace process-global model, agent, variant, and trust defaults with fields on
each eca--session.

New chats inherit defaults only from their own session. Scoped restore and
configuration updates do not mutate those defaults or leak state into other
sessions.

Explicit local nil values for variant and trust are distinguished from
uninitialized values.

Restored chat hydration

Add backward-compatible support for the atomic selection snapshot introduced
by editor-code-assistant/eca#533.

When present in a chat/open response, the snapshot atomically hydrates the
opened chat's:

  • model
  • agent
  • selected variant
  • available variants
  • trust setting

Field presence is preserved, so explicit nullable values clear local state
while omitted fields remain unchanged.

The client accepts both the new found response field and the legacy found?
field. It also remains compatible with older servers by narrowly routing
unscoped restore notifications to the chat currently being opened.

Concurrent chat/open requests are rejected because legacy unscoped restore
notifications cannot be associated safely with multiple simultaneous opens.

Preserve scoped config chat IDs, resolve the active chat consistently
from chat and source buffers, and make delete cleanup resilient when a
server notification is missed.

@ericdallo ericdallo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@ericdallo
ericdallo merged commit 610f61c into editor-code-assistant:master Jul 15, 2026
15 checks passed
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.

2 participants