Skip to content

fix: strip code fences from AI JSON before parsing opportunities - #908

Merged
queenellie873 merged 1 commit into
mainfrom
fix/ai-json-code-fence
Oct 26, 2026
Merged

queenellie873 merged 1 commit into
mainfrom
fix/ai-json-code-fence

Conversation

@queenellie873

@queenellie873 queenellie873 commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Refs #897

The model often wraps its JSON reply in ```json fences, so adding an opportunity fails with "Failed to parse JSON from AI response."
This moves the fence strip from #897 into a shared stripCodeFence() helper, used by opportunities and resume reviews. Plain JSON parses the same as before.
Tested locally: adding an amazon.jobs posting now works end to end and shows on the board.

Type of Change

  • Feature - A non-breaking change which adds functionality.
  • Fix - A non-breaking change which fixes an issue.
  • Refactor - A change that neither fixes a bug nor adds a feature.
  • Documentation - A change only to in-code or markdown documentation.
  • Tests - A change that adds missing unit/integration tests.
  • Chore - A change that is likely none of the above.

Checklist

  • I have done a self-review of my code.
  • I have manually tested my code (if applicable).
  • I have added/updated any relevant documentation (if applicable).

claude-sonnet-4-6 wraps its JSON in ```json fences, so refineOpportunity
failed with "Failed to parse JSON from AI response." after a good page
read. Move the fence strip from resume reviews (#897) into a shared
stripCodeFence helper and use it in both places. Plain JSON parses the
same as before.

@levin0710 levin0710 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@queenellie873
queenellie873 merged commit 94daae9 into main Oct 26, 2026
2 checks passed
@queenellie873
queenellie873 deleted the fix/ai-json-code-fence branch October 26, 2026 01:07
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