Skip to content

fix(agent): recover abrupt turns and trace interrupts - #361

Merged
shayne-snap merged 1 commit into
mainfrom
fix/spurious-abrupt-end
Aug 7, 2026
Merged

fix(agent): recover abrupt turns and trace interrupts#361
shayne-snap merged 1 commit into
mainfrom
fix/spurious-abrupt-end

Conversation

@shayne-snap

Copy link
Copy Markdown
Contributor

What changed

  • recover additional premature end-turn phrases observed in real sessions, including Chinese final/immediate/next-step lead-ins and English finally lead-ins
  • preserve Esc, Ctrl+C, and exit-requested sources through the runtime protocol and cancellation cause
  • persist the interrupt source in hidden turn markers and assistant error details
  • add regression coverage while avoiding ordinary-heading false positives

Why

DeepSeek sometimes ends a response immediately after announcing the next action without emitting a tool call. The existing recovery missed phrases such as 最后是 and 立即, forcing users to type 继续. Cancellation records also collapsed all UI paths into context canceled, making unrelated interruptions impossible to diagnose.

Verification

  • make test
  • make build
  • git diff --check
  • repeated PTY timing test: TestShellRunPTYModeAcceptsWriteStdin, count 5
  • real DeepSeek exec sessions automatically recovered both 最后是 and 立即 lead-ins
  • real TUI session removed the dangling lead-in and continued to TUI_RECOVERED without user input
  • real TUI Esc and Ctrl+C runs persisted source: esc and source: ctrl+c

No real merge or mutating smoke command was executed; smoke tools only ran printf and sleep.

@shayne-snap
shayne-snap merged commit 4dbf58c into main Aug 7, 2026
2 checks passed
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.

1 participant