Skip to content
This repository was archived by the owner on Sep 7, 2026. It is now read-only.

UI qa loop - #2

Merged
geekaholic merged 68 commits into
mainfrom
ui-qa-loop
Jun 18, 2026
Merged

geekaholic merged 68 commits into
mainfrom
ui-qa-loop

Conversation

@geekaholic

Copy link
Copy Markdown
Owner

A bunch of improvements to get codex, Claude Code working

geekaholic and others added 30 commits June 2, 2026 07:43
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add `omni launch <tool>` subcommand to the omni CLI, mirroring
  `omlx launch` but connecting to the docker proxy instead of the
  native MLX server; supports claude, codex, copilot, opencode,
  openclaw, hermes, pi, and `list`
- Add OpenAI Responses API adapter (`/v1/responses`) to the proxy so
  Codex CLI (which exclusively uses the Responses API) can connect to
  any OpenAI-compatible backend via the proxy
- Add `wire_api = "responses"` to the codex config.toml provider block
- Fix hermes.py top-level `import yaml` breaking `omni launch list` in
  --no-deps installs; import moved inside the methods that need it
- Enrich `/v1/models` response with `context_window` / `max_context_window`
  from backend `max_model_len` and admin settings so Codex can use the
  correct context window for auto-compaction
- Fix proxy admin `cli_prefix` from `"omlx proxy"` to `"omni"` so the
  dashboard command cards show `omni launch <tool>`
- Fix README install instructions: clarify package name vs CLI name,
  add `rehash` to uv workflow, remove hardcoded Linux paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces llama.cpp as a second managed sidecar backend alongside vLLM,
with a shared HuggingFace cache mount so model downloads are never duplicated
when switching backends.

Backend-portable settings (model, context length, parallelism, ports, HF
cache, network proxy) are renamed from VLLM_* to OMNI_* — a clean break with
no aliases. Backend-specific knobs keep their VLLM_*/LLAMACPP_* prefixes.

New files:
- omlx/proxy/sidecar_compose.py: shared CommonSidecarSettings base,
  SidecarBackendSpec registry, render_proxy_service(), and all shared helpers
- omlx/proxy/llamacpp_compose.py: LlamacppComposeSettings, renderer, and
  BACKEND_SPECS registration; supports -hf owner/repo[:tag] and local *.gguf
- docker/docker-compose.llamacpp.template.yml: generated template
- tests/test_llamacpp_compose.py, tests/test_sidecar_compose.py: new test suites

Updated:
- vllm_compose.py now subclasses CommonSidecarSettings
- omni_cli.py: --context-length/--max-parallel portable flags, llamacpp-specific
  flags, mode tracking (managed vs proxy), generalized serve/control paths
- admin.py: sidecar-agnostic endpoints (GET/POST sidecar-compose), keyed off
  OMLX_SIDECAR_BACKEND
- Frontend: dashboard.js + _settings.html use proxy.sidecar.* with
  backend-conditional x-show sections for vLLM vs llama.cpp settings

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… via Docker API

- Drop `ollama` as a distinct backend type; alias it to `openai-compatible`
  everywhere (admin API, omni_cli, serve-state migration). Ollama native-metric
  probes in metrics.py are unchanged.
- Backend URL auto-populates per type (BACKEND_URL_DEFAULTS in config.py);
  sidecar URLs (vllm / llama.cpp) are readonly in the UI and enforced server-side.
- Per-backend profile persistence: URL, API key, model, and served-model-name
  stash/restore in `backend_profiles` (proxy-state.json) when the type changes;
  shared settings (context length, max parallel, sampling) remain unprofiled.
- Sidecar-only settings (image, extra args, port) are hidden in openai-compatible
  router mode.
- "Restart Backend" button in Settings restarts the managed sidecar container
  via Docker Engine API over the mounted /var/run/docker.sock (docker_control.py,
  httpx over UDS). Sidecar startup script re-sources the generated env file so a
  plain restart applies saved settings without a host-side compose recreate.
- Button is disabled with an explanatory hint when docker.sock is not mounted
  (server reports docker_socket_available in the GET payload).
- "Restart server" (native oMLX button) is hidden in proxy mode; JS also treats
  HTTP 501 the same as 503 (amber "unsupported" instead of generic error).
- Router-mode Backend URL hint now mentions http://host.docker.internal:11434/v1
  for Docker users reaching a backend on the host.
