Summary
When currentJob is null, any translation_update with a terminal status triggers resetUIToIdle(), which can kill a running batch mid-flight (during the window between finishing one file and the next file's start resolving), or react to a terminal event from a job started in another tab.
Where
src/web/static/js/translation/translation-tracker.js:400-406 (handleTranslationUpdate)
src/web/static/js/translation/batch-controller.js:317 (next file's await ApiClient.startTranslation)
finishCurrentFileTranslation sets currentJob = null at translation-tracker.js:571
Details
currentJob is legitimately null in the window between finishCurrentFileTranslation (null at :571) and the next file's startTranslation resolving (batch-controller.js:317). A duplicate/late terminal event for the just-finished file — or a terminal event from a job started in another tab — lands in that window and calls resetUIToIdle() (sets isBatchActive=false, clears localStorage, re-enables the Translate button), killing the running batch's state.
Suggested fix
Before resetting, verify the event's job id belongs to a job this tab actually owns (track owned job ids), and ignore terminal events for unknown/foreign ids. Don't treat "no current job" as "safe to reset everything."
Found during the June 2026 repo audit. Severity: medium. Confidence: likely.
Summary
When
currentJobis null, anytranslation_updatewith a terminal status triggersresetUIToIdle(), which can kill a running batch mid-flight (during the window between finishing one file and the next file's start resolving), or react to a terminal event from a job started in another tab.Where
src/web/static/js/translation/translation-tracker.js:400-406(handleTranslationUpdate)src/web/static/js/translation/batch-controller.js:317(next file'sawait ApiClient.startTranslation)finishCurrentFileTranslationsetscurrentJob = nullattranslation-tracker.js:571Details
currentJobis legitimately null in the window betweenfinishCurrentFileTranslation(null at:571) and the next file'sstartTranslationresolving (batch-controller.js:317). A duplicate/late terminal event for the just-finished file — or a terminal event from a job started in another tab — lands in that window and callsresetUIToIdle()(setsisBatchActive=false, clears localStorage, re-enables the Translate button), killing the running batch's state.Suggested fix
Before resetting, verify the event's job id belongs to a job this tab actually owns (track owned job ids), and ignore terminal events for unknown/foreign ids. Don't treat "no current job" as "safe to reset everything."
Found during the June 2026 repo audit. Severity: medium. Confidence: likely.