Skip to content

fix/defer session creation#100

Merged
xiami762 merged 4 commits intomainfrom
fix/defer-session-creation
Apr 13, 2026
Merged

fix/defer session creation#100
xiami762 merged 4 commits intomainfrom
fix/defer-session-creation

Conversation

@duguwanglong
Copy link
Copy Markdown
Contributor

fix(webui): restore immediate session creation on Session page

  • The previous commit deferred session creation globally, but the Session
    management page needs to create real sessions on button click so users
    can batch-create empty sessions. Revert the deferral for this page only;
    ChatDialog and CreateAgentChat still use deferred creation.

…gent execution

The ChatMessageBubble memo comparator only checked state.status for
the last message part, missing metadata changes. When a sub-agent
starts, the backend publishes the child sessionId via SSE in
state.metadata while status remains "running", so the memo returned
true (skip re-render) and the DelegateTaskCard never received the
updated childSessionId — leaving the button permanently disabled
until a full page refresh.

Add state.metadata to the memo comparison so the component re-renders
when tool metadata (including sessionId) arrives.

Made-with: Cursor
Previously, clicking any "create" button (new session, create agent,
workflow chat, etc.) would immediately create a session via API, causing
empty sessions to pollute the session list.

Now sessions are created lazily — only when the user actually sends
their first message. Key changes:

- Add `createAndSend` helper to `useSessionChat` that atomically
  creates a session and sends the initial message
- Update Session page to use a ref flag (`isCreatingNewRef`) so the
  auto-select-first-session effect doesn't fight with the "new session"
  intent
- Update ChatDialog, CreateAgentChat, EntitySheet, and CreateChatTab
  to pass `onCreateAndSend` to SessionChat for deferred creation
- Fix ChatDialog `initialPrompt` handling to use `createAndSend`
  directly, preventing double-send
- Fix EntitySheet `openRex(msg)` to call `createAndSend` when no
  session exists yet

Made-with: Cursor
The previous commit deferred session creation globally, but the Session
management page needs to create real sessions on button click so users
can batch-create empty sessions. Revert the deferral for this page only;
ChatDialog and CreateAgentChat still use deferred creation.

Made-with: Cursor
@duguwanglong duguwanglong requested a review from xiami762 April 13, 2026 05:20
Keep main's JSON.stringify deep-comparison for metadata, which correctly
handles object identity changes.

Made-with: Cursor
@xiami762 xiami762 merged commit 8c524f6 into main Apr 13, 2026
2 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