Skip to content

Fix AI review and comparison runtime - #17

Merged
codoom1 merged 1 commit into
mainfrom
agent/fix-ai-runtime
Jul 25, 2026
Merged

Fix AI review and comparison runtime#17
codoom1 merged 1 commit into
mainfrom
agent/fix-ai-runtime

Conversation

@codoom1

@codoom1 codoom1 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Root cause

Production Vercel logs showed that OpenAI successfully returned 200 OK for recommendation reviews, but the structured JSON was truncated by the shared AI_MAX_OUTPUT_TOKENS=400 setting. Every review then failed JSON parsing and fell back to the rules-based result.

The comparison chatbot endpoint also had successful production requests, but new button clicks were not reaching the endpoint. The deployed HTML contained the button while browsers could continue using the older unversioned chatbot.js, which had no handler for it.

What changed

  • gives structured recommendation reviews a feature-specific 1,500-token output budget
  • leaves the general chatbot output budget unchanged
  • detects an explicitly incomplete OpenAI response before attempting to parse it
  • versions chatbot JavaScript and CSS URLs to invalidate stale browser caches
  • adds regression coverage for token overrides, incomplete responses, review configuration, and asset versioning

User impact

AI-assisted reviews can now complete their strict JSON response instead of displaying the generic unavailable message. The “Compare alternatives with AI” button will load the current JavaScript handler and send its question to the chatbot.

The deterministic recommendation remains available if a genuine provider failure occurs.

Validation

  • production Vercel logs inspected to establish both root causes
  • python -m pytest -q tests/ — 132 passed
  • focused integration and route tests — 47 passed
  • node --check public/static/js/chatbot.js — passed
  • fatal-error flake8 checks — passed
  • git diff --check — passed

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
statistical-model-suggester Ready Ready Preview, Comment Jul 25, 2026 12:29am

@codoom1
codoom1 marked this pull request as ready for review July 25, 2026 00:31
Copilot AI review requested due to automatic review settings July 25, 2026 00:31
@codoom1
codoom1 merged commit 80b2d7d into main Jul 25, 2026
7 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants