Skip to content

[codex] Fix translation worker queue progress#624

Merged
riderx merged 1 commit into
mainfrom
codex/fix-translation-prod-queue
May 2, 2026
Merged

[codex] Fix translation worker queue progress#624
riderx merged 1 commit into
mainfrom
codex/fix-translation-prod-queue

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented May 2, 2026

Summary

  • Bump the translation cache version so production skips bad partial state from the previous worker.
  • Let queue jobs translate a full page worth of batches instead of one batch per invocation, while persisting partial state between batches.
  • Avoid expensive cache generation from HEAD misses and keep the original string when the model repeatedly drops a protected brand/developer token during single-string fallback.

Root Cause

Production had the latest deploy, but /fr/ and /id/ only had partial R2 state and no completed page object. The queue was flooded by crawler-triggered language URLs, and each page only advanced one batch before being requeued behind more cold work. Logs also showed retries caused by protected-token drops such as Capacitor, which failed whole queue jobs.

Validation

  • bun run ci:verify:translation
  • bun run verify:real-translation
  • bunx wrangler deploy --dry-run

Summary by CodeRabbit

  • Bug Fixes

    • Improved translation reliability by preserving original text when certain errors occur.
  • Performance

    • Enhanced translation processing efficiency through optimized batching.
    • Updated translation cache system for better performance.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 87e48db2-47dc-4d43-ad37-1f4c9701854b

📥 Commits

Reviewing files that changed from the base of the PR and between 19cdbc2 and 809ec9c.

📒 Files selected for processing (1)
  • apps/translation-worker/src/index.ts

📝 Walkthrough

Walkthrough

The PR updates the translation worker with a cache version bump to v3, increases batch-per-job capacity from 1 to 96, adjusts batch state management within the translation loop, adds error handling for protected token drops, and adds early termination for non-GET requests.

Changes

Translation Worker Optimization & Error Handling

Layer / File(s) Summary
Configuration & Constants
apps/translation-worker/src/index.ts
Cache version incremented to 2026-05-02-llama-3.1-8b-json-body-v3; translation batches per queue job increased from 1 to 96.
Batch Processing State Management
apps/translation-worker/src/index.ts
In refreshCacheIncrementally, partial translation state is now written inside the batching loop when per-job batch limit is reached and more batches remain, enabling correct continuation rather than only writing after loop exit.
Error Handling & Fallback
apps/translation-worker/src/index.ts
In translateSingleText, detects "protected token drop" errors; logs and returns original source text instead of proceeding to final failure.
Request Routing
apps/translation-worker/src/index.ts
In serveTranslated, adds early guard returning temporary English redirect for non-GET requests before cache lookup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

A rabbit hops through batches swift, 🐰
From one to ninety-six in shift,
With guarded tokens, states that write,
And GET requests kept shining bright,
The cache hops on, refreshed and tight!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-translation-prod-queue

Review rate limit: 1/5 review remaining, refill in 36 minutes and 19 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@riderx riderx marked this pull request as ready for review May 2, 2026 14:09
@riderx riderx merged commit de0e4f0 into main May 2, 2026
5 checks passed
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 2, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant