Skip to content

fix(install): pre-fetch the pinned whisper and codebert models, keep the Docker cache on a volume (#19869) - #20591

Closed
mrveiss wants to merge 2 commits into
mainfrom
issue-19869-models-at-install
Closed

mrveiss wants to merge 2 commits into
mainfrom
issue-19869-models-at-install

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

The speech-to-text and code-embedding models were never provisioned, so the first use downloaded them, or failed on a host with no internet. Docker kept the cache in the container layer, so a recreate lost it.

What Changed

  • autobot_shared/ssot_hf_models.py holds both model ids, and the two loaders read them, so neither is a literal now.
  • autobot_shared/model_prefetch.py fetches each at its pinned revision from pinned_model_registry.py, downloading only the pinned weight files, and verifies the digest. It retries, then reports the model, revision and free space. One failure doesn't stop the other model. A digest mismatch isn't retried. --check downloads nothing and confirms presence.
  • roles/backend: fetch as the service user, then a separate --check. Both models are optional at runtime, so a failure warns and carries on. backend_prefetch_models: false skips it for an air-gapped host, and backend_model_prefetch_required: true makes a failure stop that host.
  • Docker: a huggingface_cache volume on autobot-backend and autobot-worker, and HF_HOME set. The entrypoint fetches in the background and never stops the container, so a slow link can't fail service_healthy dependents. AUTOBOT_PREFETCH_MODELS=false turns it off.
  • deploy: the canonical embedding model is rendered into backend.env but never ensured on the configured model server #19879: an unreachable model server now gets a warning naming the model, where before it said nothing.

Verification

model_prefetch_at_install_19869_test.py (14) and backend_model_server_unreachable_reported_19879_test.py (2) pass, with stubs for the download and YAML reads of the role, compose and entrypoint. Neighbouring guards pass, though the full set wasn't re-run after the last small edits.

Not done:

  • No real download, Ansible run or Docker build.
  • In Docker, a first use during the background fetch can download the same model at the same time. Not tested.
  • The cache location relies on become_user setting the service user's home, which Ansible's default sudo flags do. A host with custom flags could fetch to the wrong place; the --check runs the same way, so it wouldn't catch that.
  • "Every install method" covers the native role and Docker. Other paths weren't checked, including install-slm.sh and install-bare-metal.sh.
  • autobot-celery-beat has no cache mount.
  • deploy: the canonical embedding model is rendered into backend.env but never ensured on the configured model server #19879's criterion 2 says "reports": this warns rather than fails, because the server can be installed by a later role or be a hosted provider. Whether that satisfies it is for review.

Refs #19869, #19738, #19879

Model Used

Claude Opus 5.5

@mrveiss mrveiss added the phase:M1.4 Wizard and SLM: choose a mode, apply it, default models work label Nov 2, 2026
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 6f8c8d9 and aaef734.

Files selected for processing: 17
  • autobot-backend/code_embedding_generator.py
  • autobot-backend/media/audio/pipeline.py
  • autobot-slm-backend/ansible/roles/backend/defaults/main.yml
  • autobot-slm-backend/ansible/roles/backend/tasks/main.yml
  • autobot-slm-backend/ansible/roles/backend/tasks/prefetch_models.yml
  • autobot-slm-backend/ansible/roles/backend/tasks/resolve_models.yml
  • autobot_shared/env_registry_knowledge.py
  • autobot_shared/model_prefetch.py
  • autobot_shared/pinned_model_registry.py
  • autobot_shared/ssot_hf_models.py
  • docker-compose.yml
  • docker/backend/Dockerfile
  • docker/backend/entrypoint.sh
  • docs/developer/ENV_VARS.md
  • repo_tests/backend_model_server_unreachable_reported_19879_test.py
  • repo_tests/embedding_model_literal_guard_18143_test.py
  • repo_tests/model_prefetch_at_install_19869_test.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20591 (head 7e62a03): changes needed.

Read only; nothing was run. Pins, the single home for both ids and the sha256 check are sound, and the cache path matches the runtime on Docker and native. Needed:

  • High, docker/backend/entrypoint.sh:41-52: a prefetch failure does exit 1 before the app starts, by default. Both models degrade gracefully at runtime, so a host with no internet now loses chat, API and migrations over speech-to-text and code embeddings, looping with restart: unless-stopped at about 3 minutes each. Make it non-fatal by default, or fail only on opt-in.
  • High, compose: the backend turns unhealthy about 220 s after start while a ~1 GB fetch runs, and autobot-worker and the frontend use service_healthy, so a first docker compose up on a slow link fails. Docker won't kill the download, but the stack doesn't come up. Fetch in the background after exec, or raise start_period and state it.
  • Medium, prefetch_models.yml: no skip variable, so a fresh air-gapped native install stops here though the models are optional. Add backend_prefetch_models, and consider warning by default.
    Low: --check skips the fetch but runs the check, so a dry run fails; tests replace _snapshot and verify_cached_model, and none covers the Docker failure path; whether codebert's revision has a model.safetensors transformers prefers wasn't checked.

@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20591 (head 87879fc): approve.

Read only; nothing was run. A prefetch failure now warns by default. Docker fetches in the background and never stops the container, tested with a failing python3. The native role has a skip variable and an opt-in hard stop. Lows stand: tests replace _snapshot, and codebert's preferred weights weren't checked. No real download has happened yet, so the first host update should confirm the cache path.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Auto-sync: merging main into issue-19869-models-at-install conflicts

The sync aborted the merge and pushed nothing. Conflicts are information, so it never resolves one itself. Below, for each conflicted file, are the commits that touched it on each side since the merge base fd4c2df91d. Merge main in yourself and push; the label clears on the first run that finds this branch 0 behind.

autobot-slm-backend/ansible/roles/backend/defaults/main.yml

side commit subject issue refs
main 723adb02f Merge remote-tracking branch 'origin/main' into issue-20082-torch-retry none
main f1b3285cc fix(backend): a failed CUDA torch install retries and names the room left (#20082) #20082
this branch bb0ffbc89 Merge remote-tracking branch 'origin/main' into issue-19869-models-at-install none
this branch 87879fc1e fix(install): a model pre-fetch failure warns, and Docker fetches in the background (#19869) #19869
this branch 0f149af89 fix(install): pre-fetch the pinned whisper and codebert models, keep the Docker cache on a volume (#19869) #19869

@mrveiss

mrveiss commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20591 (head bb0ffbc): approve.

Since the last approved head: merges of main. The conflict in roles/backend/defaults/main.yml keeps main's router text plus this PR's settings, read in the merge. The earlier review stands.

@github-actions github-actions Bot removed the sync-conflict Set by the branch sync (#19548) label Nov 2, 2026
@mrveiss

mrveiss commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20591 (head d9fb7b4): approve. Covers the merge of main, read only. The embedding-literal guard's new allowlist entry is for autobot_shared/ssot_hf_models.py, which is the documented one home of those model ids and pins each in pinned_model_registry, so allowlisting it is right rather than a hole. Not checked: the rest of the backend-defaults resolution.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@github-actions github-actions Bot removed the sync-conflict Set by the branch sync (#19548) label Nov 3, 2026

@mrveiss mrveiss left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Delta review d9fb7b4..f48defa: APPROVE.

The range is two commits. aac7256b99 resolves the env_registry_knowledge.py clash, then f48defae92 is a pure main auto-sync merge. The GitHub head is f48defae92; the head you named, aac7256b99, is its parent.

Severity File:line Issue Fix
None autobot_shared/env_registry_knowledge.py AUTOBOT_PREFETCH_MODELS and AUTOBOT_CONVERSATION_FILE_USER_QUOTA_BYTES are each registered exactly once, and there are no duplicate names in the file. docs/developer/ENV_VARS.md lists both. None.
  • Nothing else changed. The PR's diff against current main is the PR's own 17 files (model prefetch, entrypoint, registries, tests). The quota setting is main's own, unchanged.
  • Not checked: no CI result, and I did not run the registry import test.

@mrveiss

mrveiss commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Code review on PR #20591 (head f48defa): APPROVE

A delta review of d9fb7b4..f48defa (a main merge plus an env-registry union). AUTOBOT_PREFETCH_MODELS and the conversation-file quota setting are each registered exactly once, and ENV_VARS.md lists both. The diff against main is the PR's own 17 files.

@mrveiss

mrveiss commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Landed in merge train #20748 as b5dd159 (merged 2026-11-03 23:36 Riga). Closing; the train carried this PR's frozen head.

@mrveiss mrveiss closed this Nov 3, 2026
timothybrush pushed a commit to timothybrush/AutoBot-AI that referenced this pull request Nov 3, 2026
@mrveiss mrveiss reopened this Nov 18, 2026
@mrveiss

mrveiss commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Branch audit (zero-change deletion). This PR shows 0 changed files against main (head 2aba6aa241): every change it carried is already in main. Closing and deleting the branch through this PR; it can be restored with the Restore branch button below.

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

Labels

phase:M1.4 Wizard and SLM: choose a mode, apply it, default models work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant