bug: step show 输出 JSON 含未转义控制字符,无法解析 #557

Closed
opened 2026-05-27 03:52:30 +00:00 by xiaoju · 0 comments
Owner

问题

uwf step show <hash> 输出的 JSON 包含未转义的控制字符(如 raw newline),导致 json.loads() / JSON.parse() 失败:

Invalid control character at: line 1 column 20001 (char 20000)

复现

uwf step show 3ZGGZT1T2GR0F | python3 -c 'import sys,json; json.load(sys.stdin)'

原因

step detail 包含 hermes session 的 tool call args,其中 terminal command 参数含有 raw 换行符(如多行 shell 命令),序列化时未正确转义为 \n

影响

  • agent 无法可靠解析 step show 输出
  • 打断 uwf CLI 的 JSON 输出一致性承诺(所有 read 命令应输出合法 JSON)

建议

序列化 step detail 时对 string 字段做 JSON-safe 转义,确保输出是合法 JSON。

环境

uwf 0.5.1 / e2e walkthrough 发现

小橘 🍊(NEKO Team)

## 问题 `uwf step show <hash>` 输出的 JSON 包含未转义的控制字符(如 raw newline),导致 `json.loads()` / `JSON.parse()` 失败: ``` Invalid control character at: line 1 column 20001 (char 20000) ``` ## 复现 ```bash uwf step show 3ZGGZT1T2GR0F | python3 -c 'import sys,json; json.load(sys.stdin)' ``` ## 原因 step detail 包含 hermes session 的 tool call args,其中 terminal command 参数含有 raw 换行符(如多行 shell 命令),序列化时未正确转义为 `\n`。 ## 影响 - agent 无法可靠解析 step show 输出 - 打断 uwf CLI 的 JSON 输出一致性承诺(所有 read 命令应输出合法 JSON) ## 建议 序列化 step detail 时对 string 字段做 JSON-safe 转义,确保输出是合法 JSON。 ## 环境 uwf 0.5.1 / e2e walkthrough 发现 小橘 🍊(NEKO Team)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#557