Skip to content

New chat: first message sent 10–30 s after the session is created on a busy engine, with no feedback #2158

In review

Description

@jacktrnr

Important

Problem — On a busy engine, a new chat's first message is sent 10–30 s after the session is created. During that time the composer still shows the text and nothing visibly happens. That delay is what makes users press Enter again, which created duplicate sessions (fixed by the gate in the companion issue). The delay itself remains.
Approach — Find where the time goes, then fix the cause:

  1. Measure the session.create round trip at the client against the engine's created log line.
  2. Measure how long await startTransition(...) in submit.ts takes; it holds the navigation and the send until every resource in the transition settles.
  3. Correlate with the engine's event-loop lag (SSE-TICK lag_ms) and RSS spikes at session start; check whether the session-start context hooks (stack state, recent sessions, open threads over the chat DB) run on the engine's event loop.

Likely fixes: show optimistic progress in the draft (a "Starting session…" state, or clearing the composer at once), send the prompt without waiting on the navigation transition, and move heavy session-start work off the event loop.
Scope — in: the latency from create to first send, and the composer's feedback while waiting. · out: the duplicate-session gate (companion issue).

Evidence (Jackson's Mac, 2026-11-08, load average ~35)

  • "testing": five sessions created between 15:08:49.2 and 15:09:10.1 UTC; all five first messages sent at 15:09:14.0, i.e. released together.
  • Two other pairs: 10.3 s and 24.9 s, and 11.0 s and 32.6 s from create to first message.
  • Engine SSE-TICK lines between 15:08:44 and 15:09:10 report lag_ms of 3921–4152, and RSS jumping from 305 MB to 566 MB.

Acceptance criteria

  • The cause of the delay is measured and named in this issue.
  • Within 300 ms of pressing Enter, the user sees that the new chat is starting.
  • On an idle engine, the first message is sent within 1 s of the session's creation.

Activity

  1. self-assigned this
    on Nov 8, 2026
  2. added
    bug
    on Nov 8, 2026
  3. jacktrnr commented on Nov 8, 2026

    @jacktrnr
    ContributorAuthor

    Companion: #2157 is the duplicate-session gate (fixed separately); this issue is the delay itself.

  4. added
    0.4.1-beta
    on Nov 23, 2026
  5. jacktrnr commented on Nov 23, 2026

    @jacktrnr
    ContributorAuthor

    Cause (from code; fix in #2177): after session.create, submit.ts sent the first message only after await startTransition(...). Solid resolves that promise when the transition settles, meaning every resource the new session page reads has loaded. Solid also keeps one global transition, so concurrent new chats join it. On the busy engine (lag_ms around 4 s), each page read took seconds. That also explains the five "testing" sessions created over 21 s that all sent at 15:09:14.0: they were all waiting on the same settle. #2177 sends as soon as the route is promoted, and shows a "Starting session…" status under the composer from the moment Enter is pressed. Not measured in a live window yet. Moving engine-side session-start work off the event loop is not in this fix.

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

Metadata

Metadata

Assignees

Labels

0.4.1-betabug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions