AI 0.24.0: A shared engine for background AI translation
AI 0.24.0 adds PhoenixKitAI.TranslationSweep, the shared engine that other PhoenixKit modules use to fill in missing translations in the background, and moves to PhoenixKit 2.38.
Background translation sweep
A module that wants its content translated in the background keeps its own Oban worker and tells the engine what to translate: its settings, resource types, candidates and prompts. The engine does the rest. It keeps one waiting run per worker that reschedules itself, applies the module’s on and off switches, caps how many items go out per run and how many may be in flight, skips items that already have a job running, and holds back for 24 hours an item whose last job was discarded. It stores the last outcome under ai_translation_sweep_last_run_<sweep_key>, written only when it changes, so a settings panel can show it. reschedule/1, run_tick/2, status/1 and last_run/1 let that panel move the schedule, run a tick by hand and read the state.
The module provides sweep_key/0, sweep_settings/0, sweep_resource_types/0, sweep_candidates/2 and sweep_prompts/0, and may add sweep_ready/1.
An interval of zero, a negative number or an unreadable value is treated as one minute, so the chain always pauses between runs.
This release adds no admin page of its own. A site sees the sweep through the modules that adopt it.
Other changes
Activity entries now go through core’s PhoenixKit.Activity.log/3, which never raises, and the acting user is read through PhoenixKitWeb.Actor, the scope first and then the current user.
Upgrading
AI 0.24 needs PhoenixKit 2.38 or later. No migration: update both dependencies.
Full release notes: AI 0.24.0
0.24.0 · 24 September 2026
Added
-
PhoenixKitAI.TranslationSweep(PR #29). This is the shared engine behind a module’s background AI-translation top-up. The module keeps its own Oban worker and implements the callbacks (sweep_key/0,sweep_settings/0,sweep_resource_types/0,sweep_candidates/2,sweep_prompts/0, and optionallysweep_ready/1). The engine handles the rest:- the self-rescheduling chain, with one waiting tick per worker
- the gates
- the
batchandmax_in_flightcaps - skipping pairs that already have a job in flight
- a 24-hour back-off for a pair whose latest job was discarded
- the last outcome, stored under
ai_translation_sweep_last_run_<sweep_key>and written only when it changes
reschedule/1,run_tick/2(:manualskips only the automatic switch),status/1andlast_run/1are there for a settings panel.
Changed
- Requires
phoenix_kit2.38 or later. Activity entries now go through core’s never-raisingPhoenixKit.Activity.log/3, and the acting user is read throughPhoenixKitWeb.Actor, which checks the scope first and then the current user. The module’s own guard/rescue wrappers are removed. - The legacy API-key migration test now asserts its activity entry.
Fixed
- A sweep interval of zero, a negative number or an unreadable value is treated as one minute. Before, each tick scheduled the next one to run immediately, so the chain never paused.
AI 0.24.0. Install or update: {:phoenix_kit_ai, "~> 0.24"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.