Skip to content

A Chat opened while the start collects its turn's last results shows the result and cost twice #244

Open

Description

@SitgesRun

Since #239 (staging ec18c0c), a Chat has one follower in a window. Every reader of it, the reopened Chat included, gets its updates from the first one on (extensions/pine-drama/src/core/replay.ts). Codex found this in its last review of #239. Display only: nothing is lost or stored twice.

What happens

  1. The Studio restarts while a Chat's turn runs. At start, resumeUnfinishedTurnFollowUps follows it.
  2. The turn ends. The start's follower stores the ending with composeTurnEnding (the result message and the turn's cost), then collects the turn's last results (collectResultsFromPine). The turn is owed until that collection is done.
  3. The person opens the Chat during that collection. pineSessions.ts (the chat session content provider) builds the history from the store, so the result and the cost line are already in it. Because hasUnfinishedTurnFollowUp is still true, it also gives an activeResponseCallback.
  4. The callback joins the follower (attachChatToPineTurn). The replay emits the ending again, so the Chat shows the result and the cost twice.

Codex's proposed fix: leave the in-progress turn's response out of the initial history, keep its prompt, and let the replay show it.

The race in that fix: if the follower ends between building the history and the callback's attach, the attach finds no follower and starts a new one, which has nothing to say. The response is then in neither the history nor the reply until the window reloads.

Two ways out of the race

  • (a) Attach first, then build the history: whatever the follower will show is left out of the history, and whatever it has already finished is in it.
  • (b) Keep a finished follower's replay readable for a reader that arrives just after it ends, until that turn's response is in the history.

Either way: roughly +20–30 lines, plus a failing-first test that opens the Chat during the final collection and counts the result once.

Severity: wrong display, in the seconds after a restart. Flexibility cuts, item 15.

Activity

  1. added
    P2Experience: wording, feedback, layout, extra steps
    on Nov 15, 2026
  2. SitgesRun commented on Nov 15, 2026

    @SitgesRun
    ContributorAuthor

    Still on staging a01a620: by code read, pineSessions.ts builds the history from the store and then attaches to the one follower (attachChatToPineTurn), whose Replay emits the ending again. P2: display only.

  3. SitgesRun commented on Nov 15, 2026

    @SitgesRun
    ContributorAuthor

    Re-checked on staging b744a69 after #249: still real. pineSessions.ts still builds the history from the store and then attaches to the one follower, whose Replay emits the ending again; #249 only adds left-out lines to that follower's stream. P2.

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

    P2Experience: wording, feedback, layout, extra steps

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions