Skip to content

fix(batch): install deepgram-sdk and langdetect in the worker image - #24613

Merged
Git-on-my-level merged 1 commit into
mainfrom
fix/worker-image-deepgram-langdetect
Nov 4, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
fix/worker-image-deepgram-langdetect

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Requested by David

Every batch-pipeline-worker roll from main fails the image smoke: missing installed dependency modules: deepgram, ..., langdetect, ... (run 41860715660, main c8304ee). cl2-deploy's static bisect traced it:

The last good worker roll was e24fa48 (11-03). This blocks #24603 (the seal-repair discovery fix for today's admission jam) from reaching prod.

Change: add deepgram-sdk==4.8.1, langdetect==1.0.9, websockets==12.0 and aiofiles==24.1.0 to backend/diarizer/requirements-batch-pipeline.txt, all matching backend/requirements.txt, and recompile pylock.batch-pipeline.toml with the file's own uv command. The lock gains 8 packages; marshmallow moves 4.3.1 -> 3.26.2, which is the backend's pin required by dataclasses-json. No code changes. A lazy-import cleanup can follow separately.

Validation:

  • backend/scripts/runtime_image_contracts.py check: passed for 19 registered images.
  • Lock and image tests pass: test_batch_pipeline_lock_jobstore 2, test_admit_role_image 19, test_diarizer_batch_prereqs 6.
  • The authoritative check is the image smoke in the worker deploy workflow; cl2-deploy re-rolls right after merge.

Rollback: revert (the worker keeps rollback digest sha256:4faf8b7a8c53).

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

#24490 (speakers final pass) and #24366 (artifact restore) made the STT
helpers reachable from the batch-pipeline worker, but its lock never gained
their dependencies. The image smoke now fails on every main commit since,
which blocks all worker rolls, including the #24603 seal-repair discovery fix
for the admission jam (run 41860715660).

Pin deepgram-sdk 4.8.1 and langdetect 1.0.9, plus websockets 12.0 and
aiofiles 24.1.0, to backend/requirements.txt and recompile
pylock.batch-pipeline.toml (marshmallow resolves to the backend's 3.26.2).

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T16:30:09.748126Z e2451f8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

View guided diff | Turn on auto-fix | Re-trigger cubic

@Git-on-my-level
Git-on-my-level merged commit 660ee8a into main Nov 4, 2026
64 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/worker-image-deepgram-langdetect branch November 4, 2026 16:36
Git-on-my-level added a commit that referenced this pull request Nov 5, 2026
…24673)

## Why

