fix(ask_followup_question): report non-array follow_up as a type error#662
Conversation
Fixes Zoo-Code-Org#511 A native tool call for `ask_followup_question` with a present-but-non-array `follow_up` (e.g. a keyed object produced by incremental JSON parsing) was forwarded unchecked and then rejected by the tool via `recordMissingParamError`, which always reports the misleading message Missing value for required parameter follow_up The value was the wrong type, not missing, which sent the model into a retry loop with the same payload. Fix: AskFollowupQuestionTool.execute now distinguishes the cases: `null`/`undefined` `follow_up` still reports a missing parameter, while a present-but-non-array value reports a clear type/shape error (surfaced to both the user via `say(error)` and the model via `toolError`) instructing it to retry with a JSON array. `NativeToolCallParser` keeps forwarding the raw follow_up value on the finalize path (with an explanatory comment) rather than guarding with `Array.isArray`, so the tool can emit the precise error instead of the call being silently dropped to null by the generic parser guard. Adds test coverage for string and keyed-object non-array follow_up values, plus a parser finalize test confirming the value is forwarded rather than dropped. Assisted-By: Claude Opus 4.8 in Zoo Code.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
Changesfollow_up Type Validation Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Hmm, after some time I got another such failure again even with my patch in:
Not sure yet how that can be. |
|
I found that with my new problem, the model generates That is even though
which seems to suggest a training bias to emit XML (I'm using Claude Opus 4.8 here). |
edelauna
left a comment
There was a problem hiding this comment.
Thanks for addressing this. I'm wondering if we should file a ticket for the xml findings you mention, and at the very least emit a retry signal with updated instructions?
Related GitHub Issue
Closes: #511.
Description
A native tool call for
ask_followup_questionwith a present-but-non-arrayfollow_up(e.g. a keyed object produced by incremental JSON parsing) was forwarded unchecked and then rejected by the tool viarecordMissingParamError, which always reports the misleading messageThe value was the wrong type, not missing, which sent the model into a retry loop with the same payload.
Fix:
AskFollowupQuestionTool.execute now distinguishes the cases:
null/undefinedfollow_upstill reports a missing parameter, while a present-but-non-array value reports a clear type/shape error (surfaced to both the user viasay(error)and the model viatoolError) instructing it to retry with a JSON array.NativeToolCallParserkeeps forwarding the raw follow_up value on the finalize path (with an explanatory comment) rather than guarding withArray.isArray, so the tool can emit the precise error instead of the call being silently dropped to null by the generic parser guard.Adds test coverage for string and keyed-object non-array follow_up values, plus a parser finalize test confirming the value is forwarded rather than dropped.
Assisted-By: Claude Opus 4.8 in Zoo Code.
Test Procedure
I let Zoo add some tests which look sane and pass, and I'm test-triving the built
.vsixcurrently.Pre-Submission Checklist
Screenshots / Videos
Documentation Updates
Additional Notes
Get in Touch
I'm not really using Discord but I read mentions here on Github.
Summary by CodeRabbit