Skip to content

AI 0.20.0: Failed translations show in the activity log

AI 0.20.0 makes failed AI translations visible: each translation that finally fails now leaves an entry in the activity log, next to the entry a successful one already wrote.

Failed translations in the activity log

The translation job writes an ai.translation_failed activity entry when a translation ends for good: bad arguments, an unknown adapter, a missing resource, an error that cannot be retried, or a retryable error after the last attempt. A pending retry writes nothing. The entry carries a short, fixed classification of the reason, never the raw reason, because some failures can contain the resource’s content. Failures while saving the result are now told apart in that classification as well.

No inline scripts

The endpoint form and the Playground no longer carry inline <script> blocks. The manual model ID input, the model search and the Playground’s scroll to a new answer now live as hooks in the module’s JavaScript (PhoenixKitAIManualModelInput, PhoenixKitAIModelGridSearch and PhoenixKitAIScrollIntoView), which suits sites with a strict Content Security Policy. The manual model input also picks up a value the server sets.

Upgrading

No migration. Update the dependency. The new activity entries start appearing for translations that fail after the update.

Full release notes: AI 0.20.0

0.20.0 · 10 September 2026

Added

  • TranslateWorker now writes an ai.translation_failed activity entry on every terminal failure, mirroring the existing ai.translation_added success entry. Covers both perform/1’s setup-failure branch (bad args, unknown adapter, missing resource) and fail/3‘s two terminal clauses (deterministic discard, or a retryable reason with attempts exhausted) — never on a pending retry, matching the existing PubSub broadcast’s own silence there. The raw failure reason is never persisted verbatim; a new classify_reason/1 reduces it to a short, static classification tag first, since some failure shapes can embed resource content (#24).

Fixed

  • classify_reason/1’s persist-failure detail was unreachable. The generic {:persist_error, _reason} clause matched before the specific {:bad_put_translation, _other} clause, which only ever matched a shape nothing in the module produces at the top level in production — persist/2 always wraps it as {:persist_error, {:bad_put_translation, _}}. Every persist failure logged with reason_detail: nil instead of distinguishing “adapter returned a malformed shape.” Reordered the clauses and added the analogous {:persist_error, {:exception, _}} case.

AI 0.20.0. Install or update: {:phoenix_kit_ai, "~> 0.20"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.