Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
docs(vllm): record what it takes to actually run the Qwen3.8 stack (#4716)
[._.]/ Adam Eivya047c46f1ab2
diff --git a/docs/README.md b/docs/README.mdindex 4d9d7198b2..cb51464f23 100644--- a/docs/README.md+++ b/docs/README.md@@ -34,7 +34,7 @@ Start with the [product surface map](./features/product-surfaces.md) for a complApp management: [app-wizard](./features/app-wizard.md) · [autofixer](./features/autofixer.md) · [browser](./features/browser.md) · [error-handling](./features/error-handling.md) · [jira-sprint-manager](./features/jira-sprint-manager.md)-Chief of Staff: [chief-of-staff](./features/chief-of-staff.md) · [cos-agent-runner](./features/cos-agent-runner.md) · [cos-enhancement](./features/cos-enhancement.md) · [agent-context](./features/agent-context.md) · [agent-skills](./features/agent-skills.md) · [memory-system](./features/memory-system.md) · [claude-ollama](./features/claude-ollama.md) · [mtplx](./features/mtplx.md) · [dflash2](./features/dflash2.md) ([DSpark vs DFlash 2](./research/2026-08-19-dspark-vs-dflash2.md)) · [qwen38-rtx3090](./features/qwen38-rtx3090.md) · [prompt-manager](./features/prompt-manager.md)+Chief of Staff: [chief-of-staff](./features/chief-of-staff.md) · [cos-agent-runner](./features/cos-agent-runner.md) · [cos-enhancement](./features/cos-enhancement.md) · [agent-context](./features/agent-context.md) · [agent-skills](./features/agent-skills.md) · [memory-system](./features/memory-system.md) · [claude-ollama](./features/claude-ollama.md) · [mtplx](./features/mtplx.md) · [dflash2](./features/dflash2.md) ([DSpark vs DFlash 2](./research/2026-08-19-dspark-vs-dflash2.md)) · [qwen38-rtx3090](./features/qwen38-rtx3090.md) ([3090 bring-up](./research/2026-08-21-qwen38-rtx3090-vllm.md)) · [prompt-manager](./features/prompt-manager.md)Identity & self: [digital-twin](./features/digital-twin.md) · [identity-system](./features/identity-system.md) · [soul-system](./features/soul-system.md) · [privacy-center](./features/privacy-center.md) · [post](./features/post.md) (insights design spike: [plans/2026-06-03](./plans/2026-06-03-cross-domain-insights-engine.md))diff --git a/docs/features/qwen38-rtx3090.md b/docs/features/qwen38-rtx3090.mdindex 9c517ee2b3..fcaddf4d16 100644--- a/docs/features/qwen38-rtx3090.md+++ b/docs/features/qwen38-rtx3090.md@@ -68,6 +68,10 @@ git clone https://github.com/syv-ai/qwen38-27b-rtx3090 ~/qwen-servingcd ~/qwen-servingecho "VLLM_API_KEY=$(openssl rand -hex 24)" > .envprintf 'SPEC=dflash2\nPREFIX_CACHE=1\n' >> .env+echo 'EXTRA_ARGS=--enable-auto-tool-choice --tool-call-parser qwen3_xml' >> .env # required for any agent use+if grep -qi microsoft /proc/version; then # WSL2 only, both required+ printf 'VLLM_WSL2_ENABLE_PIN_MEMORY=1\nPYTORCH_CUDA_ALLOC_CONF=expandable_segments:False\n' >> .env+fidocker compose build # ~9.5 GB image, built here — there is no registry to pull fromdocker compose run --rm prepare # ~20 GB download + CPU requantization, idempotent, resumabledocker compose --profile single up -d@@ -78,12 +82,80 @@ a `depends_on` of the server. Running them separately is worth it anyway: it isthe long, unattended part, and PortOS's Start button deliberately refuses until`prepare` has actually landed weights on disk (see below).+**Tool calling must be switched on, or the coding agent is useless.** Upstream's+`single-user/start_qwen.sh` serves without it, and vLLM then rejects every+request that offers tools with `"auto" tool choice requires+--enable-auto-tool-choice and --tool-call-parser to be set`. OpenCode sends tools+on its very first turn, so the session dies immediately — the model never gets to+read or write a file.++**Use `qwen3_xml`, not `hermes`.** The chat template's `<tool_call>` markers make+`hermes` look right, and the server starts happily with it — but Qwen3.8 emits+its calls in XML (`<function=name><parameter=path>…`), not the Hermes JSON body+that parser expects. The mismatch fails silently: vLLM cannot parse the call, so+it returns the raw markup as ordinary assistant text with `tool_calls: null`, and+the agent simply never uses a tool. There is no error anywhere to explain it.++```bash+echo 'EXTRA_ARGS=--enable-auto-tool-choice --tool-call-parser qwen3_xml' >> .env+```++`EXTRA_ARGS` is appended to the `vllm serve` command line by the start script.+With the right parser the same request comes back as `finish_reason:+"tool_calls"` and a structured `tool_calls` array. This is the one setting+without which the whole point of the preset — a CoS agent editing files — does+not work.++**On WSL2, `VLLM_WSL2_ENABLE_PIN_MEMORY=1` is mandatory, not a tuning knob.**+vLLM turns pinned host memory off whenever it detects WSL, and its GPU model+runner allocates UVA buffers that require it — so without this the engine never+initializes. The container dies with `RuntimeError: UVA is not available` and,+because compose restarts it `unless-stopped`, quietly crash-loops instead of+failing once. A current WSL2 kernel does support pinned memory; vLLM just leaves+it opt-in. Put it in `.env` next to the other knobs:++```bash+echo 'VLLM_WSL2_ENABLE_PIN_MEMORY=1' >> .env+```++Upstream's WSL2 notes predate this code path and do not mention it. On native+Linux it is unnecessary.++**On WSL2, `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False` is also+mandatory.** Expandable segments rely on CUDA's virtual-memory-management APIs,+which WSL2 supports only partially. With them on, weight loading dies seconds in,+inside `gptq_marlin_repack`, with a generic+`torch_call_dispatcher("aten::empty", …) API call failed` — which reads like an+out-of-memory error and is not one. It reproduces on a completely idle 24 GB card+at `GPU_UTIL=0.70`, with both the base and `-fast` checkpoints, while the repack+op itself works correctly when called directly. Upstream lists this as an+escape hatch for memory trouble; on WSL2 it is a precondition for starting at+all.++**On WSL2, raise the VM's memory ceiling before running `prepare`.** The+requantization step is CPU-side and memory-hungry — `quant_lm_head.py` holds a+whole 2.5 GB shard plus several float32 copies of a 248k-row `lm_head` — and+WSL2 defaults to a ceiling of half the host's RAM. On a 32 GB machine that 16 GB+ceiling is not enough: the step is SIGKILLed and the only symptom is a bare+`Killed` with exit 137, which says nothing about WSL. Give the VM ~24 GB and some+swap in `%UserProfile%\.wslconfig`, then `wsl --shutdown` for it to take effect:++```ini+[wsl2]+memory=24GB+swap=16GB+```++Stop any containers cleanly first — `wsl --shutdown` takes the whole VM down,+including a PostgreSQL container a PortOS install is using. The download half of+`prepare` is unaffected and resumes where it left off, so a run killed here costs+minutes, not the 20 GB again.+**The card must be otherwise empty.** vLLM's startup gate compares free VRAMagainst `GPU_UTIL`, so another model server holding a few GB — LM Studio, Ollama,a local image/video job — makes the container exit rather than start small. Stop-those first. If startup still dies on memory, upstream's escape hatches are-`GPU_UTIL=0.93` (the documented WSL2 fallback) and-`PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False` in `.env`. Capping board+those first. If startup still dies on memory, upstream's escape hatch is+`GPU_UTIL=0.93` (the documented WSL2 fallback) in `.env`. Capping boardpower with `nvidia-smi -pl 250` is worth doing on a 3090.Confirm it serves before touching PortOS:diff --git a/docs/research/2026-08-21-qwen38-rtx3090-vllm.md b/docs/research/2026-08-21-qwen38-rtx3090-vllm.mdnew file mode 100644index 0000000000..b7261891f0--- /dev/null+++ b/docs/research/2026-08-21-qwen38-rtx3090-vllm.md@@ -0,0 +1,105 @@+# Qwen3.8-27B on an RTX 3090 under WSL2 — bring-up record++Date: 2026-08-21++First end-to-end bring-up of the [syv-ai/qwen38-27b-rtx3090](https://github.com/syv-ai/qwen38-27b-rtx3090)+stack on a Windows RTX 3090 host, driving it from PortOS's seeded OpenCode vLLM+provider. The setup steps this produced are in+[features/qwen38-rtx3090.md](../features/qwen38-rtx3090.md); this file records+what was measured and what had to be discovered along the way.++## Verdict++**It works, and the throughput story holds up — but four settings stand between+a documented clone and a working coding agent, and none of them announce+themselves.** Three are WSL2-specific; one applies everywhere and is the+difference between an agent that edits files and one that cannot.++## Host++Windows 11, RTX 3090 (24 GB), driver 596.36 / CUDA 13, 32 GB system RAM. WSL2+Ubuntu on kernel 6.6.87.2, Docker Desktop 29.7.2 with the `nvidia` runtime,+Compose v5.3.1. Image built locally (9.79 GB — there is no registry to pull+from); weights ~19.5 GB into the project's `models/` bind mount.++## Measured++Streaming `/v1/chat/completions`, greedy, `enable_thinking: false`, against a+17,113-token prompt sent twice so the second turn shares the prefix:++| turn | prompt | TTFT | decode |+|---|---|---|---|+| 1 (cold) | 17,113 tok | 16,358 ms | 59.3 tok/s |+| 2 (warm) | 17,113 tok | **681 ms** | 105.3 tok/s |++**24× TTFT collapse on the shared prefix.** Upstream reported 22.4 s → 0.56 s on+a 25k-token document; this is the same effect at a smaller prompt. Decode lands+near upstream's ~133 tok/s ordinary-chat figure — the gap is consistent with+WSL2 overhead and a 350 W board rather than upstream's 250 W cap.++The prefix-cache behavior is the part that matters for a CoS agent: a multi-turn+session re-sends a growing transcript, and only the new tail is prefilled.++## The four settings++Each was found by hitting it. All go in the compose project's `.env`.++**1. `EXTRA_ARGS=--enable-auto-tool-choice --tool-call-parser qwen3_xml`** — every+platform. Upstream's `single-user/start_qwen.sh` serves without tool calling, so+vLLM rejects OpenCode's first turn outright: `"auto" tool choice requires+--enable-auto-tool-choice and --tool-call-parser to be set`. The parser choice is+a second, quieter trap: the chat template's `<tool_call>` markers suggest+`hermes`, but Qwen3.8 emits XML (`<function=name><parameter=path>…`). With+`hermes` the server starts, answers, and returns the raw markup as assistant text+with `tool_calls: null` — no error, the agent just never uses a tool. With+`qwen3_xml` the same request returns `finish_reason: "tool_calls"` and a+structured call.++**2. `VLLM_WSL2_ENABLE_PIN_MEMORY=1`** — WSL2. vLLM disables pinned host memory+on sight of WSL; its GPU runner allocates UVA buffers that require it. Without+this the engine never initializes (`RuntimeError: UVA is not available`) and+compose's `unless-stopped` policy turns that into a silent crash-loop — 20+restarts before it was noticed.++**3. `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:False`** — WSL2. Expandable+segments use CUDA VMM APIs that WSL2 supports only partially. Weight loading dies+seconds in, inside `gptq_marlin_repack`, as+`torch_call_dispatcher("aten::empty", …) API call failed`. That reads as an OOM+and is not one: it reproduces on an idle card at `GPU_UTIL=0.70`, on both the+base and `-fast` checkpoints, while `gptq_marlin_repack` called directly with+correct shapes succeeds. Upstream lists this as a memory escape hatch; on WSL2 it+is a precondition for starting.++**4. WSL2 memory ceiling ≥ ~24 GB** — WSL2, and only for `prepare`. The CPU-side+requantization holds a 2.5 GB shard plus several float32 copies of a 248k-row+`lm_head`. Under WSL2's default half-of-host ceiling it is SIGKILLed, reported+only as `Killed` / exit 137. The download half is unaffected and resumes.++## Notes for a Windows install++- PortOS runs native Win32 while the project lives in the distro, so+ `VLLM_QWEN_PROJECT_DIR` must be the `\\wsl.localhost\<distro>\home\<user>\qwen-serving`+ UNC path. Node reads it and `docker compose` accepts it as a working directory,+ so the readiness checklist and its Start button both work from there.+- The container is reachable from native Win32 at `127.0.0.1:18020`, which is+ what the provider record points at.+- Weights land as `models/Qwen3.8-27B-W4A16-AutoRound/`, a plain `hf download+ --local-dir` layout — not a `models--org--repo` hub cache. PortOS's readiness+ check originally matched only the hub shape and reported a fully prepared+ machine as having no weights; fixed in `server/lib/vllmQwenProject.js`.+- First start takes ~5–7 minutes (verify, torch.compile, CUDA graphs); later+ starts reuse the `qwen-cache` volume.++## Agent check++`opencode run` through PortOS's own `buildCliChildEnv` over the seeded+`opencode-vllm-tui` record: OpenCode listed `vllm/qwen3.8-27b` from the generated+`OPENCODE_CONFIG_CONTENT`, ran a three-step agent loop, and wrote a file with its+write tool. The API key is enforced — unauthenticated `/v1/models` is 401.++## Related++- [features/qwen38-rtx3090.md](../features/qwen38-rtx3090.md) — the setup guide.+- [2026-08-19-dflash2-speculative-decoding.md](./2026-08-19-dflash2-speculative-decoding.md)+ — the earlier evaluation that concluded PortOS should not vendor an unmerged+ engine patch. That still holds; this stack is upstream's frozen container.