fix: hermes agent empty detail — parse session_id from any line #347

Merged
xiaomo merged 1 commits from fix/342-parse-session-id into main 2026-05-18 16:58:25 +00:00
Owner

What

Fix parseSessionIdFromStdout to scan all lines instead of only the last non-empty line.

Why

hermes chat --quiet outputs session_id: xxx on the first line, followed by the AI response. The old code scanned backward and breaked on the first non-empty line that did not match — so it never found the session_id, fell back to storeHermesRawOutput, and stored { text: "" } as detail.

Changes

  • session-detail.ts — scan forward through all lines, return first match
  • session-detail.test.ts — add test case for first-line session_id (quiet mode)

Verified

All 8 tests pass.

Ref

Refs #342

## What Fix `parseSessionIdFromStdout` to scan all lines instead of only the last non-empty line. ## Why `hermes chat --quiet` outputs `session_id: xxx` on the **first** line, followed by the AI response. The old code scanned backward and `break`ed on the first non-empty line that did not match — so it never found the session_id, fell back to `storeHermesRawOutput`, and stored `{ text: "" }` as detail. ## Changes - `session-detail.ts` — scan forward through all lines, return first match - `session-detail.test.ts` — add test case for first-line session_id (quiet mode) ## Verified All 8 tests pass. ## Ref Refs #342
xiaoju added 1 commit 2026-05-18 16:57:40 +00:00
--quiet mode outputs session_id on the first line, not the last.
The old code only checked the last non-empty line and broke immediately
if it didn't match, causing session detail to always be empty.

Fixes the empty detail bug when hermes agent runs in quiet mode.
xiaomo approved these changes 2026-05-18 16:58:24 +00:00
xiaomo left a comment
Owner

LGTM 好 catch。正向扫描 + 测试覆盖 quiet mode 场景。

LGTM ✅ 好 catch。正向扫描 + 测试覆盖 quiet mode 场景。
xiaomo merged commit 7a99c1a9d6 into main 2026-05-18 16:58:25 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#347