Skip to content

fix(post): Prevent failure on parsing - #24

Open
chouetz wants to merge 1 commit into
mainfrom
nicolas.schweitzer/json
Open

fix(post): Prevent failure on parsing#24
chouetz wants to merge 1 commit into
mainfrom
nicolas.schweitzer/json

Conversation

@chouetz

@chouetz chouetz commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

https://datadoghq.atlassian.net/browse/ACIX-1750

Fix this failed workflow

AI review could not be posted: model output did not parse as JSON (Unexpected non-whitespace character after JSON at position 2 (line 1 column 3))

Type of change

  • Bug fix
    The model's final message wasn't pure JSON — it had explanatory text with an early stray brace pair, and the action's brace-slicing heuristic grabbed the wrong start point.
    We improve the pattern matching to prevent this

Checklist

  • I have updated README.md if this change affects behaviour or inputs
  • I have tested the change against a real repository

@chouetz
chouetz requested a review from a team as a code owner July 9, 2026 20:57

@quentinus95 quentinus95 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but I am surprised there is no way to mandate that the full response fits into a specific schema, I thought it was a solved problem (or maybe something we could ask the model to iterate on if we fail to parse the output)

Comment thread src/scan.js
Comment on lines +76 to +77
// Scan backward from the last } to find its depth-matching { so that stray
// brace pairs in prose before the JSON block (e.g. `Foo{}`) are skipped.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand well we are doing this because we expect to receive a bunch of text before the JSON, and want to ignore it?

If yes is it because we cannot force a schema on the response?

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.

2 participants