Skip to content

Two chats on one file: a restored path can miss the turn's commit, and a lost-Computer recovery can record the other chat's bytes #231

Closed

Description

@SitgesRun

Two chats changing the same file at the same time, plus one more event, can leave the folder and history out of step. Found by a read-only review of staging 9f39e60. Both are rare: they need two chats on one file at once. They are recorded here, not fixed.

  1. A file restored mid-turn. Chat A changes x, and polling lands it. Chat B then finishes with its own x. A then sets x back to its seed and ends with nothing new. A's last collection sees no difference against its seed or its last capture, so nothing commits x. The folder and the index hold A's restored x, while HEAD holds B's. The next put sends B's. Fix: finalize over every path touched in any of the turn's captures, not just the two endpoint diffs (turn.ts:212).
  2. A lost Computer, recovered from the shared index. A polls x = a. B then stages or commits x = b. A's Computer is lost before its last collection. Recovery takes A's paths from A's captures, but their bytes from the current shared index (turn.ts:237 → projectHistory.ts:142), so it records b. Fix: recover from the session's own captured blobs.

Activity

  1. added
    P1Wrong behaviour or result; you can still go on
    on Nov 15, 2026
  2. SitgesRun commented on Nov 15, 2026

    @SitgesRun
    ContributorAuthor

    Still on staging a01a620: by code read, the last collection finalizes over the endpoint diffs only, and the lost-Computer recovery commits through commitIndexPaths from the shared index (core/turn.ts). P1: wrong history, but needs two chats on one file at once.

  3. SitgesRun commented on Nov 15, 2026

    @SitgesRun
    ContributorAuthor

    Fixed on staging b744a69 by #249 (9b045c1). Each collection now lands every path that any capture since the session's last landing changed (changesAlong over acked..result), so a file restored mid-turn lands and is committed. A capture of a lost session lands from that session's own captured blobs (landCaptures), not from the shared index; forgetCaptures is deleted. Covered by turn.test.ts ("a file the agent changes and restores comes back as it was", "a capture fetched and not landed lands from the project's own refs once its session is gone").

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

    P1Wrong behaviour or result; you can still go on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions