Files
cc-connect/agent/qoder
emodesireandjuncun_meng 6698ad4950 fix: prevent qoder session hang when no result event is received (#465)
When qodercli outputs plain text instead of stream-json (observed on
Windows when tool calls are involved), readLoop silently discards all
non-JSON lines and never emits an EventResult. The engine then blocks
forever on the events channel waiting for a result that will never
arrive, causing the conversation to hang permanently.

This commit adds fallback logic after the subprocess exits:
- Track whether a "result" event was received during the read loop
- Accumulate non-JSON lines instead of silently discarding them
- If the process exits without a result event, emit a fallback:
  - Non-JSON text output → forwarded as EventResult (user sees response)
  - Process error with no output → EventError with stderr message
  - Scanner error → EventError
  - Clean exit with no output → empty EventResult

This ensures the engine event loop always receives a terminal event,
preventing hangs regardless of qodercli's output format.

🤖 Generated with [Qoder][https://qoder.com]

Co-authored-by: juncun_meng <juncun_meng@kingdee.com>
2026-04-08 22:26:38 +08:00
..