Skip to content

fix(ai): Fill with AI rides the platform failover chain; drafts offer, never silently restore - #898

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/ai-fill
Sep 5, 2026
Merged

fix(ai): Fill with AI rides the platform failover chain; drafts offer, never silently restore#898
github-actions[bot] merged 1 commit into
mainfrom
fix/ai-fill

Conversation

@catomean

@catomean catomean commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Fixes the production "Fill with AI" failure reproduced 2026-08-25 on /dashboard/projects/create ("The AI service did not respond. Trying again usually works."). Root cause: form-prefill-service selected ONE provider by key presence and stopped — with GROQ_API_KEY set it called Groq exclusively, so Groq retiring the llama-3.x model family took the feature down while a live OpenRouter key sat configured and unused (the identical outage platform-llm.ts was repaired for on 2026-08-26, in the half nobody looked at). The prefill transport now rides the shared callPlatformJson failover chain (Groq → OpenRouter, per-attempt 30s timeout), so the next model retirement or Groq daily-cap 429 rolls to the next provider instead of failing the user; hasPlatformProviders() keeps the provider_not_configured error distinct. Both vendor keys were verified live against the box's env on 2026-09-05 (Groq 200, OpenRouter 200).

Second defect from the same production session: starting a NEW project silently restored the previous one as a draft ("Your previous work has been restored"), producing a duplicate unless every field was overwritten. The draft is now OFFERED via a toast Restore action instead of applied unasked; clearDraft() latches the autosave interval off after a successful create (the post-create tick used to re-save the just-created entity as a draft); and a pristine, untouched form no longer mints junk drafts or clobbers a stored one. New unit tests lock both contracts.

🤖 Generated with Claude Code

…, never silently restore

"Fill with AI" failed in production on 2026-08-25 ("The AI service did not
respond") because form-prefill-service picked ONE provider by key presence and
stopped: with GROQ_API_KEY set it called Groq exclusively, so Groq retiring the
llama-3.x family (and any future Groq daily-cap 429) killed the feature while a
live OPENROUTER_API_KEY sat configured and unused. platform-llm was repaired
for exactly this on 2026-08-26 — prefill was the same outage in the half nobody
looked at. The transport now goes through callPlatformJson (Groq, then
OpenRouter, per-attempt 30s timeout), and provider_not_configured is
distinguished via the new hasPlatformProviders() export.

Same session, second defect: starting a NEW project silently restored the
previous one as a draft ("Your previous work has been restored"), duplicating
it unless every field was overwritten. Two causes: a found draft was APPLIED
instead of offered, and the autosave interval kept ticking after a successful
create (the success screen leaves submitted values in form state), so the tick
after clearDraft() re-saved the just-created entity. Drafts are now offered
via a toast Restore action, clearDraft() latches autosave off for the mount,
and a pristine form neither writes junk drafts nor clobbers a stored one.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
@github-actions
github-actions Bot merged commit 4de86fc into main Sep 5, 2026
6 checks passed
@github-actions
github-actions Bot deleted the fix/ai-fill branch September 5, 2026 17:41
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.

1 participant