6 Commits

Author SHA1 Message Date
whs
5a401464a5 fix(agent): improve cross-channel session persist robustness 2026-04-16 15:04:00 +08:00
chengyongru
1747ed7885 fix(agent): persist cross-channel messages into target session history
When session A (e.g. websocket) uses the `message` tool to send to
channel B (e.g. feishu), the outbound message is delivered to the user
but was never recorded in session B's history. This caused session B to
lose context when the user replied on that channel.

Add `_persist_cross_channel_calls()` to detect cross-channel `message`
tool calls during `_save_turn()` and append a lightweight assistant
entry (with `_cross_channel: True` marker) to the target session.
2026-04-14 00:14:30 +08:00
Xubin Ren
6484c7c47a fix(agent): close interrupted early-persisted user turns
Track text-only user messages that were flushed before the turn loop completes, then materialize an interrupted assistant placeholder on the next request so session history stays legal and later turns do not skip their own assistant reply.

Made-with: Cursor
2026-04-13 10:26:09 +08:00
Xubin Ren
b964a894d2 test(agent): cover early user-message persistence
Use session.add_message for the pre-turn user-message flush and add focused regression tests for crash-time persistence and duplicate-free successful saves.

Made-with: Cursor
2026-04-13 10:26:09 +08:00
Xubin Ren
fbedf7ad77 feat: harden agent runtime for long-running tasks 2026-04-01 19:12:49 +00:00
chengyongru
72acba5d27 refactor(tests): optimize unit test structure 2026-03-24 15:12:22 +08:00