Skip to content

feat: route compaction server through backend lifecycle#116

Merged
danielcherubini merged 9 commits into
mainfrom
feature/compaction-backend-lifecycle
Jun 9, 2026
Merged

feat: route compaction server through backend lifecycle#116
danielcherubini merged 9 commits into
mainfrom
feature/compaction-backend-lifecycle

Conversation

@danielcherubini

Copy link
Copy Markdown
Owner

Summary

Route the compaction server through the existing backend lifecycle (Kokoro TTS pattern) instead of custom subprocess management. This unifies compaction with the shared ModelState lifecycle (Starting → Ready/Failed) for spawn, health poll, reaping, and auto-restart.

Changes

  • BackendType::Compaction — New enum variant with is_non_inference_backend() helper
  • CompactionConfig cleanup — Renamed timeout_msrequest_timeout_ms for clarity
  • load_compaction_backend() — New lifecycle method using model registry (Starting → Ready/Failed)
  • Compaction handler rewrite — Uses ensure_compaction_backend() via model registry instead of custom CompactionServerState
  • Shared helpers — Extracted get_backend_url() to handlers/helpers.rs (shared with TTS)
  • Delete custom lifecycle — Removed CompactionServerState enum, compaction_server field, and 3 custom lifecycle methods (~362 lines deleted)
  • Skip compaction in idle/LRUcheck_idle_timeouts() and evict_lru_if_needed() exclude compaction backend
  • Bug fixevict_lru_if_needed() now checks runtime models map (not just DB configs) to exclude non-inference backends

Commits

  • e332549 feat: add BackendType::Compaction and is_non_inference_backend helper
  • f3d2d89 refactor: rename timeout_ms to request_timeout_ms in CompactionConfig
  • 234466f feat: add load_compaction_backend using model registry lifecycle
  • e7fcb4e refactor: rewrite compaction handler to use model registry
  • 3c821f9 refactor: remove custom compaction lifecycle, use model registry
  • 5bf1c9f fix: verify web API round-trip for compaction config
  • 48d086f fix: exclude compaction from LRU eviction via runtime models map
  • 11aa9c9 refactor: remove redundant health_ok guard in load_compaction_backend

Test plan

  • cargo check --workspace — clean
  • cargo clippy --workspace -- -D warnings — clean
  • cargo test --workspace — 851 tests pass
  • Manual test: enable compaction in config, verify it starts via model registry
  • Manual test: verify compaction is not evicted by LRU
  • Manual test: verify compaction survives proxy restart

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@danielcherubini, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 23 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6bf35314-2044-4a41-8d03-ebfa81bf2937

📥 Commits

Reviewing files that changed from the base of the PR and between e17cd25 and 5f3e883.

📒 Files selected for processing (18)
  • crates/tama-cli/src/commands/backend/install.rs
  • crates/tama-cli/src/commands/backend/update.rs
  • crates/tama-core/src/backends/installer/urls.rs
  • crates/tama-core/src/backends/types.rs
  • crates/tama-core/src/backends/updater.rs
  • crates/tama-core/src/config/types.rs
  • crates/tama-core/src/proxy/handlers/compaction.rs
  • crates/tama-core/src/proxy/handlers/helpers.rs
  • crates/tama-core/src/proxy/handlers/mod.rs
  • crates/tama-core/src/proxy/handlers/tts.rs
  • crates/tama-core/src/proxy/lifecycle/mod.rs
  • crates/tama-core/src/proxy/state.rs
  • crates/tama-core/src/proxy/types.rs
  • crates/tama-core/src/updates/checker.rs
  • crates/tama-web/src/api/backends/types.rs
  • crates/tama-web/src/pages/config_editor.rs
  • crates/tama-web/src/types/config.rs
  • docs/plans/README.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/compaction-backend-lifecycle

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.

@danielcherubini danielcherubini merged commit 427217a into main Jun 9, 2026
2 checks passed
@danielcherubini danielcherubini deleted the feature/compaction-backend-lifecycle branch June 9, 2026 13:28
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