Skip to content

fix: prevent AI JSON parse from leaving request stuck in isWorking - #1742

Open
nothariharan wants to merge 1 commit into
foss42:mainfrom
nothariharan:fix/1741-ai-json-parse-stuck-isworking
Open

fix: prevent AI JSON parse from leaving request stuck in isWorking#1742
nothariharan wants to merge 1 commit into
foss42:mainfrom
nothariharan:fix/1741-ai-json-parse-stuck-isworking

Conversation

@nothariharan

@nothariharan nothariharan commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • Fixes non-streaming AI responses getting stuck with isWorking: true when response JSON decode fails (#1741).
  • Only decode non-empty bodies, wrap kJsonDecoder.convert / formatting in try/catch, and keep the raw response on failure so isWorking: false still runs.

Test plan

  • Create a non-streaming AI request that returns HTTP 200 with invalid JSON (or empty body).
  • Send the request and confirm the UI leaves the working/cancel state (Send is usable again).
  • Confirm a valid JSON AI response still gets formattedBody as before.
  • Confirm a normal HTTP (non-AI) request path is unchanged.

Notes

  • Small, focused bugfix only — no dependency bumps or refactors.
  • AI-assisted for investigation/drafting; change reviewed and understood before submit.
  • No new automated test yet (provider sendRequest path is heavy to scaffold); happy to add one if maintainers want it.

Fixes #1741

Wrap non-streaming AI response JSON decode in try/catch so invalid
bodies keep the raw response and still clear isWorking.

Fixes foss42#1741
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.

bug: non-streaming AI JSON parse leaves request stuck in isWorking

1 participant