fix(routes): cap AI response logging, gate dev-only logs, fix silent parse failure in /api/questions#43
Conversation
There was a problem hiding this comment.
Pull request overview
Adds additional observability around /api/cleanup response parsing so JSON parsing failures can be diagnosed with more context from the raw Gemini output.
Changes:
- Logs a 500-character preview of the raw Gemini response on every cleanup request.
- On JSON parse failure, logs raw/cleaned text and the parse error, and enriches the HTTP 500 response with parsing hints and a raw preview.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…e-failure previews to 500 chars Agent-Logs-Url: https://github.com/CharlyOlson/promptclean/sessions/4a9d78ca-d883-4f93-8179-4caf63bf7be2 Co-authored-by: CharlyOlson <211200603+CharlyOlson@users.noreply.github.com>
Agent-Logs-Url: https://github.com/CharlyOlson/promptclean/sessions/4a9d78ca-d883-4f93-8179-4caf63bf7be2 Co-authored-by: CharlyOlson <211200603+CharlyOlson@users.noreply.github.com>
…ching cleanup pattern Agent-Logs-Url: https://github.com/CharlyOlson/promptclean/sessions/4e57f475-7171-4221-9946-3d92af02272d Co-authored-by: CharlyOlson <211200603+CharlyOlson@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot Please looker over issues, comments and reccomended sugestionz snd aplly them as you see fit in relation to the repo snd its state |
All review comments and recommendations have already been applied across the 5 commits in this PR:
The one open automated suggestion (using |
Raw Gemini response logs on
/api/cleanupwere unbounded and fired on every request, leaking user content in production. The/api/questionsparse-failure path silently swallowed errors with no diagnostic output.Changes
IS_DEVELOPMENT; no-ops in productionrawText/cleaneddumps replaced with 500-char bounded previews + total length in both/api/cleanupand/api/questions:/api/questionscatch block — wascatch { return res.status(500)... }with zero output; now emits the same bounded diagnosticsrawPreviewandparseErrorfields removed; response contains onlymessageandhint