fix: harden AI notes + Ask-this-series against provider quirks#97
Merged
Conversation
minimax-m3 wraps responses in markdown code fences and returns Ask-this-series citations as bare id strings, which made /ask and /enhance-notes 502 on parse. Strip code fences before JSON.parse (shared helper), coerce string citations to objects, and drop malformed citations instead of rejecting the whole answer. Adds contract coverage for fenced JSON, string citations, and dropped citations.
…lite The three AI routes hardcoded minimax/minimax-m3 and ignored the AI_MODEL env that infra already plumbed. Add getAiModel() (OPENROUTER_MODEL || AI_MODEL || default) and use it everywhere; set the default and .env/compose to google/gemini-3.1-flash-lite. Contract + e2e assert config-driven resolution.
pratikbodkhe
added a commit
that referenced
this pull request
Jun 5, 2026
fix: harden AI notes + Ask-this-series against provider quirks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Audit of the OpenRouter notes enhancer plus the live
/ask502 fix.Root cause
minimax-m3 (a) wraps its JSON in markdown ```json fences despite json_object mode, and (b) returns Ask-this-series citations as bare id strings rather than objects. Both made
/ask(and intermittently `/enhance-notes`) return 502 on parse.Changes
stripJsonFenceshelper; applied in both/askand/enhance-notesbeforeJSON.parse./askpath.Verified: contract verifier green, lint clean, live OpenRouter output reproduced and confirmed parseable.