Skip to content

feat: make Gemma 4 the only local AI engine - #206

Merged
KrasimirKralev merged 1 commit into
ID-Robots:betafrom
KrasimirKralev:feature/local-ai-gemma-only
Jun 16, 2026
Merged

KrasimirKralev merged 1 commit into
ID-Robots:betafrom
KrasimirKralev:feature/local-ai-gemma-only

Conversation

@KrasimirKralev

@KrasimirKralev KrasimirKralev commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What

Make Gemma 4 (llama.cpp) the only local AI engine β€” hide Ollama from both local-AI surfaces, and offer Gemma as a step in first-run setup.

Why

On the Jetson, Gemma 4 (an e2b model) runs at its full 131K context, while the 3B-class Ollama models are RAM-capped at 32K β€” a 128K KV cache would need ~12.5 GB. 32K is too tight for the agent's ~20K-token system prompt + tool schemas, so Ollama responses are cramped/low-quality even after the reserve fix. Gemma is the one local engine that performs well on this hardware, so it should be the local default and the only exposed option for now.

Changes

  • Settings β†’ Local AI: provider list ["llamacpp", "ollama"] β†’ ["llamacpp"]. Ollama's provider def, OllamaModelPanel, hooks and configure route are left intact β€” this is a UI-level hide, reversible by re-adding "ollama" to the array.
  • Setup wizard: re-introduces a skippable, Gemma-only local-AI step (step 5, between cloud AI and Telegram). Rewires the progress bar, help popover, applyStatusData resume logic, progress persistence and the completion gate for the 6-step flow.
  • i18n: adds progress.localAi, wizard.helpLocalAiTitle/Body, and wizard.localAiDescription to all 10 locales (parity preserved).

Validation (on a real OpenClaw 2026.6.6 device)

Ran the affected suites against an origin/beta worktree with the box's own toolchain β€” 55/55 pass:

  • translations.test.ts (40) β€” locale key-parity + placeholder checks hold with the new keys.
  • setup-wizard.test.tsx (3) β€” 6-step resume/persistence (persisted step 5 β†’ Local AI; configured local β†’ Telegram).
  • settings-app.test.tsx (3) + ai-models-step.test.tsx (9).

Notes

  • Ollama is hidden, not removed β€” backend stays wired so re-enabling is a one-line change.
  • The wizard's integer step-numbering (a pre-existing pattern) is renumbered correctly here; a step-registry refactor to remove that fragility is left as a separate follow-up.

Summary by CodeRabbit

  • New Features

    • Added "Fully local" badge and label for local AI providers with multilingual support
    • Llamacpp is now the exclusive provider for fully local AI deployments
  • Tests

    • Updated end-to-end and unit tests to reflect local AI provider configuration changes

@KrasimirKralev
KrasimirKralev requested a review from a team as a code owner June 15, 2026 19:55
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e173a1dc-84ef-4125-bd59-c01f8ffd66f8

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 27e5f45 and 541434b.

πŸ“’ Files selected for processing (7)
  • e2e/settings-workflow.spec.ts
  • e2e/setup-local-ai-order.spec.ts
  • src/components/AIModelsStep.tsx
  • src/components/SettingsApp.tsx
  • src/components/SetupWizard.tsx
  • src/lib/translations.ts
  • src/tests/components/ai-models-step.test.tsx

πŸ“ Walkthrough

Walkthrough

Ollama is removed from local AI provider selections in both SetupWizard and SettingsApp. llamacpp is promoted into PRIMARY_PROVIDER_IDS in AIModelsStep and receives its own "fully local" badge (split from the previous shared badge with clawai). The ai.fullyLocal translation key is added across all 10 locale maps. Unit and e2e tests are updated to assert Ollama's absence and the "Fully local" badge.

Changes

llamacpp Promotion and Ollama Removal

Layer / File(s) Summary
AIModelsStep primary list, fully-local badge, and translations
src/components/AIModelsStep.tsx, src/lib/translations.ts
llamacpp is added to PRIMARY_PROVIDER_IDS; badge rendering splits so clawai shows "recommended" and llamacpp shows a new "fully local" pill; ai.fullyLocal is added to all 10 locale maps.
SetupWizard and SettingsApp providerIds wiring
src/components/SetupWizard.tsx, src/components/SettingsApp.tsx
SetupWizard's AIModelsStep gains llamacpp in providerIds; SettingsApp's "Set Up Local AI" step is narrowed to llamacpp only, removing ollama.
Unit and e2e test updates
src/tests/components/ai-models-step.test.tsx, e2e/settings-workflow.spec.ts, e2e/setup-local-ai-order.spec.ts
Unit tests mock ai.fullyLocal, narrow providerIds to ["llamacpp"], and assert Ollama/ClawBox/OpenAI GPT absence with "Fully local" badge present. E2e tests assert Ollama count is 0 and verify Gemma 4 appears in the AI provider radiogroup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

πŸ‡ Hop hop, Ollama's gone away,
The llama.cpp alone holds sway,
"Fully local" badge now gleams so bright,
Ten tongues translated overnight,
No separate step, just one smooth lane β€”
The wizard flows without the strain! ✨

