fix(ai): Fill with AI rides the platform failover chain; drafts offer, never silently restore - #898
Merged
Merged
Conversation
…, 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
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.
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-serviceselected 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 outageplatform-llm.tswas repaired for on 2026-08-26, in the half nobody looked at). The prefill transport now rides the sharedcallPlatformJsonfailover 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 theprovider_not_configurederror 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