Skip to content

πŸ—οΈ Architect: extract a Backend adapter so ServerManager stops branching on backend type - #77

Draft
cleanunicorn wants to merge 1 commit into
mainfrom
claude/amazing-volta-1oamim
Draft

πŸ—οΈ Architect: extract a Backend adapter so ServerManager stops branching on backend type#77
cleanunicorn wants to merge 1 commit into
mainfrom
claude/amazing-volta-1oamim

Conversation

@cleanunicorn

Copy link
Copy Markdown
Owner

Summary

This is a proposal only β€” zero functional code changes. Full write-up:
docs/proposals/2026-08-24-backend-adapter.md

Proposed change: move the llama-server-vs-ASR command-building and prompt-cache-eligibility
logic out of ServerManager (863 lines, the largest module in the codebase) and into two small
Backend adapter classes (LlamaBackend, AsrBackend) behind a shared interface in
src/drove/backend.py, which today only detects the backend name but doesn't own what that name
means.

Why now

The last two feature PRs (prompt-cache-across-sleep, llama-server cache flags) both added more
llama-only special-casing directly into ServerManager (if backend == BACKEND_ASR: ... else: ... at 3 separate points). Tests already reach into ServerManager's private methods
(manager._build_asr_command(...)) to test backend-specific behavior β€” a symptom of there being no
seam to test that logic without going through the manager.

What this is not

  • Not a rewrite β€” a pure move-and-wire-up refactor, no behavior change
  • Not adding a third backend now (no such backend exists yet)
  • No /v1/* API, CLI, or config-file format changes
  • No ModelConfig schema changes

Before / after

See diagrams in the proposal doc.

Risk: low

No contract changes, no new dependencies, fully revertible in one commit, existing test suite
covers both backends' command-building today and can be adapted rather than rewritten.

Approval needed

Repo owner sign-off (single-maintainer repo, no infra/security surface touched).


πŸ—οΈ This PR is intentionally a discussion draft β€” the doc is the deliverable, not code. If the
proposal isn't approved, I'll record why in the (to-be-created) architect journal for next time.

Generated by the automated Architect review routine.


Generated by Claude Code

Structural-debt review: ServerManager branches on backend type (llama
vs ASR) inline for command building and prompt-cache eligibility,
while backend.py only handles detection. Recent llama-only feature
work (prompt cache persistence, cache flags) grew this special-casing
further. Proposal-only doc, zero functional code changes.
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