Reviewing repository for errors and issues#4
Merged
Conversation
…s env - Add enablement parameter to GitHub Pages workflow to fix deploy failures - Add try-catch around JSON.parse in ollamaClient, openAiCompatibleClient, and gammaClient to handle non-JSON responses gracefully - Restrict environment variables passed to CLI subprocess (PATH, HOME, LANG, TERM only)
Copilot created this pull request from a session on behalf of
krutftw
May 30, 2026 14:55
View session
There was a problem hiding this comment.
Pull request overview
This PR hardens server-side integrations by improving how upstream/provider HTTP responses are parsed (explicitly handling non-JSON bodies) and adjusts runtime configuration for spawned CLI processes, plus a small GitHub Pages workflow tweak.
Changes:
- Add explicit non-JSON response handling in
fetchJsonhelpers for OpenAI-compatible, Ollama, and Gamma API clients. - Restrict environment variables passed to spawned CLI processes.
- Add an
enablementinput to the GitHub Pagesconfigure-pagesworkflow step.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/server/openAiCompatibleClient.js |
Adds guarded JSON parsing with a clearer error when the provider returns non-JSON. |
src/server/ollamaClient.js |
Adds guarded JSON parsing with a clearer error when Ollama returns non-JSON. |
src/server/gammaClient.js |
Adds guarded JSON parsing with a clearer error when Gamma returns non-JSON. |
src/server/cliRunner.js |
Changes spawn() to pass a restricted env instead of inheriting process.env. |
.github/workflows/pages.yml |
Adds enablement: true to actions/configure-pages@v5. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+9
to
+17
| let payload = {}; | ||
| if (text) { | ||
| try { | ||
| payload = JSON.parse(text); | ||
| } catch { | ||
| throw new Error( | ||
| `Provider returned non-JSON response (${response.status}): ${text.slice(0, 200)}` | ||
| ); | ||
| } |
Comment on lines
+23
to
+32
| let data = {}; | ||
| if (text) { | ||
| try { | ||
| data = JSON.parse(text); | ||
| } catch { | ||
| throw new Error( | ||
| `Ollama returned non-JSON response (${response.status}): ${text.slice(0, 200)}` | ||
| ); | ||
| } | ||
| } |
Comment on lines
+13
to
+22
| let data = {}; | ||
| if (text) { | ||
| try { | ||
| data = JSON.parse(text); | ||
| } catch { | ||
| throw new Error( | ||
| `Gamma API returned non-JSON response (${response.status}): ${text.slice(0, 200)}` | ||
| ); | ||
| } | ||
| } |
Comment on lines
+65
to
71
| env: { | ||
| PATH: process.env.PATH, | ||
| HOME: process.env.HOME, | ||
| LANG: process.env.LANG, | ||
| TERM: process.env.TERM | ||
| } | ||
| }); |
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.
Pull request created by AI Agent