Skip to content

BUG: one chat message creates two identical sessions (double session-create dispatch) #655

Description

@aarontrowbridge

Summary

A single first message in a fresh chat created two identical sessions — same derived
title, same agent (plan), same project/directory, both parentless, created 3 seconds
apart, each ingesting its own copy of the same user prompt. Both ran concurrently; the
duplicate fanned out five research subagents that redid the first session's work
(~$10 redundant spend) before the user noticed. The user described it as "a clone of
this session also spawned somehow" and asked for this report from the session where it
was investigated.

Context

Expected vs actual

  • Expected: one session per submitted message.
  • Actual (from the local session DB):
    • Two session.created events 3 s apart on 2026-08-30 ~23:46 UTC:
      ses_faaeea8ecffef5gqUKv7ZPUi8d (23:46:34) and ses_faaee9e49ffeg5C97NT2u5WnSU
      (23:46:37). Identical title and agent, same project/directory, parent_id null on
      both — a true double-create, not a fork or an explicit spawn.
    • Two separate user-message records with identical text 5 s apart
      (msg_055115d02001eK3OCTgpW4hugH at 23:46:37, msg_055116fc4001V6tfuvmDsAbcsU
      at 23:46:42).
    • Both sessions stayed live and working concurrently; only one received the user's
      later inputs — a state-divergence hazard: with the dev workflow enabled, two
      autonomous executors would race for the same worktrees.
Diagnostics
  • Repro pointers: the two session IDs above; DB tables session (time_created,
    parent_id, title, agent), message (data.role, timestamps), event
    (aggregate_id = session id; seq 0 = session.created.1).
  • Upstream adjacents (anomalyco/opencode, both closed before this pin's era, not exact
    matches): #24773 "createUserMessage() runs outside the concurrency gate" (duplicated
    user messages), #24768 "[P1] session auto-resume race". The create paths have a known
    race history — check whether the fork's session-create path (or the extension's
    first-message dispatch) lacks an idempotency/concurrency gate.
  • No absolute paths, no binary uploads; no run active (not a solve bug).

intake: not-ready — mature per the maturity contract before picking up
suggested_path: B
diagnostics: inline
upstream: none found

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions