argus-iris 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. argus_iris-0.2.2/.dockerignore +22 -0
  2. {argus_iris-0.2.0 → argus_iris-0.2.2}/.github/workflows/release.yml +2 -0
  3. argus_iris-0.2.2/CHANGELOG.md +48 -0
  4. {argus_iris-0.2.0 → argus_iris-0.2.2}/CLAUDE.md +43 -13
  5. {argus_iris-0.2.0 → argus_iris-0.2.2}/DESIGN.md +93 -88
  6. argus_iris-0.2.2/Dockerfile +25 -0
  7. argus_iris-0.2.2/PKG-INFO +130 -0
  8. argus_iris-0.2.2/README.md +76 -0
  9. argus_iris-0.2.2/SECURITY.md +28 -0
  10. {argus_iris-0.2.0 → argus_iris-0.2.2}/compose.yaml +2 -2
  11. {argus_iris-0.2.0 → argus_iris-0.2.2}/deploy/.env.example +17 -9
  12. {argus_iris-0.2.0 → argus_iris-0.2.2}/deploy/agent.compose.yaml +16 -3
  13. argus_iris-0.2.2/deploy/broker.compose.yaml +45 -0
  14. argus_iris-0.2.2/deploy/iris.example.yaml +78 -0
  15. argus_iris-0.2.2/deploy/policy.example.yaml +38 -0
  16. argus_iris-0.2.2/docs/demo.png +0 -0
  17. argus_iris-0.2.2/docs/operating.md +148 -0
  18. {argus_iris-0.2.0 → argus_iris-0.2.2}/pyproject.toml +7 -3
  19. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/_version.py +2 -2
  20. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/agent/app.py +122 -13
  21. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/agent/docker.py +63 -3
  22. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/agent/nvml.py +13 -6
  23. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/agent/procfs.py +1 -1
  24. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/agent/tracker.py +1 -1
  25. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/actions.py +62 -29
  26. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/adapters/__init__.py +4 -1
  27. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/adapters/base.py +1 -0
  28. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/adapters/comfyui.py +1 -1
  29. argus_iris-0.2.2/src/argus_iris/broker/adapters/external.py +29 -0
  30. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/adapters/http.py +1 -1
  31. argus_iris-0.2.2/src/argus_iris/broker/adapters/ollama.py +74 -0
  32. argus_iris-0.2.2/src/argus_iris/broker/config.py +226 -0
  33. argus_iris-0.2.2/src/argus_iris/broker/directory.py +307 -0
  34. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/leases.py +142 -25
  35. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/policy.py +24 -13
  36. argus_iris-0.2.2/src/argus_iris/broker/registry.py +604 -0
  37. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/residency.py +196 -9
  38. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/state.py +191 -2
  39. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/cli.py +12 -3
  40. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/models.py +47 -0
  41. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/server/app.py +177 -10
  42. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/ui/app.css +141 -26
  43. argus_iris-0.2.2/src/argus_iris/ui/app.js +817 -0
  44. argus_iris-0.2.2/src/argus_iris/ui/brand/apple-icon.png +0 -0
  45. argus_iris-0.2.2/src/argus_iris/ui/brand/argus-iris-lockup-dark.svg +1 -0
  46. argus_iris-0.2.2/src/argus_iris/ui/brand/argus-iris-lockup-light.svg +1 -0
  47. argus_iris-0.2.2/src/argus_iris/ui/brand/favicon.ico +0 -0
  48. argus_iris-0.2.2/src/argus_iris/ui/brand/icon.svg +1 -0
  49. argus_iris-0.2.2/src/argus_iris/ui/index.html +225 -0
  50. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/ui/vendor/dh/dh-theme.js +2 -2
  51. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/ui/vendor/dh/dh-tokens.css +1 -1
  52. argus_iris-0.2.2/tests/conftest.py +11 -0
  53. {argus_iris-0.2.0 → argus_iris-0.2.2}/tests/test_actions.py +51 -21
  54. {argus_iris-0.2.0 → argus_iris-0.2.2}/tests/test_admission.py +245 -88
  55. argus_iris-0.2.2/tests/test_agent.py +322 -0
  56. {argus_iris-0.2.0 → argus_iris-0.2.2}/tests/test_broker.py +80 -47
  57. argus_iris-0.2.2/tests/test_cli.py +77 -0
  58. argus_iris-0.2.2/tests/test_directory.py +410 -0
  59. {argus_iris-0.2.0 → argus_iris-0.2.2}/tests/test_evict.py +62 -40
  60. argus_iris-0.2.2/tests/test_external.py +218 -0
  61. {argus_iris-0.2.0 → argus_iris-0.2.2}/tests/test_leases.py +67 -30
  62. argus_iris-0.2.2/tests/test_nvml.py +40 -0
  63. argus_iris-0.2.2/tests/test_ollama.py +64 -0
  64. argus_iris-0.2.2/tests/test_pin_room.py +230 -0
  65. argus_iris-0.2.2/tests/test_policy.py +453 -0
  66. argus_iris-0.2.2/tests/test_registry.py +446 -0
  67. argus_iris-0.2.2/tests/test_restore.py +153 -0
  68. argus_iris-0.2.2/tests/test_state.py +17 -0
  69. {argus_iris-0.2.0 → argus_iris-0.2.2}/tests/test_tracker.py +1 -1
  70. argus_iris-0.2.2/tests/test_ui.py +178 -0
  71. argus_iris-0.2.0/.dockerignore +0 -16
  72. argus_iris-0.2.0/Dockerfile +0 -23
  73. argus_iris-0.2.0/PKG-INFO +0 -149
  74. argus_iris-0.2.0/README.md +0 -98
  75. argus_iris-0.2.0/deploy/broker.compose.yaml +0 -25
  76. argus_iris-0.2.0/deploy/iris.example.yaml +0 -77
  77. argus_iris-0.2.0/deploy/policy.example.yaml +0 -48
  78. argus_iris-0.2.0/src/argus_iris/broker/adapters/ollama.py +0 -53
  79. argus_iris-0.2.0/src/argus_iris/broker/config.py +0 -129
  80. argus_iris-0.2.0/src/argus_iris/ui/app.js +0 -441
  81. argus_iris-0.2.0/src/argus_iris/ui/index.html +0 -93
  82. argus_iris-0.2.0/tests/test_agent.py +0 -182
  83. argus_iris-0.2.0/tests/test_policy.py +0 -383
  84. argus_iris-0.2.0/tests/test_ui.py +0 -58
  85. {argus_iris-0.2.0 → argus_iris-0.2.2}/.copier-answers.yml +0 -0
  86. {argus_iris-0.2.0 → argus_iris-0.2.2}/.github/workflows/ci.yml +0 -0
  87. {argus_iris-0.2.0 → argus_iris-0.2.2}/.gitignore +0 -0
  88. {argus_iris-0.2.0 → argus_iris-0.2.2}/LICENSE +0 -0
  89. {argus_iris-0.2.0 → argus_iris-0.2.2}/Makefile +0 -0
  90. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/__init__.py +0 -0
  91. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/agent/__init__.py +0 -0
  92. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/broker/__init__.py +0 -0
  93. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/py.typed +0 -0
  94. {argus_iris-0.2.0 → argus_iris-0.2.2}/src/argus_iris/server/__init__.py +0 -0
  95. {argus_iris-0.2.0 → argus_iris-0.2.2}/tests/test_procfs.py +0 -0
  96. {argus_iris-0.2.0 → argus_iris-0.2.2}/tests/test_smoke.py +0 -0
@@ -0,0 +1,22 @@
1
+ # .git is *not* ignored: the builder stage reads the version from it (hatch-vcs) and it never reaches the final image.
2
+ # Don't ignore tracked files either: git would call the tree dirty, and the version would say so.
3
+ .venv
4
+ venv
5
+ dist
6
+ build
7
+ *.egg-info
8
+ **/__pycache__
9
+ **/*.py[cod]
10
+ .pytest_cache
11
+ .ruff_cache
12
+ .mypy_cache
13
+ .coverage
14
+ htmlcov
15
+
16
+ # Local secrets and live configuration. Patterns match from the context root, so subdirectories need the **/.
17
+ **/.env
18
+ **/.env.*
19
+ !**/.env.example
20
+ deploy/iris.yaml
21
+ deploy/policy.yaml
22
+ **/*.bak*
@@ -27,6 +27,7 @@ jobs:
27
27
  - uses: actions/checkout@v4
28
28
  with:
29
29
  fetch-depth: 0
30
+ persist-credentials: false
30
31
  - uses: astral-sh/setup-uv@v6
31
32
  with:
32
33
  enable-cache: true
@@ -134,6 +135,7 @@ jobs:
134
135
  with:
135
136
  ref: ${{ needs.release-tag.outputs.tag }}
136
137
  fetch-depth: 0 # hatch-vcs reads the tag from git history
138
+ persist-credentials: false # .git is in the build context
137
139
  - uses: docker/setup-buildx-action@v3
138
140
  - uses: docker/login-action@v3
139
141
  with:
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ Notable changes to `argus-iris`. Versions come from git tags via `hatch-vcs`.
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.2.2] - 2026-11-25
8
+
9
+ Documentation only: the code is the same as 0.2.1.
10
+
11
+ ### Changed
12
+
13
+ - README links the [guided demo](https://iris.dragonhound.dev), and its links work on PyPI.
14
+
15
+ ## [0.2.1] - 2026-11-25
16
+
17
+ ### Added
18
+
19
+ - **Self-registration** (#47). A service registers its `gpu-tenant.yaml`; its address comes from the node agents' container inventory, never from the caller. Agents can announce their own node.
20
+ - **Service directory** (#49). Containers labelled `argus.peer` are listed with their health: `/directory`, peer lookup, Prometheus service discovery and a dashboard view.
21
+ - **Suite settings and service health** (#51). Tokens can come from the suite file, and `/health` on the broker and agent is argus-cortex's `ServiceHealth`.
22
+ - **Pin restore** (#37). A pinned model that drops out is loaded again when no lease is active on the node and there is room.
23
+ - **Crowded-out reporting and `serves`** (#41). A service that nothing can make room for is flagged, and one lease target can have a service on several nodes.
24
+ - **External services** (#30). Read for up/down, and optionally stopped to free VRAM and started again.
25
+ - **Memory accounting.** A tenant's own GPU memory counts toward its own leases (#38), the broker fills in peaks clients can't report (#44), and room is judged by the larger of `warm_mb` and the observed peak (#45).
26
+ - `SECURITY.md` and `docs/operating.md`; a rewritten README (#56).
27
+
28
+ ### Changed
29
+
30
+ - **Ports bind to localhost by default** (#56). Set `HOST_IP` (compose), `IRIS_HOST` or `IRIS_AGENT_HOST` to the host's LAN address. A multi-host install that relied on `0.0.0.0` must set it.
31
+ - **The image is multi-stage** (#56): no git history and no build context in it. `.dockerignore` now excludes env files and live config at any depth.
32
+ - Ollama placement skips hosts that lack the model and spreads concurrent leases (#26).
33
+ - Needs argus-cortex 0.16.1 (`>=0.16.1,<0.17`).
34
+
35
+ ### Fixed
36
+
37
+ - Ollama keep-alive calls send the context the model was loaded with (#31), and model names compare case-insensitively (#28).
38
+ - A model loaded during an unload is no longer written off as the service's floor (#33).
39
+ - The directory probes the broker's own container on loopback (#54).
40
+ - Audit findings in the agent, broker and dashboard (#46, #55).
41
+
42
+ ## [0.2.0] - 2026-11-24 [YANKED]
43
+
44
+ Tagged on the wrong commit: the same code as 0.1.0. Use 0.2.1.
45
+
46
+ ## [0.1.0] - 2026-11-20
47
+
48
+ First release: node agents, leases and admission, eviction confirmed by NVML, residency policy, stall watchdog and dashboard.
@@ -8,7 +8,7 @@ Guidance for AI agents working in this repo. Human-facing usage lives in [README
8
8
 
9
9
  VRAM-aware GPU lease broker for the Argus suite: priorities, schedules, keepalive and idle-kill across GPU nodes
10
10
 
11
- It decides whether a GPU job may start now, on which node (morpheus, dragon, jarrah), and what must be unloaded first. It does not run the work. **[DESIGN.md](DESIGN.md) is the plan the first releases build to; read it before changing anything.** The client (`BrokerCoordinator`) and the lease and tenant-manifest wire models live in argus-cortex's `gpu` module, so callers and broker share one definition.
11
+ It decides whether a GPU job may start now, on which node, and what must be unloaded first. It does not run the work. **[DESIGN.md](DESIGN.md) is the plan the first releases build to; read it before changing anything.** The client (`BrokerCoordinator`) and the lease and tenant-manifest wire models live in argus-cortex's `gpu` module, so callers and broker share one definition.
12
12
 
13
13
  ## Argus suite
14
14
  <!-- argus-suite: keep this block; argus-ci checks for it -->
@@ -27,38 +27,67 @@ everything and records `fits`; `enforce` queues, spills and evicts). Step 4's re
27
27
 
28
28
  - `models.py` — agent snapshot (`NodeSnapshot`, `GpuProcess`, …) and the broker's read models (`NodeState`,
29
29
  `Resident`, `NodeLedger`). Lease and tenant-manifest models are **not** here: import them from
30
- `argus_cortex.gpu_wire`.
30
+ `argus_cortex.gpu_wire`. Nor are the directory's (`PeerLookup`, `DirectoryEntry`, `EntryHealth`): they are
31
+ `argus_cortex.service`'s (#50).
31
32
  - `agent/` — `iris-agent` (`[agent]` extra, `argus-iris agent`, :9110). `nvml.py` samples, `tracker.py` keeps idle
32
33
  time (VRAM unchanged **and** no utilisation), `procfs.py` maps PIDs to containers through cgroups and reads anon
33
34
  memory, `docker.py` is a minimal Engine API client over the Unix socket, `app.py` serves `/snapshot`, `/metrics`,
34
- `/health` and token- and allowlist-gated `POST /containers/{name}/{start|stop|restart}`.
35
- - `broker/` — `config.py` (YAML, `IRIS_CONFIG`), `adapters/` (comfyui, ollama, argus-http; read-only),
35
+ `/health` and token- and allowlist-gated `POST /containers/{name}/{start|stop|restart}`. The snapshot's `inventory`
36
+ lists every container (ports, compose labels, `managed`). `IRIS_AGENT_MANAGE_LABEL` opts the agent in to also allowing
37
+ containers labelled `argus.iris.manage=true`; `IRIS_BROKER_URL` makes it announce its node.
38
+ - `broker/` — `config.py` (YAML, `IRIS_CONFIG`), `adapters/` (comfyui, ollama, argus-http, external; read-only; external is up/down from `health_path` only, freed by a container stop only with `evict_by: stop`, which admission uses only under an enforced policy rule and `Broker.stopped` re-warms),
36
39
  argus-http validates `/health` as cortex's `ResidentHealth` and reads older shapes best-effort, logging
37
40
  `resident_off_contract` (and `detail.off_contract` on the resident); a truthy non-bool `busy` counts as busy,
38
41
  `state.py` (`Broker` polls agents and adapters, ticks the lease book every second; `compose_node` is the pure
39
- accounting), `leases.py` (`LeaseBook`: tenants, `candidates()` (placement order), admission (`_serve_queue`: class order
42
+ accounting; `room_for_services` (#40) flags a service `crowded_out` when what `Broker._held_on` says admission can never
43
+ free (pins, dropped pins, untenanted processes, unstoppable externals, unloaded/cpu/error residues) leaves less than its
44
+ `warm_mb` or peak), `leases.py` (`LeaseBook`: tenants, `candidates()` (a service answers its id, adapter and `serves` names; placement order: up, fewest granted leases on the service, model resident, config order; an Ollama whose `/api/tags` lacks the model is skipped unless none has it), admission (`_serve_queue`: class order
40
45
  with aging, head reservation, spill, `_plan` eviction plans run by the broker's `_evict_for`), request_id idempotency, `resume`,
41
- heartbeat/TTL expiry (a beat also carries `progress`/`stage`, published to `/events` when they change), the 30 s first-beat reclaim, the stall watchdog (`_watch`: heartbeating with no GPU activity for `lease_stall_s` -> `stalled_at`, `yield_requested` while it blocks the queue, reclaimed as `refused` only with `lease_stall_reclaim`), unpolled-queue drop; synchronous with an injectable clock, so test
46
+ heartbeat/TTL expiry (a beat also carries `progress`/`stage`, published to `/events` when they change), the 30 s first-beat reclaim, the stall watchdog (`_watch`: heartbeating with no GPU activity for `lease_stall_s` -> `stalled_at`, `yield_requested` while it blocks the queue, reclaimed as `refused` only with `lease_stall_reclaim`), a tenant's own memory (#36: `tenant_of` links residents by `tenants.<t>.containers` or a process's compose service; `_own_credit` counts its `process` residents toward its in-process leases; its residents are never victims for its own lease), a broker peak (#39: `_sample_own` fills an in-process lease's `peak_vram_mb` with the most its tenant's process residents held while granted, `peak_source: broker`; a client figure replaces it, `client`), unpolled-queue drop; synchronous with an injectable clock, so test
42
47
  it by moving the clock and calling `tick()`), `policy.py` (the operator's YAML: cron, windows, resident rules; `IRIS_POLICY`), `residency.py` (`Residency`:
43
48
  per-resident `ResidentPolicy` view on every poll, `step()` acts on enforced rules: pin/extend Ollama keep_alive,
44
49
  idle-kill evict, `unload_after` (CPU stage -> unloaded; confirmed by the reply, since only RAM moves), restart
45
50
  when unloaded (never merely on the CPU) but holding `restart_residual_mb`, or idle `restart_host_ram_idle` with
46
51
  container anon memory (`Resident.host_ram_mb`) over `restart_host_ram_mb` (default: the manifest's
47
- `host_ram_restart_mb`); `Broker.residuals` remembers what an
52
+ `host_ram_restart_mb`); restore (#35): `Residency.pins` remembers pinned residents seen loaded and warms one
53
+ gone `RESTORE_AFTER_POLLS` polls (Ollama: promptless keep_alive -1 with its old `num_ctx`; argus-http: `warm_path`)
54
+ only with no lease active/queued on the node and room, backing off on failure or a quick re-drop; `/health`
55
+ `pins_missing`; `Broker.residuals` remembers what an
48
56
  eviction left so it is not repeated), `actions.py` (warm: 409 unless `force` while the node cannot admit `warm_mb` or the most it was seen holding, `Broker.peaks`; agent starts the container, wait for health, call `warm_path`;
49
57
  `evict_resident`: adapter route per source, 409 while busy, confirmed by the GPU's NVML free memory rising by half
50
58
  the resident's VRAM, not by the service's word; reports `residual_mb`).
59
+ - `broker/registry.py` — self-registration (`Registry`): manifest residents -> `RegisteredService` (config.py) placed from
60
+ the agents' container `inventory` (node = the agent's, host = its `agent_url` host, port = the published one; the
61
+ caller's host is never used), kept in `config.services` after the configured ones (in place: the lease book and
62
+ residency share that list; `Broker.reconcile` rebuilds adapters). A registered service sends only its tenant's
63
+ `X-Argus-Admin-Token`, never a `token_env`. `DELETE /tenants` lapses (cortex signs off on every shutdown), `?purge=true`
64
+ drops; lapsed services live while their container exists. Agents announce nodes (`POST /nodes`, agent token).
65
+ Persisted to `$IRIS_STATE_DIR/registrations.json` (0600).
66
+ - `broker/directory.py` — the service directory (#48): containers labelled `argus.peer` (the agent's inventory carries
67
+ `argus.*` labels only) plus the config's `peers:`. URL by `registry.container_port` (shared with residents), health
68
+ parsed as argus-cortex `ServiceHealth` (`contract`), else read field by field (only parsed fields kept, bounded,
69
+ never the body; `capabilities` from `capability_names`, so a 1.1 map becomes the list of names that are on),
70
+ probed when due (`directory_health_s`; the broker's own container, `own_container_id`, on loopback: Docker hairpin
71
+ blocks a container reaching itself via its host port). Entries are cortex's frozen `DirectoryEntry`: replace one
72
+ (`_with_health`), never assign to it. A label cortex's model refuses (peer name, health path) skips that container
73
+ with one `directory_label_refused` log line and must never raise; `lookup` of such a name is `None` (a 404). Routes `/directory`, `/directory/sd` (Prometheus http_sd), `/directory/{peer}` (needs the
74
+ caller token: it decides where work goes). Read-only.
51
75
  - `server/app.py` — the broker API (`[server]` extra, `argus-iris serve`, :8120): `/nodes`, `/residents`, `/events`
52
- (SSE: `node` and `lease` events), `/metrics`, `/health`, `/ui/`, the lease routes (`POST /tenants`, `POST /leases`,
76
+ (SSE: `node` and `lease` events), `/metrics`, `/health` (cortex's `install_health`: `ServiceHealth` plus the broker's
77
+ own fields through `extra`; the agent's is the same; add a field there, never rename one), `/ui/`, `/services`, `/registry`, `POST`/`DELETE /nodes`, `DELETE /tenants/{t}`, the lease routes (`POST /tenants`, `POST /leases`,
53
78
  `GET /leases/{id}?wait_s=`, `.../heartbeat`, `.../release`, `GET /leases`, `/queue`, `/tenants`; bearer token
54
79
  checked only when `ARGUS_GPU_BROKER_TOKEN` is set) `POST /services/{id}/warm` and `POST /residents/{id}/evict` (resident ids contain slashes; both need that token). Wrapped in
55
80
  cortex's `WriteGuard`. Test the lease routes with cortex's own `BrokerCoordinator` over `httpx.ASGITransport`.
56
81
  - `ui/` — the dashboard, served by the broker at `/ui/` (`/` redirects). Plain HTML and ES modules with no build
57
82
  step, shipped in the wheel (the pattern argus-mask and argus-survey use). It is a thin client over `/health`,
58
- `/config` and `/events`, and the warm POST, so it never computes what the broker decides. `vendor/dh/` holds
59
- `dh-tokens.css` and `dh-theme.js`, copied unchanged from dh-shared 1.2.7 (via argus-mask): **never edit them**.
83
+ `/config`, `/events`, `/services` and `/registry`, and the warm/evict/forget calls, so it never computes what the broker
84
+ decides. Views: GPUs, Services, Connect (`#services`, `#connect` link to them). `brand/` holds the iris mark from
85
+ argus-cortex `brand/packages/iris` (never edit; re-copy). `vendor/dh/` holds
86
+ `dh-tokens.css` and `dh-theme.js`, copied unchanged from dh-shared 1.2.8 (via argus-sightline): **never edit them**.
60
87
  Re-copy them from a newer sync instead. Colours come from `--dh-*` tokens only.
61
- - `cli.py` — Typer app; entry point `argus-iris` (`serve`, `agent`, `version`).
88
+ - `cli.py` — Typer app; entry point `argus-iris` (`serve`, `agent`, `version`). `serve` calls
89
+ `argus_cortex.settings.apply()` for the token names the config gives, and no others; the agent never reads the suite
90
+ file. Tests run with `ARGUS_ENV_FILE=off` (`tests/conftest.py`); use made-up variable names in them.
62
91
  - `compose.yaml` includes `deploy/broker.compose.yaml` and `deploy/agent.compose.yaml` with `deploy/.env` (project
63
92
  `argus-iris`); `deploy/` — example broker config, policy, and the compose files for the broker and the agents.
64
93
 
@@ -79,9 +108,10 @@ Run one test: `uv run --no-sync pytest tests/test_x.py::test_name -q`.
79
108
  - **`src/` layout, `py.typed`, Pydantic v2, `structlog`.** Ruff line-length 120; keep it clean (`make lint`) before committing.
80
109
  - **Any endpoint that does something is a boundary.** There's no auth by default — treat reaching the port as host access. Gate state-changing routes behind the shared read-only / origin guards, and fence any caller-supplied path under a configured root.
81
110
  - Wire schemas (if any) are checked in and verified in CI — regenerate and commit when the types change, don't let the committed copy drift.
82
- - **Ports:** a2f holds :8110 on morpheus, so the broker is :8120; the agent is :9110 (gothmog's exporter used :9101).
111
+ - **Ports:** the broker is :8120 (argus-mask's a2f holds :8110); the agent is :9110.
83
112
  - **The agent is root-equivalent** (Docker socket, `pid: host`). Container actions stay behind `IRIS_AGENT_TOKEN`
84
- **and** the agent's own `IRIS_AGENT_CONTAINERS` allowlist; never let broker config or a POSTed manifest widen it.
113
+ **and** the agent's own `IRIS_AGENT_CONTAINERS` allowlist (or, opted in per host, the `argus.iris.manage` label set
114
+ in that host's compose files); never let broker config or a POSTed manifest widen it.
85
115
  - **Memory is MiB** everywhere (`*_mb`), times are aware UTC.
86
116
  - **Don't 4xx for "busy"** on lease routes: cortex's client treats any 4xx other than 404 as a caller error. Busy is
87
117
  `queued`.
@@ -1,18 +1,28 @@
1
1
  # argus-iris design
2
2
 
3
- Status: draft, 2026-11-15. Nothing is implemented yet; this is the plan the first releases build to.
3
+ Written before the code (2026-11-15) and kept up to date since. What is built, and what is still a plan:
4
+
5
+ | Part | State |
6
+ |---|---|
7
+ | Node agents, adapters, accounting, dashboard, metrics | Built |
8
+ | Leases: priority classes with aging, head reservation, spill, heartbeat expiry, eviction plans | Built (`admission: observe` or `enforce`) |
9
+ | Residency: idle-kill, pins and restore, restarts, schedule windows | Built, report-only per rule until `enforce: true` |
10
+ | Stall watchdog, crowded-out reporting | Built |
11
+ | Self-registration and service directory | Built |
12
+ | Yield requests | Built for stalled leases; preemption by priority is planned |
13
+ | SQLite history and `/stats`, learned p95 footprints, affinity by checkpoint and LoRA | Planned |
4
14
 
5
15
  ## Problem
6
16
 
7
- Three GPUs are shared by the Argus services and by repos outside the suite. Today nothing coordinates them:
17
+ Three GPUs are shared by the Argus services and by software outside the suite. Today nothing coordinates them:
8
18
 
9
19
  - Only argus-lens and argus-curator take a lease (`argus_cortex.gpu.LeaseCoordinator`), and that lease is a host-local
10
20
  `flock` plus a free-VRAM snapshot. It cannot see another host, holds no reservation, and has no priority.
11
21
  - ComfyUI, Ollama, a2f, MisoTTS, darkroom, atlas, proof and forge never take it.
12
22
  - darkroom refuses a second generation with 409. mint and mask poll it every 5 s for up to 600 s, which is a hand-made
13
23
  queue with no priority.
14
- - Idle and keep-alive policy is spread across repos and pulls in different directions: voluptas's `comfyui-cleanup`
15
- watcher, MisoTTS's `MISO_KEEP_ALIVE_GPU`, agent-composer's per-request `keep_alive=15m`, lens's `ARGUS_IDLE_UNLOAD_S`.
24
+ - Idle and keep-alive policy is spread across repos and pulls in different directions: an idle watcher
25
+ that stops ComfyUI, MisoTTS's `MISO_KEEP_ALIVE_GPU`, agent-composer's per-request `keep_alive=15m`, lens's `ARGUS_IDLE_UNLOAD_S`.
16
26
  - The only OOM handling is lens's backoff retry.
17
27
 
18
28
  argus-iris is one broker that decides **whether** a GPU job may start now, **on which node**, and **what has to be
@@ -23,11 +33,11 @@ iris first and release when done.
23
33
 
24
34
  | Node | GPU | VRAM | Role | Tenants |
25
35
  |---|---|---|---|---|
26
- | morpheus | RTX 3090 | 24 GB | ComfyUI workhorse, Argus dev stack | voluptas (ComfyUI, image-gen-diffusers, NudeNet, MisoTTS), lens, curator, desktop display |
27
- | dragon | RTX 4060 | 8 GB | Ollama primary | agent-composer (incl. SingGuard on :9150), ai-code-auditor |
28
- | jarrah | GTX 1070 Ti (sm_61, no bf16) | 8 GB | Ollama overflow | mithrandir, Immich ML |
36
+ | rtx3090 | RTX 3090 | 24 GB | Image generation | ComfyUI, lens, curator, a desktop display |
37
+ | rtx4060 | RTX 4060 | 8 GB | Ollama primary | Ollama, speech and embedding services |
38
+ | gtx1070 | GTX 1070 Ti (sm_61, no bf16) | 8 GB | Ollama overflow | Ollama |
29
39
 
30
- Host clocks differ (morpheus local time, dragon and jarrah UTC). Iris stores and compares all times in UTC, and every
40
+ Host clocks can be in different timezones. Iris stores and compares all times in UTC, and every
31
41
  schedule window names its timezone explicitly.
32
42
 
33
43
  ## Why not Taskiq
@@ -40,7 +50,7 @@ scheduler and uses `croniter` for windows. No Redis.
40
50
  ## Concepts
41
51
 
42
52
  - **Node**: one GPU on one host. Described by VRAM, compute capability, bf16 support, and the services that run on it.
43
- Each has a reserved amount for things iris does not manage (for example morpheus's desktop display).
53
+ Each has a reserved amount for things iris does not manage (for example rtx3090's desktop display).
44
54
  - **Resident**: a model held in VRAM by a service: a ComfyUI checkpoint, an Ollama model, the a2f engine, a lens
45
55
  captioner. Read and evicted through an **adapter**.
46
56
  - **Tenant**: a service that uses a GPU. **Managed** tenants take leases; **observed** tenants do not, but iris sees
@@ -52,25 +62,25 @@ scheduler and uses `croniter` for windows. No Redis.
52
62
  ## Components
53
63
 
54
64
  ```
55
- callers (cortex BrokerCoordinator) Studio page Prometheus
65
+ callers (cortex BrokerCoordinator) dashboard Prometheus
56
66
  │ POST /leases, heartbeat, release │ /events SSE │ /metrics
57
67
  ▼ ▼ ▼
58
68
  ┌──────────────────────────── argus-iris broker (:8120) ─────────────────────────┐
59
69
  │ registry (tenant manifests) scheduler (classes, aging, affinity, backfill) │
60
70
  │ ledger per node policy (windows, keepalive, idle-kill) │
61
- │ adapters: comfyui · ollama · argus-http · immich · container │
62
- │ history: SQLite (WAL) on a volume │
71
+ │ adapters: comfyui · ollama · argus-http · external │
72
+ │ history: SQLite (WAL) on a volume (planned) │
63
73
  └──────────────┬──────────────────────────┬──────────────────────────┬────────────┘
64
74
  │ GET /snapshot │ │
65
- iris-agent @ morpheus iris-agent @ dragon iris-agent @ jarrah
75
+ iris-agent @ rtx3090 iris-agent @ rtx4060 iris-agent @ gtx1070
66
76
  NVML + cgroup → service NVML + cgroup → service NVML + cgroup → service
67
77
  container start/stop container start/stop container start/stop
68
78
  ```
69
79
 
70
80
  ### Broker
71
81
 
72
- One instance, on morpheus. Holds the authoritative state in memory and appends lease and job events to SQLite for
73
- history and stats. After a restart, clients re-attach on their next heartbeat (the heartbeat carries the lease's
82
+ One instance, on one host. Holds the authoritative state in memory (appending lease and job events to SQLite is
83
+ planned). After a restart, clients re-attach on their next heartbeat (the heartbeat carries the lease's
74
84
  fields), so no external queue store is needed.
75
85
 
76
86
  **Restart grace.** For one heartbeat interval after start-up iris does not know which leases are still running, so it
@@ -84,19 +94,18 @@ against that.
84
94
 
85
95
  ### Node agent (`iris-agent`)
86
96
 
87
- Runs on every GPU host, in the same package behind an `[agent]` extra. Salvaged from gothmog's `gpu-process-exporter`,
88
- modernised:
97
+ Runs on every GPU host, in the same package behind an `[agent]` extra. It reads:
89
98
 
90
99
  - NVML via `nvidia-ml-py`: total, free and per-process VRAM; GPU utilisation. NVML reports host PIDs, so the agent
91
100
  runs with `pid: host` (and `cgroup: host`, or cgroup paths read relative to its own namespace).
92
- - PID to compose service through `/proc/<pid>/cgroup` and one Docker lookup per new container ID, cached. gothmog ran
93
- `docker top` on every container for every new PID.
94
- - Idle time per process: VRAM unchanged **and** utilisation near zero. gothmog used VRAM alone, which calls a busy
101
+ - PID to compose service through `/proc/<pid>/cgroup` and one Docker lookup per new container ID, cached. Never
102
+ `docker top` on every container.
103
+ - Idle time per process: VRAM unchanged **and** utilisation near zero. VRAM alone would call a busy
95
104
  process with a steady footprint idle.
96
105
  - Host RAM, and per-container anonymous memory from the container's cgroup `memory.stat` (host `/sys/fs/cgroup`
97
- mounted read-only), because ComfyUI's host-RAM growth once hung morpheus (voluptas #16). This replaces voluptas's
106
+ mounted read-only), because ComfyUI's host-RAM growth can hang a host. This replaces a
98
107
  `docker exec … cat memory.stat`.
99
- - Container actions the broker may ask for: `start`, `stop`, `restart`. Needed because voluptas's watcher stops
108
+ - Container actions the broker may ask for: `start`, `stop`, `restart`. Needed because an idle watcher may stop
100
109
  ComfyUI after an idle spell and nothing starts it again. Needs the Docker socket (spoken to directly over the Unix
101
110
  socket, no Docker SDK), so the agent is root-equivalent on its host:
102
111
  - actions apply only to containers on the agent's own allowlist (`IRIS_AGENT_CONTAINERS`); a manifest POSTed to the
@@ -113,25 +122,20 @@ Units: every memory figure on the wire is MiB (NVML bytes / 2^20), named `*_mb`
113
122
  | comfyui | `/system_stats`, `/queue`, `/object_info` for loaded models | `POST /free {unload_models, free_memory}`; container `restart` when host RAM is high and the queue is empty | container `start`, then wait for `/system_stats` |
114
123
  | ollama | `/api/ps` (`size_vram`, `expires_at`) | `POST /api/generate {model, keep_alive: 0}` | `POST /api/generate {model, keep_alive: <window>}` |
115
124
  | argus-http | `/health` (`vram_status`) | `POST /admin/unload` (lens has it; others add it) | first request, or `POST /admin/wake` |
116
- | immich | node agent only | set `MACHINE_LEARNING_MODEL_TTL` low; never kill | none |
117
- | container | node agent | `stop` (last resort, opt-in per tenant) | `start` |
125
+ | external | `health_path` up/down; VRAM and idle from the node agent | none, or container `stop` with `evict_by: stop` (opt-in per service, and for admission an enforced policy rule) | container `start`; admission's stops are started again once no lease is active on the node (#29) |
118
126
 
119
- Adapters are configured by tenant manifests, not hard-coded per service as gothmog was. The argus-http adapter's
127
+ Adapters are configured by tenant manifests, not hard-coded per service. The argus-http adapter's
120
128
  paths are per manifest, because the services that already have lifecycle endpoints spell them differently.
121
- agent-composer#44 and voluptas#22 converge on one contract: `/health` with `loaded`, `model_state`, `idle_s` (and
122
- `busy`), plus `POST /admin/unload|evict|wake`, guarded by `ARGUS_ADMIN_TOKEN` when it is set. agent-composer's
123
- sidecars listen on loopback, so iris reaches them through rag-chat's gateway at
124
- `<rag-chat>/api/runtime/residents/<name>`, which needs an API key as Bearer even for reads. A service's own `idle_s`
129
+ They converge on one contract: `/health` with `loaded`, `model_state`, `idle_s` (and
130
+ `busy`), plus `POST /admin/unload|evict|wake`, guarded by `ARGUS_ADMIN_TOKEN` when it is set. A service's own `idle_s`
125
131
  takes precedence over the agent's process-level idle time.
126
132
 
127
133
  **ComfyUI specifics.** `POST /free` unloads every model at once, and stock ComfyUI has no endpoint that lists what is
128
134
  loaded, so for eviction ComfyUI is a single resident. The affinity bonus comes from the checkpoint and LoRAs of the last
129
- job iris granted on it (callers pass them on the lease), not from ComfyUI itself; gothmog's affinity read imogen's own
130
- `/state`, which ComfyUI does not have. Warming means `start` through the agent and waiting for `/system_stats`, which is
131
- what fixes ComfyUI staying down after voluptas's idle stop.
135
+ job iris granted on it (callers pass them on the lease), not from ComfyUI itself. Warming means `start` through the agent and waiting for `/system_stats`, which is
136
+ what fixes ComfyUI staying down after an idle stop.
132
137
 
133
- **Direct ComfyUI traffic is not gated.** voluptas's own LAN clients submit to ComfyUI without a lease. They are known,
134
- so the comfyui adapter treats a non-empty `/queue` that iris did not grant as unannounced load: it counts ComfyUI's
138
+ **Direct ComfyUI traffic is not gated.** Some clients submit to ComfyUI without a lease, so the comfyui adapter treats a non-empty `/queue` that iris did not grant as unannounced load: it counts ComfyUI's
135
139
  measured VRAM in full and never evicts while the queue is busy.
136
140
 
137
141
  ## Admission and OOM avoidance
@@ -180,7 +184,7 @@ Priority classes, highest first:
180
184
  | `batch` | atlas bakes, proof runs, mint sample runs, lens batches | yes, cooperatively |
181
185
  | `background` | forge training, bulk re-captioning | yes, cooperatively |
182
186
 
183
- Within a class, the score is gothmog's: a wait bonus so nothing starves, plus an affinity bonus when the job's
187
+ Within a class, the score is a wait bonus so nothing starves, plus an affinity bonus when the job's
184
188
  checkpoint or LoRA is already loaded on the node. A lower job may **backfill** only if it fits beside the reservation
185
189
  held for the head of the queue.
186
190
 
@@ -206,20 +210,32 @@ that ignores it is not killed, but from the first `yield_requested` iris stops e
206
210
 
207
211
  **Placement.** A lease names a target, not a host:
208
212
 
209
- - `comfyui`: the node(s) running ComfyUI (morpheus).
210
- - `ollama:<model>`: dragon first, spill to jarrah when dragon cannot admit it and the model fits jarrah. With
211
- SingGuard pinned on dragon (about 5.8 GiB of 8 GiB, plus Infinity and nomic-embed-text), dragon has about 1.75 GiB
212
- left, so in practice any general model larger than an embedder lands on jarrah.
213
+ - `comfyui`: the node(s) running ComfyUI (rtx3090).
214
+ - `ollama:<model>`: rtx4060 first, spill to gtx1070 when rtx4060 cannot admit it and the model fits gtx1070. Where both fit, the Ollama serving
215
+ fewer granted leases goes first (then the one with the model loaded), so concurrent jobs spread over the two; an
216
+ Ollama whose `/api/tags` lacks the model is skipped unless none has it. A lease that fits nowhere waits on the node
217
+ its running leases would free.
218
+ - `xtts`: rtx4060's XTTS sidecar first, then rtx3090's argus-echo XTTS (same studio speakers), which declares
219
+ `serves: [xtts]` (#40). A service answers a target named after its id, its adapter, or anything in `serves`, so one
220
+ target can have a service on several nodes, and the grant's `base_url` says which one to call.
213
221
  - `in-process` with constraints: `min_vram_mb`, `bf16`, `min_cc`, or an explicit node for a process pinned to a host.
214
222
 
223
+ **Room that never comes back** (#40). Each poll, iris sums what admission can never free on a node: pinned residents
224
+ (a pin that dropped out and is due to be restored included), processes it has no adapter for and no tenant owns,
225
+ externals it may not stop, and the context an unloaded, CPU-parked or failed service keeps. A service whose
226
+ need (the larger of `warm_mb` and the most it has been seen holding; a resident over its `warm_mb` logs `resident_over_warm_mb` once) exceeds what is left beside that is `crowded_out`: on
227
+ `/health` (`crowded_out`), the node's services (`need_mb`, `room_mb`), `iris_service_crowded_out`, the dashboard, and a
228
+ `service_crowded_out` log naming the biggest holders. It is a report, not an action: the operator moves a pin, adds a
229
+ node for the target (`serves`), or lets `restart_residual_mb` return a residue.
230
+
215
231
  ## Policy: schedules, keepalive, idle-kill
216
232
 
217
233
  One YAML policy file, owned by the operator, merged over the hints in tenant manifests:
218
234
 
219
235
  ```yaml
220
- timezone: America/Los_Angeles # example: morpheus's local zone (UTC-8 in November); times on the wire are UTC
236
+ timezone: UTC # cron fields are read in this zone; times on the wire are UTC
221
237
  nodes:
222
- morpheus: { reserve_mb: 3500 } # desktop display
238
+ rtx3090: { reserve_mb: 3500 } # desktop display
223
239
  windows:
224
240
  - name: nightly-audit
225
241
  cron: "0 1 * * *" # opens at 01:00
@@ -231,17 +247,15 @@ windows:
231
247
  cron: "0 0 * * 6" # Saturday midnight
232
248
  duration: 30h
233
249
  tenant: argus-forge
234
- node: morpheus
250
+ node: rtx3090
235
251
  class: background
236
252
  residents: # first matching rule wins
237
- - match: { node: dragon, ollama: "hf.co/inclusionAI/SingGuard-4b-GGUF:*" }
238
- keepalive: always # pinned: never evicted
239
- - match: { node: jarrah, ollama: "qwen3:8b" }
240
- keepalive: { cron: "0 8 * * 1-5", duration: 10h } # does not fit dragon beside SingGuard
253
+ - match: { node: gtx1070, ollama: "qwen3:8b" }
254
+ keepalive: { cron: "0 8 * * 1-5", duration: 10h } # pinned in working hours: never evicted then
241
255
  idle_kill: 15m
242
- - match: { node: jarrah, ollama: "*" }
256
+ - match: { node: gtx1070, ollama: "*" }
243
257
  idle_kill: 5m # one model fills the card; keep it moving
244
- - match: { node: morpheus, service: comfyui }
258
+ - match: { node: rtx3090, service: comfyui }
245
259
  idle_kill: 30m # replaces COMFYUI_IDLE_TIMEOUT_SECONDS
246
260
  ```
247
261
 
@@ -260,6 +274,18 @@ Every repo that uses a GPU, inside the suite or not, commits `gpu-tenant.yaml`.
260
274
  (`gpu-tenant-schema.json`, generated and drift-tested like the taxonomy and provenance schemas). A service POSTs its
261
275
  manifest to iris on startup; iris also accepts manifests from its config directory for tenants that never call it.
262
276
 
277
+ **Self-registration** (2026-11-23). Adding or removing a GPU service needs only the broker URL and token on the
278
+ service. A registered manifest's residents become services without an `iris.yaml` entry: the agents report every
279
+ container on their hosts (`inventory` in the snapshot, with compose labels and published ports), and a resident lands on
280
+ the node whose agent has its container, at that node's host and the container's published port (`port` disambiguates).
281
+ The caller's host is never trusted, so a registration cannot point the broker, or a token, anywhere but a node. The
282
+ admin token for `admin_auth` routes comes with the registration (`X-Argus-Admin-Token`) and goes only to that tenant's
283
+ services. Configured entries win. A sign-off (`DELETE /tenants/{t}`, sent on every client shutdown) lapses the
284
+ registration; its services stay while their containers exist, since iris may have stopped them, and go when the
285
+ container is removed. Agents announce themselves the same way (`POST /nodes`, with the agent token), so a new GPU host
286
+ needs no broker config. Starting a registered container still needs that host's consent: its agent's allowlist, or the
287
+ `argus.iris.manage` label where the agent opted in to it (`IRIS_AGENT_MANAGE_LABEL`).
288
+
263
289
  ```yaml
264
290
  tenant: argus-darkroom
265
291
  kinds:
@@ -293,12 +319,16 @@ through cortex's `WriteGuard` and take an optional `Authorization: Bearer <ARGUS
293
319
  | `GET` | `/leases/{id}?wait_s=N` | `LeaseStatus`, long-polled until the state changes or N elapses. `404` when unknown; the client re-POSTs. |
294
320
  | `POST` | `/leases/{id}/heartbeat` | `Heartbeat` (`peak_vram_mb`) → `HeartbeatReply` (`state`, `yield_requested`, `ttl_s`, `reason`). `404` when unknown; the client re-attaches with `resume`. |
295
321
  | `POST` | `/leases/{id}/release` | `LeaseRelease` (`outcome` ok / failed / oom / cancelled, `peak_vram_mb`, `detail`). `cancelled` on a queued lease drops it from the queue. |
296
- | `POST` | `/tenants` | Register a `TenantManifest`. |
322
+ | `POST` | `/tenants` | Register a `TenantManifest` (headers `X-Argus-Admin-Token`, `X-Argus-Container-Id`); its residents become services where an agent reports their containers. |
323
+ | `DELETE` | `/tenants/{tenant}` | Sign off: the registration lapses now. `?purge=true` drops it and its services at once. |
324
+ | `GET` | `/services`, `/registry` | Every service with its origin (`config` or `tenant`); registered tenants with where each resident landed or why not, and nodes with theirs. |
325
+ | `POST` | `/nodes` | An agent announces its node (agent token). `DELETE /nodes/{name}` forgets an announced one. |
326
+ | `GET` | `/directory`, `/directory/{peer}`, `/directory/sd` | Service directory (#48): containers labelled `argus.peer` with URL and health; peer lookup (caller token); Prometheus http_sd. |
297
327
  | `GET` | `/nodes`, `/residents`, `/queue`, `/stats` | State for the dashboard and for operators. |
298
328
  | `POST` | `/services/{id}/warm` | Manual: start the service's container through its agent if the service is down, wait for its health check, then call its `warm_path`. A stopped service has no resident, so this targets the service. |
299
329
  | `POST` | `/residents/{id}/evict` | Manual eviction from the dashboard (step 4). |
300
- | `GET` | `/events` | SSE stream of every state change, for the Studio page. |
301
- | `GET` | `/metrics` | Prometheus (gothmog's gauges plus queue, wait and eviction counters). |
330
+ | `GET` | `/events` | SSE stream of every state change, for the dashboard. |
331
+ | `GET` | `/metrics` | Prometheus (gauges plus queue, wait and eviction counters). |
302
332
  | `GET` | `/health` | Liveness and the reachability of each agent. |
303
333
 
304
334
  How the client reacts to errors constrains the status codes: a 5xx, a transport error or a `404` on `POST /leases`
@@ -329,31 +359,20 @@ The client lives in cortex so every service gets it through the existing `GpuCoo
329
359
  | argus-mint | Bio writer on `ollama:<model>` (`batch` for sample runs). Renders go through darkroom. |
330
360
  | argus-lens, argus-curator | No code change: `ARGUS_GPU_COORDINATOR=broker`. |
331
361
  | argus-proof | `batch` on `comfyui` or in-process with constraints. |
332
- | argus-forge | Exclusive whole-card `background` lease on morpheus, inside a window. |
333
- | agent-composer, SingGuard | SingGuard is an Ollama model (`SingGuard-4b` Q4_K_M, about 5.8 GiB), called through rag-chat on :9150; it is a pinned resident on dragon. Other requests stop sending `keep_alive=15m` once iris owns residency. agent-composer has one `OLLAMA_URL` and no host routing, so spilling its work to jarrah needs it to call the grant's `base_url` through the cortex client. |
334
- | ai-code-auditor | Was a gothmog capacity-token client: moves to an `ollama:<model>` lease. |
335
- | voluptas, mithrandir, Immich | Observed first; iris takes over the idle policy (see rollout). |
362
+ | argus-forge | Exclusive whole-card `background` lease on rtx3090, inside a window. |
363
+ | agent-composer | `ollama:<model>` per call; its sidecars are argus-http residents. |
364
+ | ai-code-auditor | `batch` on `ollama:<model>`, in a window. |
365
+ | ComfyUI's direct clients, Immich | Observed, no lease. |
336
366
 
337
367
  ## Taking over existing lifecycle code
338
368
 
339
- Iris must not fight the per-repo mechanisms it replaces, so each one is handed over explicitly:
340
-
341
- | Mechanism | Repo | Handover |
342
- |---|---|---|
343
- | `comfyui-cleanup` stop after `COMFYUI_IDLE_TIMEOUT_SECONDS` and RAM restart | voluptas | It used to `docker stop` ComfyUI after 30 min idle, and nothing started it again. voluptas#22 makes `0` mean disabled and the default. The #16 RAM restart stays until the comfyui adapter owns it; then set `COMFYUI_MEM_RESTART_MB=0`. |
344
- | `comfyui_cleanup.sh` `POST /free` every 15 min | voluptas | It freed models whatever the queue held. voluptas#22 skips `/free` while a job is queued. Set `COMFYUI_CLEANUP_FREE=0` once iris owns residency; the history, output and temp cleanup stay, since iris does not do them. |
345
- | `MISO_KEEP_ALIVE_GPU` / `_CPU` | voluptas (MisoTTS) | Leave it; register MisoTTS as an argus-http resident and let iris evict earlier when it needs the memory. |
346
- | per-request `keep_alive=15m` and `OLLAMA_KEEP_ALIVE=15m` | agent-composer | rag-chat and rag-ingest send it on every Ollama call, so any request re-pins its model whatever iris decided. agent-composer#44 adds `OLLAMA_KEEP_ALIVE=server`, which stops sending it. Switch to that when iris owns Ollama residency (step 4); the default stays `15m`. |
347
- | `/api/runtime/ollama/evict` with no model, `/ollama/wake` | agent-composer | The no-model evict unloads every loaded model, including other tenants'. Route both through iris's `/residents/{id}/evict` and `/warm`. |
348
- | Infinity manager idle reaper (`INFINITY_IDLE_TIMEOUT=300`) | agent-composer | Leave it; Infinity is an argus-http resident (0.8 GiB loaded, 1.3 GiB peak, held until the process stops). Since agent-composer#44 it answers 409 `busy` to an evict with requests in flight. |
349
- | `run_with_oom_wait` (retry on CUDA OOM for up to 180 s) | agent-composer | Keep it as the fallback when iris is down. A lease refusal must come back as a distinct error, not one shaped like an OOM, or the loop polls for 180 s. |
350
- | `STT_KEEP_ALIVE_GPU` | agent-composer (Whisper) | Leave it; agent-composer#44 gives Whisper `/admin/unload`, so iris can evict it earlier. |
351
- | `ARGUS_IDLE_UNLOAD_S` | argus-lens | Unset when lens runs with the broker coordinator. |
352
- | `MACHINE_LEARNING_MODEL_TTL` | Immich (mithrandir) | Set low; iris only observes it. |
369
+ Iris must not fight the mechanisms it replaces (idle watchers, per-request `keep_alive`, sidecar timers), so each is
370
+ handed over explicitly: evict the resident correctly by hand once, then in one change disable its own timer and set
371
+ `enforce: true` on the matching rule. Until then the rule only reports what it would do.
353
372
 
354
373
  ## Dashboard
355
374
 
356
- A Studio page, fed by `/events` and `/stats`:
375
+ Served by the broker, fed by `/events` (history waits on `/stats`):
357
376
 
358
377
  - per node: VRAM bar split into leases, residents, reserve and free; host RAM; agent reachability
359
378
  - queue per class with wait times and position, and the lease each job is waiting on
@@ -362,28 +381,15 @@ A Studio page, fed by `/events` and `/stats`:
362
381
 
363
382
  Prometheus `/metrics` remains for Grafana.
364
383
 
365
- ## What is salvaged from gothmog
366
-
367
- | Kept | From | Changed |
368
- |---|---|---|
369
- | Affinity scoring (checkpoint and LoRA hits, wait bonus, run-lag penalty) | `server/gpu_pool.py` `_score` | Moves into the per-class score; weights in the policy file. |
370
- | Capacity tokens with TTL | `server/gpu_pool.py` `CapacityManager` | Becomes the lease, with heartbeat instead of a fixed 2 h TTL and a real VRAM ledger instead of "all backends idle". |
371
- | Idle reaper with per-backend TTL | `server/gpu_residents.py` | Becomes `idle_kill` in the policy, evicting through adapters. |
372
- | Per-process VRAM exporter | `gpu-process-exporter/` | Becomes `iris-agent`: cgroup lookup, host RAM, container actions, snapshot API. |
373
- | Prometheus gauges | `server/metrics.py` | Kept, renamed under `iris_`. |
374
-
375
- Dropped: the LangGraph/LangChain workflow layer, module-global singletons, hard-coded backend URLs, the "wait for peers
376
- idle, then proceed anyway" loop (no OOM protection), and a new HTTP client per poll.
377
-
378
384
  ## Rollout
379
385
 
380
386
  1. **cortex**: lease and manifest wire models, `gpu-tenant-schema.json`, `BrokerCoordinator`, the additive `lease()`
381
387
  arguments. Minor release.
382
- 2. **iris, observe-only**: agents on all three hosts, adapters read-only, the Studio page. No evictions, no leases
388
+ 2. **iris, observe-only**: agents on every host, adapters read-only, the dashboard. No evictions, no leases
383
389
  enforced. This shows real footprints and idle times before iris acts on them.
384
390
  3. **iris, leases**: admission, the ledger, placement, priority classes. lens and curator switch by environment
385
391
  variable; darkroom adopts the client and queues instead of returning 409.
386
- 4. **iris, residency**: idle-kill and keepalive, one tenant at a time, retiring each mechanism in the handover table.
392
+ 4. **iris, residency**: idle-kill and keepalive, one tenant at a time, retiring each old mechanism as it goes.
387
393
  5. atlas, mask, mint, proof and the outside repos adopt leases; cooperative yield; learned footprints; schedule
388
394
  windows; forge.
389
395
 
@@ -391,9 +397,8 @@ idle, then proceed anyway" loop (no OOM protection), and a new HTTP client per p
391
397
 
392
398
  Settled 2026-11-15:
393
399
 
394
- - iris runs on morpheus; fail-open when it is down is acceptable (see Broker).
395
- - ComfyUI work that voluptas's own clients submit directly is not gated for now. Those LAN consumers are known, and
396
- the comfyui adapter treats their queue as unannounced load.
400
+ - One broker; fail-open when it is down is acceptable (see Broker).
401
+ - ComfyUI work submitted without a lease is not gated; the comfyui adapter treats it as unannounced load.
397
402
  - Auth: a shared bearer token for callers, and a separate one for broker→agent calls. Revisit if the agent or broker
398
403
  needs per-caller identity, for example to attribute metrics.
399
404
  - Footprints are declared as `model_mb` plus `working_mb` (see Admission). cortex PR #78 has a single `vram_mb` so far; the split (as an optional `model_mb` beside the total) has been asked of cortex.
@@ -0,0 +1,25 @@
1
+ # syntax=docker/dockerfile:1
2
+
3
+ # Builds the wheel. It needs git and .git (hatch-vcs reads the version from history); the final image has neither, nor
4
+ # anything else from the build context.
5
+ FROM python:3.11-slim AS builder
6
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/
7
+ RUN apt-get update \
8
+ && apt-get install -y --no-install-recommends git \
9
+ && rm -rf /var/lib/apt/lists/*
10
+ WORKDIR /src
11
+ COPY . .
12
+ RUN uv build --wheel --out-dir /dist
13
+
14
+ # One image for both roles: the broker (`argus-iris serve`, :8120) and the per-host agent (`argus-iris agent`, :9110).
15
+ FROM python:3.11-slim
16
+ WORKDIR /app
17
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/
18
+ COPY --from=builder /dist /tmp/dist
19
+ RUN wheel=$(ls /tmp/dist/*.whl) \
20
+ && uv pip install --system --no-cache "${wheel}[server,agent,cli]" \
21
+ && rm -rf /tmp/dist
22
+ # Inside the container only: compose decides where the port is published (HOST_IP, 127.0.0.1 by default).
23
+ ENV IRIS_HOST=0.0.0.0 IRIS_AGENT_HOST=0.0.0.0
24
+ EXPOSE 8120 9110
25
+ CMD ["argus-iris", "serve"]