- Delete translated READMEs (fr/ja/ko/zh); update English README and
  LINUX_PROXY_REMAINING_WORK.md.
- 98 tests added/updated across test_proxy.py, test_docker_control.py,
  test_omni_cli.py, test_sidecar_compose.py.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Brings in the upstream redesigned admin dashboard (Serving Stats,
Average Speed, Active Models, Runtime Cache Observability, API
Endpoints panels), reworked admin routes, and updated MLX dep pins.

Conflict resolution: kept fork's oMNI branding, README set, proxy
modules and omni CLI; combined both new CLI subcommand branches;
kept fork's getAuthHeaders() in chat.html while adopting upstream's
integration-settings fetch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reuse upstream's MLX-free ServerMetrics for session/all-time/per-model
serving stats in proxy mode. Usage and timing are captured on all four
request paths: Anthropic messages (streaming + non-streaming, recording
unscaled backend tokens), the Responses adapter, and the raw
chat/completions passthrough, which now injects
stream_options.include_usage when the client didn't ask (stripping the
trailing usage-only chunk from the relayed stream, with a one-shot
retry without injection if the backend rejects it). TTFT approximates
prefill duration; first-token-to-close the generation duration;
llama.cpp `timings` are honored for non-streaming responses.

/admin/api/stats now returns real snapshots with model/scope filters,
and the clear endpoints split into session vs all-time. All-time stats
persist to OMLX_PROXY_STATS_PATH (default: next to the proxy state
file).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ollama backends list loaded models from /api/ps with real memory size
and TTL countdown; vLLM/llama.cpp backends attribute Prometheus
running/waiting request counts to the served model. Backend metric
collection now goes through a 5s per-backend cache so dashboard polling
doesn't hammer the backend, and the per-model unload button is hidden
in proxy mode.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…xy mode

select_prometheus_metrics now recognizes vLLM prefix-cache counters
(v1 hits/queries plus the legacy v0 hit-rate gauge) and llama.cpp
--metrics families (kv_cache_usage_ratio, kv_cache_tokens, prompt/
predicted tok/s, requests_processing/deferred), and the summary
computes a prefix hit rate percentage. The llama.cpp sidecar now
launches with --metrics.

In proxy mode the Runtime Cache Observability panel becomes "Backend
KV / Prefix Cache", showing whichever metrics the backend exposes and
a clear note for backends (e.g. Ollama) that expose none; the MLX
SSD/hot-cache internals stay native-mode only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The panel iterates MLX engine version entries; behind a remote backend
the proxy's engines dict has no such shape and the Proxy Backend Status
panel already covers backend identity. API Endpoints and Claude Code
panels work in proxy mode as-is (host/port/cli_prefix/claude_code all
served by the proxy).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Record the v0.4.4rc1 dashboard merge, proxy-side serving stats, Active
Models and backend cache observability as completed; document the
deferred external-caching decision (LMCache etc.) and the streaming
usage caveat; fold llama.cpp sidecar and UI-cleanup items into done.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Continuation context for a Claude Code session on the DGX Spark:
branch state, settled design decisions, implementation map, the
real-backend verification checklist, and Linux-specific gotchas.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The upstream dashboard's memory-pressure bar was hidden in proxy mode
because memory_pressure was hardcoded to disabled/zero. Populate it:

- current: per-process GPU memory from nvidia-smi run inside the
  managed sidecar via the Docker exec API (on unified-memory machines
  like DGX Spark, CUDA allocations appear neither in the container
  cgroup nor process RSS, so this is the only real signal); Ollama
  uses the /api/ps model sizes already collected.
- soft limit: vLLM's gpu_memory_utilization share of host memory.
- hard limit: host MemTotal from /proc/meminfo (the unified pool).

The single sidecar model row now shows its real footprint instead of
"remote", and the JS label renders "X / Y" when there is no distinct
soft limit. GPU probe results are cached for 10s on top of the 5s
backend-metrics TTL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Current llama.cpp server images (b9570+) no longer emit
llamacpp:kv_cache_usage_ratio / kv_cache_tokens, which left the
proxy-mode "Backend KV / Prefix Cache" panel showing "not exposed"
despite usable throughput data. Select llamacpp:n_tokens_max as a
context high-water mark, count throughput/peak metrics toward panel
availability, and add a Peak Context Tokens tile (i18n'd).

Verified against the live ghcr.io/ggml-org/llama.cpp:server-cuda
sidecar on DGX Spark.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Prometheus name drift: 2026 vLLM images emit
  vllm:prefix_cache_{hits,queries}_total (no gpu_ prefix) and
  vllm:kv_cache_usage_perc. Extend the candidate tuples, keeping the
  vllm:-prefixed names first so suffix matching never picks up the
  *external_prefix_cache* families (verified live: 63% hit rate on
  repeated prompts now reaches the dashboard panel).
- Stale persisted backend routing: launching a different sidecar stack
  (omni serve --backend vllm after a llama.cpp session) left the proxy
  pointed at the dead llamacpp hostname because the saved
  proxy_backend_url override beat the env. OMLX_SIDECAR_BACKEND is now
  authoritative at startup, mirroring the admin UI's type-switch flow
  (profiles archived for switching back).
- vLLM only reports usage.prompt_tokens_details.cached_tokens with
  --enable-prompt-tokens-details; pass it in the generated compose so
  proxy-side cached-token stats work (template + synced copy).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The reverse of the sidecar-launch reconciliation: switching from a
managed sidecar session to `omni serve --backend openai` left the proxy
routing to the dead compose hostname because the persisted sidecar
backend type/URL overrode the env. Without OMLX_SIDECAR_BACKEND a
persisted sidecar type is always stale — archive its profile, fall back
to openai-compatible, and let the env-provided backend URL win.

Verified live on the Spark: vLLM session -> omni serve --backend openai
(host Ollama) now routes correctly; Active Models shows real size + TTL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
docs/SPARK_RUNBOOK.md covers the verified quick starts (vLLM and
llama.cpp sidecars, external Ollama through host-gateway, external
OpenAI-compatible endpoints), operations, and troubleshooting for every
incident hit during verification (broken container DNS sandbox, stale
generated env files, port conflicts between stacks, GB10 unified-memory
quirks). Worklog marks Task 1 (real-backend testing) and Task 2
(runbook) done with the full verification log.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A configured sampling default of max_tokens >= the backend context made
vLLM reject every chat request (prompt + max_tokens > max_model_len);
the admin UI even pre-filled Max Tokens with the context size, making
the footgun one click away. Defense in depth:

- New backend_context_limit() probe (vLLM /v1/models max_model_len,
  llama.cpp /props n_ctx, cached per backend; sidecar stacks fall back
  to the launch context length).
- apply_proxy_request_defaults skips injecting a max_tokens default
  that reaches the limit, treats 0/empty as "no cap configured", and
  reports injection so the passthrough can retry once without the cap
  on a backend 400 (prompt may consume the remaining room).
- Out-of-box default changed from a hardcoded 32768 to unset — the
  backend's own limit applies unless the operator opts in.
- Settings UI no longer pre-fills Max Tokens with the context size; it
  shows the live backend context window, flags unsafe values inline,
  and offers a one-click "Use recommended (ctx/2)" fix. The chat
  per-model modal shows the model's context window and warns likewise.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
geekaholic and others added 28 commits June 14, 2026 20:25
The Gemma-4 tool-call recovery worked on whole/chunked input but leaked under
real token streaming (vLLM delivers ~1 char per delta): the buffer only held a
tool-call start once the full `call:` keyword was present, so streamed one char
at a time the keyword never formed — `c`,`a`,`l`,`l`,`:` each flushed as text
before the start could be detected, and the call leaked verbatim.

Hold trailing *prefixes* of the `call:` keyword (`c`/`ca`/`cal`/`call`) at a word
boundary so it accretes across deltas, then the existing brace-balanced recovery
fires. Word-boundary check keeps surrounding prose (e.g. "recall") intact.

Tests: recover a tool call fed one character at a time; surrounding text with
"recall" preserved. 461 proxy-suite tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Uses domcontentloaded + settle (the dashboard streams logs/metrics so
networkidle never fires). First live run flagged a real dashboard page
error: Cannot read properties of null (reading 'owner_hash').

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Alpine evaluates :href bindings even when x-show is false, so the bench
'My Submissions' link threw 'Cannot read properties of null (reading
owner_hash)' on the dashboard whenever benchDeviceInfo was null (proxy
mode / before device-info loads). Match the x-show guard and the
benchUploadDone link (line 387) by using benchDeviceInfo?.owner_hash.

Found by the ui_loop Playwright console-error smoke pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Row A (dashboard render): real bug found + fixed (2e80418), re-smoke green.
Row B (stats clear): pass. Row C (heavy-op refusal): pass.
STOP sentinel set so Phase 2 (unattended /loop) is user-initiated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Hidden-capability checks (model_load_unload/benchmarks/cache_controls/
downloaders/quantizer/uploader all false), stats scopes, backend health,
API endpoints, and vLLM Prometheus metric surfacing all verified.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Root-caused a false 'settings don't persist' signal: admin GET nests
display values (sampling.temperature) but POST /admin/api/global-settings
recognises only FLAT keys (sampling_temperature, network_http_proxy,
vllm_dtype — see _COMMON/_VLLM_UPDATE_FIELDS). Harness was POSTing nested
sections, which the handler correctly ignores. Add flat_settings_key()
helper + tests; product is correct, the test contract was wrong.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Network + sampling defaults round-trip via flat keys. memory_guard_tier /
mcp.config_path are hardcoded GET stubs in proxy mode (blocked); sampling
max_context_window deferred (can't unset override in-place).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vllm_enforce_eager/trust_remote_code/dtype/gpu_memory_utilization all
round-trip through the regenerated sidecar compose (snapshot-restored);
gpu-mem-util 0.30 passes the memory guard. /admin/chat renders clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e blocked)

chat nonstream/stream and prefix-cache hit-rate movement all pass against
Qwen3-1.7B. omni-launch-claude blocked with a real finding: the Anthropic
/v1/messages path forwards client max_tokens uncapped, so Claude Code's
32000-output request overflows a small backend context and the existing
context-400 retry (which only drops proxy injection) can't recover.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
per-model stats filter, active-models memory (estimated/util budget;
actual_size null noted), local-model scan (12 repos), and log streaming
all pass. clear-alltime blocked as destructive in an unattended run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
markitdown / disable_log_stats absent from proxy GET payload (POST
ignored); auth sub-keys hardcoded [] with no endpoints; auth api_key
held back for safety. Shared-template controls that don't back in proxy
mode — flagged for a UI-visibility follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
served-name resync (omni_model change re-derives served name), hf_offline
(cached model -> true), and whitelisted switch all verified via compose-gen
with double restore (files + omni_model override); no disruptive restart.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…luster

max_tokens-vs-context guard verified; router backend_type/url/api_key
persist (api_key echoed in GET — noted); cache takes not-exposed path in
router mode; active_models.ollama blocked (no Ollama). Backend switch
guarded + restored to vLLM with chat reconfirmed 200.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
53/53 rows resolved (41 pass, 2 fixed, 10 blocked). Headline finding:
Claude Code max_tokens overflow on small-context backends (needs decision).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-fix)

Per the 2026-06-15 UI QA loop decision: omni launch claude can 400 on
small-context backends because the Anthropic bridge forwards client
max_tokens uncapped. Documented as a known limitation with workaround
(CLAUDE_CODE_MAX_OUTPUT_TOKENS) instead of changing the core request path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… reasoning support

Rewrites the Anthropic streaming proxy to emit native SSE events directly
(message_start, content_block_*, message_delta, message_stop) instead of
delegating to AnthropicAdapter/StreamChunk, enabling richer per-chunk control.

Key additions:
- vLLM `reasoning` field aliased to `reasoning_content` in both streaming and
  non-streaming paths (passthrough + /v1/messages)
- Bracket tool call recovery (`[Calling tool: Name({...})]`) for non-streaming
  and streaming, including split reasoning/content cases
- Gemma4 `<|tool_call>` protocol marker parsing and channel-marker stripping
- Backend `delta.tool_calls` coalescing into structured ToolCall objects
- Auto-inject `stream_options.include_usage` with silent retry when backend
  returns 400/422 (for backends that don't support it)
- `force_native_tool_calling` param in `convert_anthropic_to_internal` to
  preserve Anthropic tool_use/tool_result history as structured OpenAI calls
  even without a tokenizer, plus history normalisation to OpenAI wire format
- Chat UI fixes: capture usage before the `!delta` guard so final-choice usage
  chunks are recorded; support both `reasoning_content` and `reasoning` in the
  thinking stream; initialize `_lastUsage` on stream reset

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@geekaholic
geekaholic merged commit e2d08b1 into main Jun 18, 2026
4 checks passed
@geekaholic
geekaholic deleted the ui-qa-loop branch June 18, 2026 00:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant