Skip to content

Subagent chatId leaks into parent state #1

Open

Description

@ssjoleary

Where

lua/eca/state.lua around line 106-108 (handler for chat/contentReceived)

Symptom

self.mediator:id() returns subagent chatId (subagent-toolu_...) instead of parent chat chatId.

Why

State updates id from any incoming chat/contentReceived params.chatId. Subagent messages carry their own chatId AND a parentChatId field. Parent's chatId gets overwritten when the subagent emits its first message.

Fix

Skip the id update when the message has parentChatId field present.

Impact

  • chat/promptStop on parent may target subagent (mostly harmless — correct behavior by accident)
  • Stale subagent chatId after subagent finishes could send messages to dead chat
  • Breaks assumptions in any code that relies on mediator:id() returning parent chatId

Size

1-2 line guard, ~10 minutes.

Found

During manual testing of editor-code-assistant#63 (chat/promptStop implementation).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions