Files
hapi/cli/src/agent/__tests__
SSU-WEI HUANGandGitHub bb40a4e8d0 fix(agy): preserve PTY running status (#1456)
* fix(agy): preserve PTY running status

* fix(agent): let a trailing idle marker win over a same-chunk busy marker

runAgentPty treated any busy marker in a chunk as authoritative, so a
chunk carrying both 'Generating' and the idle footer discarded the idle
marker. With the silence watchdog disabled (agy), nothing re-armed
inputReady and the session stayed 'running' forever. Compare marker
positions: the last one in the chunk reflects the final repaint.

Adds lastMarkerIndex for string and non-global RegExp markers and a
null-watchdog regression with both markers in one ANSI-decorated chunk.

* fix(agent): scan the full chunk and keep busy-run completion bookkeeping

- Scan promptBuffer + data before truncating to PROMPT_BUFFER_SIZE, so a
  busy marker followed by more than 4096 bytes in one callback is still
  seen; otherwise the run never completes and a pending web delivery can
  block subsequent messages.
- When an idle marker wins over a same-chunk busy marker, keep the busy
  confirmation so completeAgentRun fires for the run that just ended.
- lastMarkerIndex now clones non-global RegExps with the g flag and scans
  the original string, preserving anchors and terminating on zero-width
  matches (previously /$/ looped forever).
2026-08-10 10:45:52 +08:00
..