Skip to content

An unreachable engine mid-chat: a false "sealing works again", a silent unsaved quit, and a frozen close #1982

Closed

Description

@AbirAbbas

What happened

This came up on dev@cf282ddc6 (2026-10-26), in a two-computer relay test with real models. On one computer the
chat engine's furrow socket file disappeared while furrow kept running. After that, nothing on screen told the
person the truth:

· calls are not being sealed, so rewind cannot reach them: seal: snapshot: engine unavailable: dial unix <CODEAF_HOME>/v3/engine-0.3.4-<hash>.sock: connect: no such file or directory
· sealing works again, and the calls made meanwhile are sealed now

The second line was false for the chat's turns:

  • The turn answered just before it was never sealed into the chat or published.
  • The chat's hold on the relay lapsed, so another computer later took the chat at the previous turn.
  • A clean /quit printed nothing on screen. Only the engine log and stderr said
    codeaf: could not finish saving this chat: seal: snapshot: engine unavailable ….

Closing the chat in this state froze the window for about 35–60 s: no redraw and no key echo. The queued keys were
replayed afterwards. One of them sent another chat's draft.

The turn was not lost in the end. The next take on that computer kept it as kept as 1 turn from <device>. But the
person was told sealing had recovered, and the window kept acting as the chat's writer after its hold lapsed.

Replication

Deterministic (no model). The trigger, an orphaned furrow removing a socket path it no longer owns:

  1. Start codeaf on a throwaway CODEAF_HOME=H and open a chat, so the engine starts its furrow
    (furrow … serve --socket H/v3/engine-<v>.sock --idle-minutes 10).
  2. kill -9 the engine only. Its furrow child survives.
  3. rm -rf H, then start codeaf on H again and open a chat. A new furrow binds the same socket path. Turns work.
  4. Wait for the orphan's idle exit (about 10 min). It removes the socket path, which now belongs to the new furrow.
  5. The new furrow still listens and still holds engine-<v>.sock.lock, but the path is gone. Every dial fails with
    no such file or directory, and a freshly started furrow finds the lock held and exits. Nothing recovers until
    that furrow dies.

Step 3's rm -rf of a live home is what a test harness does, not a person. The gaps below matter whatever makes the
engine unreachable mid-chat.

Field (real models). After step 5, send a turn and then /quit. Expect the two sentences above, no publish
for the turn, and a silent quit.

Where

  • furrow's serve: socket cleanup on idle exit. It should unlink only a path that is still its own socket, compared
    by device and inode.
  • internal/cellstore/daemonstart.go, startAndDial / awaitDial: a held lock with no socket file is never
    treated as a stuck daemon.
  • internal/cellstore/sealwatch.go, the string sealing works again: it fires on any later successful seal, while
    the chat's turn seal or publish still fails.
  • cmd/codeaf/main.go, the string could not finish saving this chat: stderr only, never on screen.
  • The chat-close path in internal/tui3: it blocks the update loop while the engine is unreachable.

The fix

  • A furrow that exits removes only its own socket.
  • A client that finds a held lock and no socket says plainly that saving is stuck, and tells the person how to
    recover. It doesn't wait forever.
  • sealing works again appears only once the chat's own turns are sealed and published again.
  • A quit that cannot save says so on screen, and names where the unsaved turns are kept.
  • Closing a chat never freezes the window.

Acceptance

An e2e test that drives the real binary through the deterministic replication above (a scripted model is enough),
asserting all of:

  • no sealing works again line while the turn is unsealed;
  • an on-screen sentence at /quit that the chat could not be saved;
  • the window redraws within a second of the close key;
  • after the engine recovers, the turn is sealed and published, or kept as a branch, with the matching sentence.

Activity

  1. added a commit that references this issue on Nov 8, 2026
    644a38e
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions