[rig-sampler] docs(rig): fix misleading analyzeResponse header comments and add JSDoc#62
Merged
Merged
Conversation
The file-header invariant comment claimed the model response was parsed from an '<output>...</output>' XML tag, but the actual implementation in analyzeResponse/parseJson never extracts such a tag — it parses JSON directly from the raw response text with three fallback strategies (direct parse → fenced ```json block → balanced-brace extraction). Fix the two incorrect header lines and add a JSDoc comment on analyzeResponse that accurately documents the three-strategy extraction pipeline so callers understand how repair prompts are triggered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pelikhan
approved these changes
Jul 23, 2026
pelikhan
marked this pull request as ready for review
July 23, 2026 16:54
Contributor
Author
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
Contributor
Author
There was a problem hiding this comment.
Skills-Based Review
Applied /grill-with-docs — the corrections are accurate and the JSDoc is well-formed.
📋 Highlights
Positive Highlights
- ✅ Both header comment lines now accurately describe the three-strategy JSON extraction (direct parse → fenced block → balanced-brace)
- ✅ JSDoc on
analyzeResponseis clear, structured, and consistent with other documented exports - ✅ The misleading
<output>XML tag references are cleanly removed - ✅ No logic changes; all tests pass
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 17.3 AIC · ⌖ 4.04 AIC · ⊞ 6.3K
Comment /matt to run again
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.
Summary
Fixes two incorrect documentation comments in
skills/rig/rig.tsabout howanalyzeResponseextracts JSON from model responses, and adds an accurate JSDoc block on the exported function.Samples run
53-ralf-loop.tsdiagnose+fixagents. Stub ran 2rig.agent.askevents, 1 turn each, no repairs needed. Clean schema fit.54-large-scale-summarization-rigs.tsplanDeterministicSearch/summarizeShard/reduceScenariosub-agents. 6rig.agent.askevents emitted; stub correctly synthesized array outputs from declared schemas.55-file-change-lint-middleware.tszx(not a rig dep). Stub run completed fine, but theskills/rig/samplestypecheck suite catches it. The run highlighted howAgentAddontyping allowszx-style async middleware cleanly.56-single-agent-sonnet.tsrefactorOnesub-agent. Onerig.agent.askevent, stub output matched{file:string, change:string}schema.57-complex-integration-sonnet.ts{summary, questions}output. One turn, no repairs. Schema felt well-matched to the task.What the run revealed
While examining
analyzeResponseto understand why stub outputs were being accepted without any<output>XML parsing, I found two comments in the file-header block that were actively misleading:The actual implementation (
analyzeResponse→parseJson) never looks for an<output>tag. It uses three strategies in order:```json ... ```fenced block.{...}or[...]value.This comment misleads contributors into thinking they need to wrap responses in
<output>tags (or that the prompt somehow asks for them), which is not the case.Change
analyzeResponsedocumenting the strategy order and return shape, consistent with other documented exports likeconfigureAgentandagent.No logic changes; all 156 tests pass.