AI title generation blocks chat input after the response has finished

Author: weimoyoCreated Sep 16, 2026Updated Sep 19, 2026
Labelsbug

Description

When “Generate Title using AI” is enabled, Page Assist keeps the chat in a loading/streaming state after the assistant response has already finished.

The response is fully rendered, but the input remains blocked until the separate title-generation request completes.

This is especially noticeable when the selected model performs reasoning before generating the title, but the issue is not specific to reasoning models: title generation is an auxiliary task and should not block the next user message.

Steps to reproduce

  1. Enable “Generate Title using AI”.
  2. Start a new conversation.
  3. Send a simple message such as 你好.
  4. Wait until the assistant response is completely displayed.
  5. Try to send another message immediately.

Actual behavior

The assistant response is displayed quickly, but the chat remains in the generating/loading state. The user cannot send the next message until title generation finishes.

In my test:

  • Main chat request: 3.02 seconds
  • Title-generation request: 13.09 seconds
  • The input became available only after the title request completed

The title request generated 341 reasoning tokens before returning the short title 初次问候对话. None of this output was visible in the chat, but it still blocked the input.

Expected behavior

The chat input should be unlocked as soon as the main assistant response finishes.

Title generation should run as a background task and update the conversation title asynchronously. It should have its own loading/error state and should not be part of the main chat streaming or isProcessing lifecycle.

The user should be able to send the next message while the title is still being generated.

Possible cause

In the normal chat path, useMessage.tsx waits for saveMessageOnSuccess(...) before clearing the streaming state:

https://github.com/n4ze3m/page-assist/blob/590fdcf2d8d71a63779da58a548686e9bfc171fd/src/hooks/useMessage.tsx#L1038-L1053

For a new conversation, saveMessageOnSuccess synchronously awaits generateTitle(...):

https://github.com/n4ze3m/page-assist/blob/590fdcf2d8d71a63779da58a548686e9bfc171fd/src/hooks/chat-helper/index.ts#L117-L131

The MCP chat path appears to do the same:

https://github.com/n4ze3m/page-assist/blob/590fdcf2d8d71a63779da58a548686e9bfc171fd/src/libs/mcp/normal-chat.ts#L699-L708

As a result, the main chat remains marked as streaming while waiting for an unrelated title request.

Suggested solution

For a new conversation:

  1. Create the history immediately using the first user message as a temporary/fallback title.
  2. Save the user and assistant messages.
  3. finish the main chat operation and clear streaming / isProcessing.
  4. Start generateTitle(...) without awaiting it in the main chat path.
  5. Update the saved history by its ID when the generated title becomes available.
  6. Avoid changing the visible page title if the user has already switched to another conversation.

Title-generation errors should also remain isolated from the completed chat request.

Environment

  • Provider: OpenAI-compatible API
  • Backend: SGLang
  • Model: Qwen3.8-27B
  • Page Assist source inspected at commit: 590fdcf2d8d71a63779da58a548686e9bfc171fd
  • Browser: Chrome
  • Page Assist version: 1.5.83