Skip to content

[bug] text typed during a turn is lost when the agent completes#41

Open
sesh-dispatch[bot] wants to merge 2 commits into
mainfrom
dispatch/issue-33
Open

[bug] text typed during a turn is lost when the agent completes#41
sesh-dispatch[bot] wants to merge 2 commits into
mainfrom
dispatch/issue-33

Conversation

@sesh-dispatch

@sesh-dispatch sesh-dispatch Bot commented Jun 24, 2026

Copy link
Copy Markdown

Closes #33

Problem

Text typed into the message bar while the agent was working was discarded when the turn completed. The live editor kept the draft in its buffer through the turn (the errTurnOver return path does not clear it), but the between-turns prompt re-opened the editor through beginInput, which unconditionally zeroed the buffer, throwing away whatever the user had been mid-typing.

Changes

  • harness/tui.go, beginInput: when re-opening the editor, carry an existing non-empty buffer (and its cursor position, snippets, and images) into the next prompt instead of zeroing it. The submit, steer, and /stop paths all clear the buffer before they return, so a non-empty buffer here uniquely identifies the carry-over from a turn that ended mid-draft. A buffer left masked (a secret prompt) never carries, so a secret cannot leak into an ordinary prompt; the guard keys on the prior mask rather than the new one so that holds in both directions.

How to test

Reproduce the original bug and the fix headless through the editor:

go test ./harness/ -run 'TestBeginInput' -v
  • TestBeginInputPreservesDraftAcrossTurnEnd types a steering draft during a turn, ends the turn, then confirms the next prompt returns the carried draft. Without the fix (revert beginInput to t.buf = nil unconditionally) it fails with line = "".
  • TestBeginInputDropsMaskedDraftForOrdinaryPrompt seeds a masked, non-empty buffer and confirms an ordinary prompt clears it. Drop the !t.mask guard and it fails with buf = "hush".

Verification

go build ./... && go vet ./... && go test ./... pass.

sesh-dispatch Bot added 2 commits June 24, 2026 04:41
A steering message typed while the agent worked was discarded when the
turn completed. beginInput unconditionally zeroed the editor buffer when
the between-turns prompt re-opened the editor, destroying a draft that
survived the turn in the live editor's buffer.

Carry an existing non-empty buffer (with its cursor, snippets, and
images) into the next prompt. Submit, steer, and /stop all clear the
buffer before returning, so a non-empty buffer here uniquely identifies
the carry-over. A masked (secret) buffer never carries, keyed on the
prior mask so it holds in both directions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] text typed during a turn is lost when the agent completes

0 participants