πŸš₯ Pre-merge checks | βœ… 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
βœ… Passed checks (4 passed)
Check name Status Explanation
Title check βœ… Passed The title 'feat: make Gemma 4 the only local AI engine' is clear, concise, and directly summarizes the main change across all modified filesβ€”restricting local AI providers to Gemma 4 (llama.cpp) only.
Description check βœ… Passed The PR description thoroughly covers all required template sections: a clear summary of the change, justification for why (performance constraints on Jetson hardware), detailed technical changes, validation results, and important implementation notes.
Linked Issues check βœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check βœ… Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests

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

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

πŸ€– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/SetupWizard.tsx`:
- Around line 49-51: The SetupWizard component sets currentStep to 7 when
data.telegram_configured is true, but the wizard only renders steps 1–6, which
breaks the UI when completion fails. Change setCurrentStep(7) to
setCurrentStep(6) in the condition checking data.telegram_configured to keep the
current step within the valid range of rendered steps. This ensures the retry UI
at the specified line range (575-586) can display properly for step 6, and the
ProgressBar receives a valid aria-valuenow value not exceeding its maximum of 6.
- Around line 610-617: The AIModelsStep component has a hardcoded English title
"Set Up Local AI" that should be localized. Replace the hardcoded title
attribute with a call to the translation function t() using an appropriate
localization key (follow the naming pattern of the description key
"wizard.localAiDescription" to maintain consistency), ensuring the title uses
the translated strings that were added for Local AI in all locales.
πŸͺ„ Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c5069182-ade6-4f0a-974a-055b541680b2

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 4bb9d07 and 27e5f45.

πŸ“’ Files selected for processing (5)
  • src/components/ProgressBar.tsx
  • src/components/SettingsApp.tsx
  • src/components/SetupWizard.tsx
  • src/lib/translations.ts
  • src/tests/components/setup-wizard.test.tsx

Comment on lines 49 to 51
if (data.telegram_configured) {
setCurrentStep(6);
setCurrentStep(7);
beginCompletion();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚑ Quick win

Keep the UI step within the six rendered steps.

Line 50 sets currentStep to 7, but the wizard only renders steps 1–6 and the retry UI at Line 575 only appears for step 6. If completion fails after resuming from telegram_configured, the overlay closes with no step or retry visible; ProgressBar also receives aria-valuenow=7 while its max is 6.

πŸ› Proposed fix
   if (data.telegram_configured) {
-    setCurrentStep(7);
+    setCurrentStep(6);
     beginCompletion();
     return;
   }

Also applies to: 575-586

πŸ€– Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/SetupWizard.tsx` around lines 49 - 51, The SetupWizard
component sets currentStep to 7 when data.telegram_configured is true, but the
wizard only renders steps 1–6, which breaks the UI when completion fails. Change
setCurrentStep(7) to setCurrentStep(6) in the condition checking
data.telegram_configured to keep the current step within the valid range of
rendered steps. This ensures the retry UI at the specified line range (575-586)
can display properly for step 6, and the ProgressBar receives a valid
aria-valuenow value not exceeding its maximum of 6.

Comment thread src/components/SetupWizard.tsx Outdated
@KrasimirKralev
KrasimirKralev force-pushed the feature/local-ai-gemma-only branch from 27e5f45 to 788a098 Compare June 15, 2026 20:45
On Jetson, Gemma 4 (llama.cpp) runs at its full 131K context while the 3B
Ollama models are RAM-capped at 32K β€” too tight for the agent's heavy system
prompt β€” so Gemma is the only local engine that performs well. Make it the
sole local option, folded into the existing AI Provider step (cloud-first,
"go local from here") rather than a separate wizard step.

- AI Provider step + Settings -> Local AI: Gemma is offered alongside the
  cloud providers; Ollama is hidden (its provider def, panel, hooks and routes
  are left intact, so re-enabling is a one-line revert).
- Gemma is promoted up-front (PRIMARY_PROVIDER_IDS) and carries a "Fully
  local" badge instead of "Recommended" (which stays on ClawBox AI).
- i18n: ai.fullyLocal across all 10 locales.

Validated on a 2026.6.6 device: 55/55 affected tests green.
@KrasimirKralev
KrasimirKralev force-pushed the feature/local-ai-gemma-only branch from 788a098 to 541434b Compare June 15, 2026 20:56
@KrasimirKralev
KrasimirKralev merged commit 1ed5518 into ID-Robots:beta Jun 16, 2026
6 of 7 checks passed
KrasimirKralev added a commit that referenced this pull request Jun 19, 2026
- cli: validate CLAWBOX_ROOT against the SAFE_PATH guard (force-update.sh /
  updater.ts) before `sudo bash install.sh` β€” blocks a compromised env from
  running an attacker-controlled script.
- a11y: aria-label on the pairing-code input; type="button" on the desktop
  pairing-popup buttons.
- copy: Local AI Settings no longer says 'choose a different local engine'
  (Gemma 4 is the only engine since #206).
- docs: telegram-pairing spec now documents the desktop popup + its 20s
  ?poll=1 polling (the spec said 'no auto-poll').

Skipped: the chat-model.test fixture mode:"token" note β€” the route gates on
models.providers.*.apiKey, not the profile mode, so the fixture shape is inert.
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