Skip to content

Prevent Chat retries and delayed Enter from submitting terminal drafts #41

Open

Description

@Tiyouw

Chat sends terminal input separately from the agent's recorded user message. A lost response, a permission/state transition during the paste delay, or a stalled PTY writer needs explicit handling so retries cannot paste twice or submit an uncertain draft.

A deterministic reproducer needs no account or network provider:

  1. Start a synthetic PTY helper through the daemon and show a free composer.
  2. Deliver a message while holding its FIFO writer; wait for the five-second write deadline.
  3. Request another message with a new delivery key, then release the writer.
  4. Verify the later request cannot enqueue Enter behind the expired paste. Retrying the original key must retain its interrupted result without additional input.

Another reproducer changes the helper's hook state to waiting after paste and before Enter, then back to done. Automatic Enter must still be cancelled. A deterministic terminal mutex test covers a competing raw redraw at screen-check/enqueue.

The proposed contribution adds per-run delivery keys, atomic readiness/enqueue, paste write-completion settling, interrupted-paste quarantine and full transcript matching in Chat. Manual terminal input remains available; program replacement creates a fresh automatic-delivery ledger.

Base: cd071c6. Candidate: 1255f94.

This does not establish the cause of earlier intermittent native failures, guarantee native consumption, or certify authenticated fresh/resume/fork/clear/account lifecycles. Enqueue, successful PTY write and recorded UserMessage are separate observations.

Activity

  1. enowdev commented on Nov 5, 2026

    @enowdev
    Owner

    Confirmed on main e306b3b: ui/chat.go:263-292 pastes, sleeps 50ms and presses Enter without re-checking the screen or state; daemon/schedule.go:286-294 does the same with pasteSettle and only checks whether the agent is gone. Retry in ui/chatview/outgoing.go:59 re-sends the whole text, so a lost response can paste twice.

    The per-run delivery key, the guarded Enter, the paste-write-completion settle and the Chat-side acknowledgement all belong in the fix. The build-time copy of the MyGo module in PR #42 does not, so the mechanism there will likely change before this closes.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions