Flatten the priority feature (load levels: high/medium/low classification with per-level concurrency limits 2/8/32) so that only one job runs at a time — strict FIFO by created_at.
Decisions (locked):
Full removal of the load-level system: enum, classifier, .load files, [load_levels] config section, --load-level CLI flag, loadLevel JSON/XML fields, LOAD column in zag status.
service.max_concurrent_jobs removed too (already deprecated).
Friendly deprecation: old configs containing [load_levels] or max_concurrent_jobs still load fine; config validate and config show report them as non-fatal warnings, and the daemon logs them once at startup. ZAG_LOAD_LEVELS_* / ZAG_SERVICE_MAX_CONCURRENT_JOBS env vars are likewise detected, warned about, and ignored.
web/ is out of scope — no changes there (consequences documented at the bottom).
Delete LoadLevels; remove load_levels from Config, validate(), fromDoc(), known_sections, checkSection/problems(), and both env-section aliases (load_levels/loadlevels). Remove max_concurrent_jobs field + its validation entry.
Deprecation detection (new):
Problem gains a deprecated: bool (or a separate warnings list); problems() special-cases section load_levels and key service.max_concurrent_jobs → warning: "deprecated: only one job runs at a time; remove it from your config" instead of "Unknown section/key".
config.load() gains an optional diagnostics-out (same Diagnostic pattern already used): when a loaded file contains either, it records a warning. Callers: daemon startup logs it once (std.log.warn); config validateprints it but does not fail (exit 1 stays reserved for real errors); config show prints a warning line above the effective config.
src/defaults/zag.conf: delete [load_levels] section + the deprecated max_concurrent_jobs comment.
Delete src/defaults/{high,medium,low}.load, their entries in src/defaults.zig (files = zag.conf only), and delete src/loadlevel.zig, src/loadclass.zig + their src/root.zig exports.
Phase 4 — CLI & output
src/cli_jobs.zig: drop --load-level/-l (opts + usage + run_job IPC payload + runOffline classifier); remove LOAD column from printStatusTable.
src/cli_admin.zig: configNode/cmdConfigShow lose [load_levels] (plus the new deprecation warning line); config install installs only zag.conf (usage text updated); autocompletion drops the -l|--load-level case and the flag from run opts; service-start wiring (~line 129) no longer builds a Classifier.
src/cli.zig: help test now asserts --load-level is absent from run --help.
hRunJob: delete loadLevel parsing/validation (old clients sending the field are simply ignored — protocol stays backward-compatible).
reload(): delete setLimits call. Delete the "load level is auto-classified or overridden" test; drop .load_levels from the harness config.
Phase 6 — Tests & e2e
Update all unit tests listed in phases 1–5 (config defaults/embedded/env/validate/problems; repository manifest round-trip; jobjson layout; output XML).
Add config tests: doc with [load_levels] → problems() returns 1 deprecation, cmdConfigValidate exits 0; same for the max_concurrent_jobs key and ZAG_LOAD_LEVELS_MAX_HIGH_JOBS env.
test/e2e.sh:
config show --defaults no longer asserts max_high_jobs = 2 (assert it is absent);
install --show asserts zag.conf, not high.load;
new: config with [load_levels] → config validate exits 0 and prints the deprecation note;
new serial-execution check: two sleep jobs via IPC → second stays QUEUED while first is RUNNING, both finish in FIFO order.
Phase 7 — Docs
README.md: delete the "Load Levels" section, the load_level table row, and the --load-level override paragraph; fix "Migration from barn" (env example ZAG_LOAD_LEVELS_MAX_HIGH_JOBS works, the .load-lists bullet, the config show bullet) and add explicit deviation notes: one job runs at a time, no load levels / loadLevel field, deprecated sections accepted-but-ignored with a warning.
AGENTS.md: drop the loadlevel.zig/loadclass.zig layout rows, update the defaults row, note the intentional barn deviation.
Manual smoke: config install --show, config show --defaults, config validate on an old conf (exit 0 + deprecation note), daemon start with an old conf (one warning line), two sequential zag run calls serialize.
Consequences for web/ (out of scope — no changes made)
ZagJob DTO: loadLevel ?? 'MEDIUM' → synced jobs will always appear MEDIUM (harmless).
Breaking: if a user submits load_level in the web UI, ZagClient::run appends --load-level=… and the new zag exits 2 → that job fails to start. ZagJob model's load_level column stops being meaningful.
Future follow-up (separate repo/PR, not part of this issue): drop ZagLoadLevel, the load_level request param in Run.php, the loadLevel arg in ZagClient::run, and the DTO/model fields.
Risks
Throughput change is intentional: up to 32 parallel downloads now serialize into one — pipeline wait times will grow.
Breaking for anything parsing zag's JSON/XML or using --load-level — only web/ does, today.
Old on-disk jobs keep working (lenient manifest/JSON parsing); automatic cleanup removes them over time.
No cluster actions involved; pure code + docs in zag/, one PR.
## Summary
Flatten the priority feature (load levels: `high`/`medium`/`low` classification with per-level concurrency limits 2/8/32) so that **only one job runs at a time** — strict FIFO by `created_at`.
**Decisions (locked):**
1. **Full removal** of the load-level system: enum, classifier, `.load` files, `[load_levels]` config section, `--load-level` CLI flag, `loadLevel` JSON/XML fields, LOAD column in `zag status`.
2. **`service.max_concurrent_jobs` removed** too (already deprecated).
3. **Friendly deprecation**: old configs containing `[load_levels]` or `max_concurrent_jobs` still load fine; `config validate` and `config show` report them as **non-fatal warnings**, and the daemon logs them once at startup. `ZAG_LOAD_LEVELS_*` / `ZAG_SERVICE_MAX_CONCURRENT_JOBS` env vars are likewise detected, warned about, and ignored.
4. **`web/` is out of scope** — no changes there (consequences documented at the bottom).
## Feature footprint
| Area | Files |
|---|---|
| Model + classification | `src/loadlevel.zig`, `src/loadclass.zig`, `src/job.zig` (`Job.load_level`, `Manifest.load_level`) |
| Concurrency | `src/scheduler.zig` (`limits`, `counts[3]`, `runningAt`, `setLimits`, `limitFor`) |
| Config surface | `src/config.zig` (`LoadLevels`, `[load_levels]` section, `ZAG_LOAD_LEVELS_*` env, validation, `problems()`), `src/defaults/zag.conf`, `src/defaults/*.load`, `src/defaults.zig` |
| CLI | `src/cli_jobs.zig` (`--load-level/-l` on `run`, LOAD column in `status`), `src/cli_admin.zig` (`config show`/`install`, autocompletion, service-start wiring), `src/cli.zig` (help test) |
| IPC/daemon | `src/service.zig` (`loadLevel` payload, `Options.classifier`, `reload`→`setLimits`) |
| Output | `src/jobjson.zig` (`loadLevel` JSON field), `src/output.zig` (`<load_level>` XML) |
| Persistence | `src/repository.zig` (`CreateOptions.load_level`, manifest.json `loadLevel`) |
| Docs/tests | `README.md`, `AGENTS.md`, `test/e2e.sh`, unit tests |
## Implementation plan
### Phase 1 — Scheduler: strict single-job FIFO (`src/scheduler.zig`)
- Delete `Options.limits`, `counts[3]`, `runningAt()`, `setLimits()`, `limitFor()`; `Active` loses `level`.
- Capacity check: `active.count() >= 1 → AtCapacity`. Everything else (scheduler file lock, tick loop, `stop()`, `killAll`, `killJob`, retry-at skip, FIFO-by-`created_at`) stays.
- Tests: replace the three limit tests with **never more than one running at a time** + **FIFO completion order** tests; keep retry/kill/single-scheduler tests.
### Phase 2 — Job model & persistence
- `src/job.zig`: drop `load_level` from `Job` and `Manifest`.
- `src/repository.zig`: drop `CreateOptions.load_level`; manifest writer drops `loadLevel`; reader tolerates old manifests (unknown fields already ignored).
- `src/jobjson.zig`: drop `loadLevel` from `writeJob` and `RawJob` (old JSON still parses; JSON field order shifts — note in docs).
- `src/output.zig`: drop `<load_level>` XML element + update the XML-shape test.
### Phase 3 — Config surface (`src/config.zig`, `src/defaults/`)
- Delete `LoadLevels`; remove `load_levels` from `Config`, `validate()`, `fromDoc()`, `known_sections`, `checkSection`/`problems()`, and both env-section aliases (`load_levels`/`loadlevels`). Remove `max_concurrent_jobs` field + its validation entry.
- **Deprecation detection (new)**:
- `Problem` gains a `deprecated: bool` (or a separate warnings list); `problems()` special-cases section `load_levels` and key `service.max_concurrent_jobs` → warning: *"deprecated: only one job runs at a time; remove it from your config"* instead of "Unknown section/key".
- `config.load()` gains an optional diagnostics-out (same `Diagnostic` pattern already used): when a loaded file contains either, it records a warning. Callers: daemon startup logs it once (`std.log.warn`); `config validate` **prints it but does not fail** (exit 1 stays reserved for real errors); `config show` prints a warning line above the effective config.
- `applyEnvironment()` special-cases `ZAG_LOAD_LEVELS_*` / `ZAG_LOADLEVELS_*` / `ZAG_SERVICE_MAX_CONCURRENT_JOBS` → warning + ignore instead of silent no-match.
- `src/defaults/zag.conf`: delete `[load_levels]` section + the deprecated `max_concurrent_jobs` comment.
- Delete `src/defaults/{high,medium,low}.load`, their entries in `src/defaults.zig` (`files` = `zag.conf` only), and **delete `src/loadlevel.zig`, `src/loadclass.zig`** + their `src/root.zig` exports.
### Phase 4 — CLI & output
- `src/cli_jobs.zig`: drop `--load-level/-l` (opts + usage + `run_job` IPC payload + `runOffline` classifier); remove LOAD column from `printStatusTable`.
- `src/cli_admin.zig`: `configNode`/`cmdConfigShow` lose `[load_levels]` (plus the new deprecation warning line); `config install` installs only `zag.conf` (usage text updated); autocompletion drops the `-l|--load-level` case and the flag from `run` opts; service-start wiring (~line 129) no longer builds a `Classifier`.
- `src/cli.zig`: help test now asserts `--load-level` is **absent** from `run --help`.
### Phase 5 — IPC/daemon (`src/service.zig`)
- `Options`: delete `classifier`; `schedulerOptions`: delete `.limits`.
- `hRunJob`: delete `loadLevel` parsing/validation (old clients sending the field are simply ignored — protocol stays backward-compatible).
- `reload()`: delete `setLimits` call. Delete the "load level is auto-classified or overridden" test; drop `.load_levels` from the harness config.
### Phase 6 — Tests & e2e
- Update all unit tests listed in phases 1–5 (`config` defaults/embedded/env/validate/problems; `repository` manifest round-trip; `jobjson` layout; `output` XML).
- Add `config` tests: doc with `[load_levels]` → `problems()` returns 1 *deprecation*, `cmdConfigValidate` exits **0**; same for the `max_concurrent_jobs` key and `ZAG_LOAD_LEVELS_MAX_HIGH_JOBS` env.
- `test/e2e.sh`:
- `config show --defaults` no longer asserts `max_high_jobs = 2` (assert it is absent);
- `install --show` asserts `zag.conf`, not `high.load`;
- **new**: config with `[load_levels]` → `config validate` exits 0 and prints the deprecation note;
- **new serial-execution check**: two `sleep` jobs via IPC → second stays `QUEUED` while first is `RUNNING`, both finish in FIFO order.
### Phase 7 — Docs
- `README.md`: delete the "Load Levels" section, the `load_level` table row, and the `--load-level` override paragraph; fix "Migration from barn" (env example `ZAG_LOAD_LEVELS_MAX_HIGH_JOBS works`, the `.load`-lists bullet, the `config show` bullet) and add explicit deviation notes: **one job runs at a time**, **no load levels / `loadLevel` field**, deprecated sections accepted-but-ignored with a warning.
- `AGENTS.md`: drop the `loadlevel.zig`/`loadclass.zig` layout rows, update the `defaults` row, note the intentional barn deviation.
### Phase 8 — Verify
- `zig fmt --check`, `zig build test`, `zig build e2e`, release cross-compile (per CI).
- Manual smoke: `config install --show`, `config show --defaults`, `config validate` on an old conf (exit 0 + deprecation note), daemon start with an old conf (one warning line), two sequential `zag run` calls serialize.
## Consequences for `web/` (out of scope — no changes made)
- `ZagJob` DTO: `loadLevel ?? 'MEDIUM'` → synced jobs will always appear `MEDIUM` (harmless).
- **Breaking**: if a user submits `load_level` in the web UI, `ZagClient::run` appends `--load-level=…` and the new zag exits 2 → that job fails to start. `ZagJob` model's `load_level` column stops being meaningful.
- Future follow-up (separate repo/PR, not part of this issue): drop `ZagLoadLevel`, the `load_level` request param in `Run.php`, the `loadLevel` arg in `ZagClient::run`, and the DTO/model fields.
## Risks
- Throughput change is intentional: up to 32 parallel downloads now serialize into one — pipeline wait times will grow.
- Breaking for anything parsing zag's JSON/XML or using `--load-level` — only `web/` does, today.
- Old on-disk jobs keep working (lenient manifest/JSON parsing); automatic cleanup removes them over time.
- No cluster actions involved; pure code + docs in `zag/`, one PR.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Flatten the priority feature (load levels:
high/medium/lowclassification with per-level concurrency limits 2/8/32) so that only one job runs at a time — strict FIFO bycreated_at.Decisions (locked):
.loadfiles,[load_levels]config section,--load-levelCLI flag,loadLevelJSON/XML fields, LOAD column inzag status.service.max_concurrent_jobsremoved too (already deprecated).[load_levels]ormax_concurrent_jobsstill load fine;config validateandconfig showreport them as non-fatal warnings, and the daemon logs them once at startup.ZAG_LOAD_LEVELS_*/ZAG_SERVICE_MAX_CONCURRENT_JOBSenv vars are likewise detected, warned about, and ignored.web/is out of scope — no changes there (consequences documented at the bottom).Feature footprint
src/loadlevel.zig,src/loadclass.zig,src/job.zig(Job.load_level,Manifest.load_level)src/scheduler.zig(limits,counts[3],runningAt,setLimits,limitFor)src/config.zig(LoadLevels,[load_levels]section,ZAG_LOAD_LEVELS_*env, validation,problems()),src/defaults/zag.conf,src/defaults/*.load,src/defaults.zigsrc/cli_jobs.zig(--load-level/-lonrun, LOAD column instatus),src/cli_admin.zig(config show/install, autocompletion, service-start wiring),src/cli.zig(help test)src/service.zig(loadLevelpayload,Options.classifier,reload→setLimits)src/jobjson.zig(loadLevelJSON field),src/output.zig(<load_level>XML)src/repository.zig(CreateOptions.load_level, manifest.jsonloadLevel)README.md,AGENTS.md,test/e2e.sh, unit testsImplementation plan
Phase 1 — Scheduler: strict single-job FIFO (
src/scheduler.zig)Options.limits,counts[3],runningAt(),setLimits(),limitFor();Activeloseslevel.active.count() >= 1 → AtCapacity. Everything else (scheduler file lock, tick loop,stop(),killAll,killJob, retry-at skip, FIFO-by-created_at) stays.Phase 2 — Job model & persistence
src/job.zig: dropload_levelfromJobandManifest.src/repository.zig: dropCreateOptions.load_level; manifest writer dropsloadLevel; reader tolerates old manifests (unknown fields already ignored).src/jobjson.zig: droploadLevelfromwriteJobandRawJob(old JSON still parses; JSON field order shifts — note in docs).src/output.zig: drop<load_level>XML element + update the XML-shape test.Phase 3 — Config surface (
src/config.zig,src/defaults/)LoadLevels; removeload_levelsfromConfig,validate(),fromDoc(),known_sections,checkSection/problems(), and both env-section aliases (load_levels/loadlevels). Removemax_concurrent_jobsfield + its validation entry.Problemgains adeprecated: bool(or a separate warnings list);problems()special-cases sectionload_levelsand keyservice.max_concurrent_jobs→ warning: "deprecated: only one job runs at a time; remove it from your config" instead of "Unknown section/key".config.load()gains an optional diagnostics-out (sameDiagnosticpattern already used): when a loaded file contains either, it records a warning. Callers: daemon startup logs it once (std.log.warn);config validateprints it but does not fail (exit 1 stays reserved for real errors);config showprints a warning line above the effective config.applyEnvironment()special-casesZAG_LOAD_LEVELS_*/ZAG_LOADLEVELS_*/ZAG_SERVICE_MAX_CONCURRENT_JOBS→ warning + ignore instead of silent no-match.src/defaults/zag.conf: delete[load_levels]section + the deprecatedmax_concurrent_jobscomment.src/defaults/{high,medium,low}.load, their entries insrc/defaults.zig(files=zag.confonly), and deletesrc/loadlevel.zig,src/loadclass.zig+ theirsrc/root.zigexports.Phase 4 — CLI & output
src/cli_jobs.zig: drop--load-level/-l(opts + usage +run_jobIPC payload +runOfflineclassifier); remove LOAD column fromprintStatusTable.src/cli_admin.zig:configNode/cmdConfigShowlose[load_levels](plus the new deprecation warning line);config installinstalls onlyzag.conf(usage text updated); autocompletion drops the-l|--load-levelcase and the flag fromrunopts; service-start wiring (~line 129) no longer builds aClassifier.src/cli.zig: help test now asserts--load-levelis absent fromrun --help.Phase 5 — IPC/daemon (
src/service.zig)Options: deleteclassifier;schedulerOptions: delete.limits.hRunJob: deleteloadLevelparsing/validation (old clients sending the field are simply ignored — protocol stays backward-compatible).reload(): deletesetLimitscall. Delete the "load level is auto-classified or overridden" test; drop.load_levelsfrom the harness config.Phase 6 — Tests & e2e
configdefaults/embedded/env/validate/problems;repositorymanifest round-trip;jobjsonlayout;outputXML).configtests: doc with[load_levels]→problems()returns 1 deprecation,cmdConfigValidateexits 0; same for themax_concurrent_jobskey andZAG_LOAD_LEVELS_MAX_HIGH_JOBSenv.test/e2e.sh:config show --defaultsno longer assertsmax_high_jobs = 2(assert it is absent);install --showassertszag.conf, nothigh.load;[load_levels]→config validateexits 0 and prints the deprecation note;sleepjobs via IPC → second staysQUEUEDwhile first isRUNNING, both finish in FIFO order.Phase 7 — Docs
README.md: delete the "Load Levels" section, theload_leveltable row, and the--load-leveloverride paragraph; fix "Migration from barn" (env exampleZAG_LOAD_LEVELS_MAX_HIGH_JOBS works, the.load-lists bullet, theconfig showbullet) and add explicit deviation notes: one job runs at a time, no load levels /loadLevelfield, deprecated sections accepted-but-ignored with a warning.AGENTS.md: drop theloadlevel.zig/loadclass.ziglayout rows, update thedefaultsrow, note the intentional barn deviation.Phase 8 — Verify
zig fmt --check,zig build test,zig build e2e, release cross-compile (per CI).config install --show,config show --defaults,config validateon an old conf (exit 0 + deprecation note), daemon start with an old conf (one warning line), two sequentialzag runcalls serialize.Consequences for
web/(out of scope — no changes made)ZagJobDTO:loadLevel ?? 'MEDIUM'→ synced jobs will always appearMEDIUM(harmless).load_levelin the web UI,ZagClient::runappends--load-level=…and the new zag exits 2 → that job fails to start.ZagJobmodel'sload_levelcolumn stops being meaningful.ZagLoadLevel, theload_levelrequest param inRun.php, theloadLevelarg inZagClient::run, and the DTO/model fields.Risks
--load-level— onlyweb/does, today.zag/, one PR.