Skip to content

fix(PromptConverter): parse JSON header properties - #53

Merged
ZhengZhiGeorge merged 1 commit into
mainfrom
codex/fix-prompt-extra-parsing
Aug 1, 2026
Merged

ZhengZhiGeorge merged 1 commit into
mainfrom
codex/fix-prompt-extra-parsing

Conversation

@ZhengZhiGeorge

Copy link
Copy Markdown
Collaborator

Summary

  • parse message header properties as complete JSON values
  • recognize tool and array only as standalone top-level markers
  • preserve single-quoted strings and legacy type="tool_calls" / type="content_array" headers

Problem

msgs2raw() serializes arbitrary response metadata with json.dumps(), while raw2msgs() previously consumed only quoted string values. JSON arrays, objects, null, booleans, and numbers were left partially parsed, allowing nested words such as tool or array to be mistaken for message-type markers.

This could turn a normal JSON content string into tool_calls or structured content and drop response metadata.

Validation

  • 52 passed
  • ruff check src tests examples
  • ruff format src tests examples --check --diff
  • regression coverage for nested reserved words, JSON metadata round trips, current markers, and legacy markers

@ZhengZhiGeorge
ZhengZhiGeorge merged commit baec746 into main Aug 1, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant