Skip to content

Remove legacy llama.cpp inference code#9

Merged
lwlee2608 merged 4 commits intomainfrom
joel/cleanup-dead-code
Feb 6, 2026
Merged

Remove legacy llama.cpp inference code#9
lwlee2608 merged 4 commits intomainfrom
joel/cleanup-dead-code

Conversation

@joeldrotleff
Copy link
Contributor

@joeldrotleff joeldrotleff commented Feb 5, 2026

Summary

Remove dead code for the llama.cpp Docker Compose service that was replaced by SGLang.

Changes

File Removed
docker-compose.yml.tmpl 42-line inference-engine service block (llama.cpp image)
config.yml.tmpl 15 lines of inference_* config + enable_inference_engine
manager.go 12 DefaultInference* constants, 12 Inference* struct fields, EnableInferenceEngine field, validation block
manager_test.go Updated tests to remove llama.cpp field references
root.go Removed enableInferenceEngine variable
up.go Removed --enable-inference-engine flag and assignment
api_types.go Removed EnableInferenceEngine from UpRequest
handlers.go Removed EnableInferenceEngine assignment

Net: -158 lines of dead code

What's NOT changed

  • SGLang inference engine (silo inference up/down) - still works
  • silo upgrade - unaffected
  • --all flag for silo up/down - still works

Testing

  • make build
  • make test ✅ (config tests pass; pre-existing failures in logger/inference unrelated)

Summary by CodeRabbit

  • Chores

    • Removed the standalone inference engine and its dedicated enable flag from install/runtime paths.
    • Streamlined toggles: proxy agent option preserved; deep-research enabled by default in defaults.
  • New Features

    • Added Deep Research service toggle with image, port, search provider, and API key settings.
    • Introduced an SGLang inference configuration block for deployment and resource tuning.
  • Documentation

    • Updated docs with Deep Research deployment, configuration, and updated usage guidance.

Remove dead code for the llama.cpp Docker Compose service that was
replaced by SGLang. This includes:

- docker-compose.yml.tmpl: Remove inference-engine service block
- config.yml.tmpl: Remove 12 inference_* config fields
- manager.go: Remove DefaultInference* constants, Inference* struct
  fields, EnableInferenceEngine toggle, and validation block
- up.go/root.go: Remove --enable-inference-engine CLI flag
- daemon/api_types.go, handlers.go: Remove EnableInferenceEngine from API
- manager_test.go: Update tests to remove llama.cpp references

The SGLang inference engine (silo inference up/down) remains unchanged.

Agent-thread: https://ampcode.com/threads/T-019c2b39-fff2-70df-b334-fc8a0b56c719
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c2b39-fff2-70df-b334-fc8a0b56c719
@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

Walkthrough

This PR removes the inference-engine configuration, related defaults, validation, CLI flag and API propagation, and the conditional inference service from docker-compose. It adds top-level toggles and config for a proxy agent and a deep-research service (EnableProxyAgent, EnableDeepResearch, DeepResearch*, SearchProvider, PerplexityAPIKey) and introduces a new SGLang inference configuration block in the templates. Tests, docs, and config manager were updated to reflect the removed inference fields and the new service-oriented configuration surface.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant CLI as CLI
    participant Daemon as Daemon
    participant Docker as Docker Compose
    participant Proxy as Silo Proxy Agent
    participant Deep as Deep Research
    participant SGLang as SGLang Inference

    rect rgba(200,255,200,0.5)
    Note over User,CLI: New flow (after changes)
    User->>CLI: run up / install
    CLI->>Daemon: up request (no enable_inference_engine)
    Daemon->>Daemon: generate config (EnableProxyAgent / EnableDeepResearch, sglang block)
    Daemon->>Docker: start services
    Docker->>Proxy: conditionally launch silo-proxy-agent
    Docker->>Deep: launch deep-research service
    Docker->>SGLang: launch sglang inference service (if enabled)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I'm a rabbit in the repo, twitching at the change,
Old inference fields hopped away from the range.
Proxy and deep-research now dance in the glen,
SGLang sprouts softly, ready to pen. 🐇✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Remove legacy llama.cpp inference code' accurately describes the primary objective of this PR, which removes dead/legacy llama.cpp inference service configuration and code across multiple files.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch joel/cleanup-dead-code

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.

…ment

- Remove deprecated inference_* config fields from Config struct
- Remove llama.cpp-related config.yml schema fields
- Add Deep Research Deployment section documenting:
  - GHCR vs Docker Hub registry differences
  - SHA-based vs semver versioning
  - Update flow for propagating changes
  - GHCR authentication requirements
  - Graceful pull handling

Agent-thread: https://ampcode.com/threads/T-019c2ba5-483b-743c-91b9-47a419fab06b
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c2ba5-483b-743c-91b9-47a419fab06b
Copy link
Collaborator

