fix(inworld): guard voices JSON.parse against malformed API response bodies#98660
Conversation
d1d751c to
16a3c61
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 11:15 AM ET / 15:15 UTC. Summary PR surface: Source +5, Tests +2. Total +7 across 2 files. Reproducibility: yes. Source inspection shows current main parses the bounded voices response with raw JSON.parse, and the existing test harness can queue a malformed 200 response through listInworldVoices; I did not execute tests because this was a read-only review. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land this narrow plugin-local parse guard after normal maintainer review, keeping the fix confined to Inworld's voice-list response boundary. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main parses the bounded voices response with raw JSON.parse, and the existing test harness can queue a malformed 200 response through listInworldVoices; I did not execute tests because this was a read-only review. Is this the best way to solve the issue? Yes. A local try/catch at the voice-list parse boundary is the narrowest maintainable fix and matches the existing Inworld TTS malformed-stream handling without adding config, SDK surface, or shared helper churn. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a5a8d992aecb. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +5, Tests +2. Total +7 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
dffac9d to
54803de
Compare
54803de to
a8d0a1f
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
What Problem This Solves
extensions/inworld/tts.ts:248callsJSON.parse(voicesBody)on the Inworld voices API response body without try/catch. Malformed JSON → unhandled SyntaxError → process crash.Changes
extensions/inworld/tts.ts: wrapJSON.parse(voicesBody)in try/catch → throw descriptiveError("Inworld voices API returned malformed JSON")extensions/inworld/tts.test.ts: tighten the malformed-voices regression test to assert the descriptive error message instead of bare.rejects.toThrow()Label: bugfix | merge-risk: 🟢 minimal
Evidence
Real behavior proof — calls listInworldVoices through local HTTP response harness
Unit test
User Impact
If the Inworld voices API ever returns a non-JSON 200 response, users will see a descriptive
"Inworld voices API returned malformed JSON"error instead of an unhandledSyntaxErrorthat crashes the gateway or CLI process.