On 11-04 the batch-pipeline-worker roll failed its deploy-time image
smoke: `missing installed dependency modules: deepgram, … langdetect`.
- #24490 (e089cc3) and #24366 (e113f0c) made those imports reachable
from worker entrypoints.
- `backend/diarizer/pylock.batch-pipeline.toml` lacked the
distributions.
- Every pre-merge check passed. `runtime_image_contracts.py check`
covers first-party source closure only, and backend unit CI syncs the
full `backend/pylock.toml`, which does have both.
- The only third-party closure check ran at roll time, which blocked
worker fixes for hours (#24613).

## What

`python3 backend/scripts/runtime_image_contracts.py check-third-party`
(logic in the new `backend/scripts/runtime_image_dependencies.py`),
wired as the checks-manifest entry
`backend-runtime-image-third-party-closure` (local and ci lanes). Its
triggers include `backend/**/pylock*.toml` and `requirements*.txt`, so a
lock-only edit that drops a dist also runs it.

- **Installed set:** each installer `RUN` (`uv pip sync`, `pip install
-r`, inline pins) in the image's stage chain, including `COPY --from`
stages, is traced back through its `COPY` and `WORKDIR` to the repo
file. `-r` includes are followed.
- **Mapping:** each reachable third-party import from the existing
`third_party_dependency_modules` resolves to distribution candidates:
- longest prefix first, with PEP 503 normalization
(`google.cloud.firestore` → `google-cloud-firestore`);
- an API-version suffix is dropped (`google.cloud.tasks_v2` →
`google-cloud-tasks`);
- `MODULE_DISTRIBUTIONS` covers names that differ (PIL→pillow,
deepgram→deepgram-sdk, yaml→pyyaml, …).
- Bare namespaces (`google`, `google.cloud`) are skipped only as the
whole import path. An unmapped submodule under them fails closed.
- **Scope:** it fails only on closed sets, meaning a pylock or
requirements pinned entirely with `==`. Open sets (range pins, path
installs) can pull a module in transitively, so it prints a note instead
of judging them.
- **Speed:** a shared AST cache keeps it at about 30s for all 19 images.
It runs offline, with no docker or GCP and only stdlib (`tomllib`).

## Measured (m5, this branch's script run on `git archive` snapshots)

| Snapshot | Result |
|---|---|
| main 2ccfc47 (this base) | pass. 11 images checked, 8 noted as open
(models, 4 jobs, parakeet, nllb, plugins) |
| e089cc3 (#24490) | **FAIL** batch-pipeline-worker: deepgram |
| e113f0c (#24366) | **FAIL** batch-pipeline-worker: deepgram |
| e089cc3^ | pass |
| 660ee8a (#24613 fix) | pass |

The unit tests for `test_runtime_image_contracts.py` pass via `test.sh`
(70 passed). The registry-wide walk is deliberately left to the manifest
check, because the fast-unit CPU guard is 1s per test.

## Review (Luna, r1: SHIP-WITH-FIXES, all addressed)
1. `COPY --from` now credits a stage's installs only when the copy
carries a venv or site-packages, not a binary.
2. Explicit mappings are authoritative. An ordinary package is owned by
its top-level name. API-version suffix stripping and longer prefixes
apply only under namespace packages (`google`, `pyannote`).
3. Lock and requirements markers are evaluated for Linux x86_64 CPython
3.11, and undecidable markers never credit a distribution. A
requirements list counts as closed only if a resolver compiled it, so
hand-pinned and direct-URL sets are open. This moves diarizer to the
noted set: 10 images are checked on main, 9 are noted.
4. A fast test pins which registered images are judged.
5. Runtime: 19s locally on an idle host (17s CPU). Luna measured 75s
wall / 36s CPU under load.

## Review (Luna rounds 2-4)
- r2, SHIP-WITH-FIXES:
- Builder stages now credit only installs into the environment the image
copies (the backend builder's system-python `uv` is no longer credited).
  - Namespace matching stops at the provider component.
  - `python_full_version` is decided only when every 3.11.x agrees.
- r3, SHIP-WITH-FIXES: patch-boundary sampling (0, Z-1, Z, Z+1, 9999)
also covers `== '3.11'` and `<= '3.11.99'`.
- r4: **SHIP** at d4453ce.

Extra finding from re-validation: at e113f0c the gate also fails
`pusher`/`backend-pusher` on `soundfile`, which was missing from
`backend/pusher/pylock.toml` until cac4f62. That's a second real break
it would have caught.

Line-Count-Exception: backend/scripts/runtime_image_contracts.py | 1113
-> 1134 | CLI entry, shared AST cache and module alias for the
third-party gate; the gate itself lives in the new
runtime_image_dependencies.py

## Not in this PR (follow-ups from the GLM ciimage scope)
- Adding `batch-pipeline-worker` to `role_images.yml --images` and
widening its PR paths: that's a faithful docker build, but it has runner
cost and cl2-cost sizes it first.
- Closing the open dependency sets (pin `backend/requirements.txt`'s two
range lines, nllb) so those images become checkable.
- Making backend checks required at merge, which is David's call.

Rollback: revert this PR. It only adds a check.

Failure-Class: FC-runtime-image-boundary

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/24673?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24673?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24673&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
kriegcloud pushed a commit to kriegcloud/omi that referenced this pull request Nov 5, 2026
The pre-merge runtime-image gate only checked first-party source closure.
Third-party (pip) closure was checked only by the deploy-time image smoke.
BasedHardware#24490 and BasedHardware#24366 made deepgram and langdetect reachable from the
batch-pipeline-worker while its lock lacked them. Unit CI syncs the full
backend lock, so it stayed green, and the break surfaced at the 11-04
worker roll.

Add `runtime_image_contracts.py check-third-party` and a matching
checks-manifest entry in both the local and ci lanes:

- Trace each installer RUN in the image's stage chain back through its
  COPY to the repository lock or requirements file. Follow `-r`
  includes, inline pins and `COPY --from` stages.
- Map every reachable third-party import to a distribution: longest
  import prefix first, PEP 503 normalization, API-version suffixes
  dropped, and a small table for names that differ (PIL->pillow,
  deepgram->deepgram-sdk, ...). Bare namespace packages are skipped
  only as the whole import path, so an unmapped submodule fails closed.
- Fail only on closed sets: a pylock, or requirements pinned with `==`.
  Open sets (ranges, path installs) may pull a module in transitively,
  so they are reported, not judged.

On main it checks 11 of 19 images and reports 8 open sets. It fails
e089cc3 (BasedHardware#24490) and e113f0c (BasedHardware#24366) on batch-pipeline-worker, and
passes their parent and 660ee8a (BasedHardware#24613). It is offline, needs no
docker or GCP, and takes about 30s for all 19 images with a shared AST
cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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