@lwlee2608 lwlee2608 left a comment

Choose a reason for hiding this comment

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

Missing several config fields in the config.tmpl. ie enabled_deep_research
Feshly generated configs won't have these fields visible to users, even though they're configurable. Users wouldn't know these options exist unless they read the code.

Amp-Thread-ID: https://ampcode.com/threads/T-019c315f-d90c-740d-9d11-9a1388ee5306
Co-authored-by: Amp <amp@ampcode.com>

# Conflicts:
#	AGENTS.md
#	internal/assets/config.yml.tmpl
#	internal/config/manager.go
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/config/manager.go (1)

289-302: ⚠️ Potential issue | 🟠 Major

UpdateDeepResearchImage returns an error on the success path.

Line 301 returns true, fmt.Errorf(...) when the update succeeds. Callers checking if err != nil will treat a successful image update as a failure. This should return a nil error (and log or return the old image info separately).

Proposed fix
-	return true, fmt.Errorf("updated from %s", oldImage)
+	return true, nil
#!/bin/bash
# Check how UpdateDeepResearchImage is called to assess impact
rg -n 'UpdateDeepResearchImage' --type=go -C5
🧹 Nitpick comments (1)
internal/config/manager.go (1)

304-327: No validation for DeepResearch fields when EnableDeepResearch is true.

The proxy agent block (lines 319-323) validates ProxyServerURL when enabled, but there is no equivalent validation for deep research fields (DeepResearchImage, DeepResearchPort). Consider adding symmetric validation to catch misconfiguration early.

Proposed addition
 	// Proxy agent validation (only when enabled)
 	if config.EnableProxyAgent {
 		if config.ProxyServerURL == "" {
 			return fmt.Errorf("proxy_server_url cannot be empty when proxy agent is enabled")
 		}
 	}
 
+	// Deep research validation (only when enabled)
+	if config.EnableDeepResearch {
+		if config.DeepResearchImage == "" {
+			return fmt.Errorf("deep_research_image cannot be empty when deep research is enabled")
+		}
+		if config.DeepResearchPort < 1 || config.DeepResearchPort > 65535 {
+			return fmt.Errorf("deep_research_port must be between 1 and 65535")
+		}
+	}
+
 	return nil

Comment on lines +21 to +22
DefaultEnableProxyAgent = false
DefaultEnableDeepResearch = true
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

DefaultEnableDeepResearch = true will be impossible to override to false via config file due to mergeConfigs logic.

The isZeroValue helper (line 246) treats false as the zero value for booleans. When LoadOrDefault merges an existing config with defaults, any enable_deep_research: false set by the user will be detected as "zero" and silently replaced with the default true. This means users cannot disable deep research once it's enabled by default.

The same issue affects SGLang.TrustRemoteCode (default true) and SGLang.DisableRadixCache (default true).

Possible fixes:

  1. Change the merge strategy for bools to always prefer the existing config's value (i.e., never treat a bool as "missing").
  2. Use *bool (pointer) for toggles so that nil represents "not set" vs explicit false.
  3. Track which fields were explicitly present in the YAML before merging.
Option 1: Always prefer existing bool values in merge
 // mergeStructFields recursively merges struct fields
 func mergeStructFields(existing, defaults, result reflect.Value) {
 	for i := 0; i < existing.NumField(); i++ {
 		existingField := existing.Field(i)
 		defaultField := defaults.Field(i)
 		resultField := result.Field(i)
 
 		if !resultField.CanSet() {
 			continue
 		}
 
 		// For nested structs, merge fields recursively
 		if existingField.Kind() == reflect.Struct {
 			mergeStructFields(existingField, defaultField, resultField)
 			continue
 		}
 
+		// Bools have no distinguishable "unset" zero value;
+		// always keep whatever the existing config says.
+		if existingField.Kind() == reflect.Bool {
+			resultField.Set(existingField)
+			continue
+		}
+
 		if isZeroValue(existingField) {
 			resultField.Set(defaultField)
 		} else {
 			resultField.Set(existingField)
 		}
 	}
 }

Note: Option 1 means a brand-new config file (all bools at Go zero = false) would not pick up true defaults, so you'd need to ensure NewDefaultConfig is used for fresh installs rather than going through the merge path. The existing code already does this (line 185), but verify the full flow.

#!/bin/bash
# Verify how LoadOrDefault handles fresh install vs existing config
# Check if there's a code path where mergeConfigs is called for a brand-new config
ast-grep --pattern $'func LoadOrDefault($_, $_) ($_, $_) {
  $$$
}'

@lwlee2608 lwlee2608 merged commit d93eb71 into main Feb 6, 2026
2 checks passed
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.

2 participants