Retry failed automatic translations once.
This commit is contained in:
@@ -27,6 +27,13 @@ surface AiEngine {
|
||||
-- The active endpoint's response, parsed into per-field suggestions
|
||||
}
|
||||
|
||||
surface AutoTranslationRuntime {
|
||||
facing _: AiRuntime
|
||||
|
||||
provides: PostAutoTranslateAttemptFailed(post_id, language, reason)
|
||||
provides: PostAutoTranslateRetryFailed(post_id, language, reason)
|
||||
}
|
||||
|
||||
-- ─── AI operation gating ────────────────────────────────────
|
||||
--
|
||||
-- All AI operations route through the active endpoint for the current
|
||||
@@ -130,6 +137,18 @@ rule AutoTranslationChain {
|
||||
-- languages enqueues nothing (empty set).
|
||||
}
|
||||
|
||||
rule RetryFailedAutoTranslationOnce {
|
||||
when: PostAutoTranslateAttemptFailed(post_id, language, reason)
|
||||
ensures: ToastShown(message_key: "engine.autoTranslationRetrying")
|
||||
ensures: PostAutoTranslateRetried(post_id, language, maximum_attempts: 2)
|
||||
}
|
||||
|
||||
rule ReportFailedAutoTranslationRetry {
|
||||
when: PostAutoTranslateRetryFailed(post_id, language, reason)
|
||||
ensures: BackgroundTaskFailed(post_id, language, reason)
|
||||
ensures: ToastShown(level: "error", reason: reason)
|
||||
}
|
||||
|
||||
rule MediaMetadataTranslationCascade {
|
||||
when: PostAutoTranslateCompleted(post_id, language)
|
||||
let saved_post = post/Post{id: post_id}
|
||||
|
||||
@@ -222,6 +222,12 @@ surface AutoTranslationControlSurface {
|
||||
FillMissingTranslationsRequested(project)
|
||||
}
|
||||
|
||||
surface AutoTranslationRuntime {
|
||||
facing _: TranslationOperator
|
||||
|
||||
provides: AutoTranslatePostCompleted(post, language)
|
||||
}
|
||||
|
||||
invariant AutoTranslationGatedByEndpoint {
|
||||
-- No automatic translation runs unless an endpoint is resolvable for the
|
||||
-- current mode. Airplane mode needs url+model; online additionally needs an
|
||||
@@ -281,7 +287,14 @@ rule AutoTranslatePost {
|
||||
|
||||
@guidance
|
||||
-- An empty body yields a no_content_to_translate error and no
|
||||
-- translation is created.
|
||||
-- translation is created. A response that leaves any non-empty source
|
||||
-- field empty is also an error and is never persisted.
|
||||
}
|
||||
|
||||
rule RefreshCompletedAutomaticTranslation {
|
||||
when: AutoTranslatePostCompleted(post, language)
|
||||
ensures: OpenPostEditorTranslationsRefreshed(post, language)
|
||||
ensures: UnsavedPostEditorContentPreserved(post)
|
||||
}
|
||||
|
||||
rule AutoTranslateMediaCascade {
|
||||
|
||||
Reference in New Issue
Block a user