Repository navigation
Description
What happened
Two forced AI re-translations of the same item and language can overwrite each other, so the one that finishes last wins even when it translated older source text.
A forced job replaces any AI-sourced localized overview or tagline when it writes. It doesn't check that the source text it translated is still the current source. When two forced jobs overlap, the slower one writes its result over the newer one's.
#4234 fixes the plain-versus-forced case from #2472 by letting a plain job fill only empty fields. Forced jobs still replace AI text by design, so this case remains.
Steps to reproduce
Proven from source; not reproduced on a live deployment.
- An admin requests a forced re-translation of a series into a language with model A. The job reads the current overviews and starts calling the model.
- While it runs, the admin edits the series' base overview, switches the description translation model to B, and requests a forced re-translation again. The job key includes the model, so this request gets its own job instead of reusing the first one. With the default AI concurrency of 2 (or on a second node), both jobs run at the same time.
- Job B translates the new overview and finishes first.
- Job A finishes and writes its translation of the old overview over job B's result. Both jobs report success.
Expected behavior
A translation of outdated source text never replaces a translation of the current source text.
Silo version / commit
main at 703f457 (the rule is unchanged on the #4234 head).
Deployment
n/a, found by source review.
Clients affected
Other/not client-specific (stored localized descriptions shown by every client).
Relevant logs
No logs available.
Technical notes
- Write:
internal/catalog/localization_repo.go,UpsertAITranslationand the season and episodeUpsertAIOverview. A forced write lands whenever the stored value is AI-sourced. - Job key:
idempotencyKeyininternal/metadata/translation/job.goincludes the model, so forced requests with different models don't share a job. - Concurrency:
ai.max_concurrent_jobsdefaults to 2 (internal/config/db_loader.go), and each node runs its own jobs. - Possible repair: have the job pass the source text (or a hash of it) it translated, and write only when that still matches the item's current source text, or the field is empty. That check would cover any writer that changes the source between collection and write, not only forced jobs.
- This follows fix(metadata): let a plain AI translation fill only fields still empty #4234, which changes the same SQL statements.
AI harness
Claude Code (in T3 Code)
AI tool(s)
Claude Code, OpenAI Codex (review)
AI model(s)
claude-opus-5-5, gpt-6.1-sol
AI involvement
Fully AI-generated from a source review; not reproduced on a live deployment.
Independent or adversarial review
Found independently by a code-review subagent (claude-opus-5-5) and a cross-provider review (gpt-6.1-sol) of #4234, then checked against the source by claude-opus-5-5.
Confirmations
- I searched open and recently closed issues and pull requests, and this is not already reported
- I reproduced this myself on a real deployment
Source: found in review of #4234
Activity
fix(metadata): drop an AI translation of base text that has since cha…