-
-
Notifications
You must be signed in to change notification settings - Fork 57.4k
Closed
kevinWangSheng/openclaw
#48Description
Bug type
Crash (process/app exits or hangs)
Summary
promoteThinkingTagsToBlocks can throw when assistant content contains malformed non-object entries (e.g. null) because it reads block.type without a guard.
Steps to reproduce
- Construct an assistant message with
content: [null, {"type":"text","text":"ok"}]. - Call
promoteThinkingTagsToBlocks(message). - Observe a throw:
Cannot read properties of null (reading 'type').
Expected behavior
Malformed content entries should be passed through unchanged (or ignored), and thinking-tag promotion should not throw.
Actual behavior
Function throws before processing content.
Root cause
In src/agents/pi-embedded-utils.ts, message.content.some((block) => block.type === "thinking") and loop branches dereference block.type without validating block shape.
Proposed fix
Add object/type guards before reading block.type and keep existing behavior for well-formed blocks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels