Skip to content

Commit 363a41d

Browse files
committed
[act.research.ρ.D8+] supervise the authorized local Qwen endpoint
The governed loop had a real JSON-schema provider path but no durable host boundary for the explicitly authorized RTX 5080 deployment. Add a loopback-only user service with bounded memory, private writable caches and telemetry disabled; make the backend consume an optional operator-owned environment file so provider URLs and the shared-GPU grant remain outside Git. Document that this grant does not promote model output to evidence or silently authorize physical FEP, and regenerate the architecture twin after the runtime topology changed. Reality checks: the cold service reached /health with zero restarts, vLLM reported Qwen3.5-2B and held 10,534 MiB on the RTX 5080, a real ai.research.propose Job persisted a schema- and semantics-accepted proposal Artifact in one validation attempt, and all 21 repository gates passed.
1 parent fe8f72c commit 363a41d

6 files changed

Lines changed: 142 additions & 133 deletions

File tree

‎backend/README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ profiles remain fail-closed unless the host operator sets the exact
114114
proposals still pass the frozen schema, current-action and scientific-evidence validators.
115115
The production loop requires forward migrations 049 and 050.
116116

117+
The canonical workstation's optional local endpoint is supervised by
118+
`deploy/systemd/dirac-qwen.service` on loopback port 8930. Provider profiles and the
119+
host-scoped grant live in gitignored `deploy/ai/providers.local.json` and
120+
`deploy/ai/dirac-ai.env`; no provider URL or credential comes from a request payload.
121+
117122
```bash
118123
bash scripts/gates.sh research
119124

‎deploy/README.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The canonical local deployment has one current topology:
88
| `dirac-fields.service` | 8901 | unified application, Command, Method, Job and artifact service |
99
| `dirac-ops.service` | 1355 | read-only operations projection |
1010
| `dirac-digital-twin.service` | — | source watcher and architecture-twin regeneration |
11+
| `dirac-qwen.service` | 8930 (loopback) | optional local Qwen3.5 Research Loop inference |
1112

1213
The standalone `dirac-physics.service` on 8902 is superseded and retained only under
1314
`deploy/systemd/_archive/`. Physics implementations are reached through the unified 8901
@@ -43,6 +44,22 @@ systemctl --user daemon-reload
4344
systemctl --user enable --now dirac-web dirac-fields dirac-ops dirac-digital-twin
4445
```
4546

47+
Local Qwen is intentionally a separate opt-in unit. Copy the provider example to the
48+
gitignored `deploy/ai/providers.local.json`, mark the workstation profile
49+
`shared_dirac_gpu`, and place its paths plus the exact
50+
`DIRAC_ALLOW_SHARED_GPU_AI=1` grant in gitignored `deploy/ai/dirac-ai.env`. Then:
51+
52+
```bash
53+
systemctl --user link "$PWD/deploy/systemd/dirac-qwen.service"
54+
systemctl --user enable --now dirac-qwen
55+
systemctl --user restart dirac-fields
56+
curl --fail http://127.0.0.1:8930/health
57+
```
58+
59+
The grant authorizes this host configuration; it does not turn model output into
60+
evidence or make physical FEP schedulable. Keep physical GPU execution disabled until a
61+
single lease owner coordinates model residency and FEP admission.
62+
4663
Verify state, socket ownership and HTTP responses rather than treating installation as
4764
proof:
4865

‎deploy/systemd/dirac-fields.service‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ Environment=PYSCF_TMPDIR=/home/ivan/.cache/dirac/scratch
2424
# CPU methods remain local inside the bounded controller pool.
2525
Environment=DIRAC_EXECUTOR=kubernetes
2626
Environment=DIRAC_KUBERNETES_EXCHANGE_HOST=/home/ivan/dirac/.runtime/pv/exchange
27+
# Optional operator-owned provider URLs, credentials and explicit shared-GPU grant.
28+
# The ignored file is absent on hosts that intentionally run without AI inference.
29+
EnvironmentFile=-/home/ivan/dirac/deploy/ai/dirac-ai.env
2730
ExecStart=/home/ivan/dirac/backend/env/bin/python backend/field_server.py
2831
Restart=on-failure
2932
RestartSec=5

‎deploy/systemd/dirac-qwen.service‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# dirac-qwen.service — loopback-only Qwen3.5 inference for the Research Loop.
2+
# The shared RTX 5080 profile remains unusable unless dirac-fields also receives
3+
# DIRAC_ALLOW_SHARED_GPU_AI=1 through its operator-owned environment file.
4+
5+
[Unit]
6+
Description=Dirac local Qwen3.5 inference (:8930)
7+
After=network.target
8+
StartLimitIntervalSec=300
9+
StartLimitBurst=5
10+
ConditionPathExists=/home/ivan/.local/share/dirac-qwen-vllm/bin/vllm
11+
ConditionPathExists=/mnt/e/data.ai-models.local-model-store.storage.xl.private.readonly/Qwen3.5-2B/config.json
12+
13+
[Service]
14+
Type=simple
15+
WorkingDirectory=/home/ivan/dirac
16+
Environment=CUDA_VISIBLE_DEVICES=0
17+
Environment=VLLM_NO_USAGE_STATS=1
18+
# FlashInfer's sampler JIT searches /usr/local/cuda on this CUDA-13 wheel; the
19+
# transformer kernels remain CUDA FlashAttention/Triton when only this sampler is off.
20+
Environment=VLLM_USE_FLASHINFER_SAMPLER=0
21+
Environment=XDG_CACHE_HOME=%C/dirac-qwen
22+
Environment=TORCH_HOME=%C/dirac-qwen/torch
23+
Environment=VLLM_CACHE_ROOT=%C/dirac-qwen/vllm
24+
Environment=TRITON_CACHE_DIR=%C/dirac-qwen/triton
25+
Environment=FLASHINFER_WORKSPACE_BASE=%C/dirac-qwen
26+
CacheDirectory=dirac-qwen
27+
ExecStart=/home/ivan/.local/share/dirac-qwen-vllm/bin/vllm serve /mnt/e/data.ai-models.local-model-store.storage.xl.private.readonly/Qwen3.5-2B --host 127.0.0.1 --port 8930 --served-model-name Qwen3.5-2B --max-model-len 16384 --gpu-memory-utilization 0.65 --language-model-only
28+
Restart=on-failure
29+
RestartSec=5
30+
TimeoutStopSec=45
31+
NoNewPrivileges=true
32+
PrivateTmp=true
33+
ProtectSystem=strict
34+
ProtectHome=read-only
35+
ReadWritePaths=%C/dirac-qwen
36+
MemoryHigh=24G
37+
MemoryMax=32G
38+
39+
[Install]
40+
WantedBy=default.target

‎docs/architecture/dirac-digital-twin.html‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)