Commit Graph
348 Commits
Author SHA1 Message Date
oqyude 1799cd3bc2 docs(agent): T59 + ADR-0008 — PowerShell в системные пакеты sapphira
T59 фиксирует задачу владельца 2026-10-27 и её проверки: pwsh 7.6.6 в
systemPackages только у sapphira (otreca/atoridu/rydiwo/wsl — 0), сборка
nixos-rebuild build --flake .#sapphira успешна, .ci/checks.sh --no-build
PASS 4 / FAIL 0.

ADR-0008 объясняет границу выбора: configurations/server.nix (тело модуля
ровно одной записи реестра) вместо modules/essentials/packages.nix (общий
список всех NixOS-хостов, замыкание powershell — 300.2 МиБ), и почему
powershell в lib/ci-tools.nix при этом остаётся (PATH джобы раннера ≠
системный PATH). Отдельно зафиксировано, что правка НЕ развёрнута: бинарь
появится только после nixos-rebuild switch|boot.
2026-10-27 02:35:48 +03:00
oqyude 24c282b255 feat(sapphira): pkgs.powershell в systemPackages — ps1-тесты директора исполняемы на хосте
Без pwsh в системном PATH ps1-реализация metaagent-director (director.ps1
и её тесты) на sapphira всегда уходит в skip и проверяется только чтением.

Место — configurations/server.nix (тело модуля ровно одной записи реестра,
sapphira), а не modules/essentials/packages.nix: тот список общий для всех
NixOS-хостов флейка, включая 1-vCPU vds otreca, а замыкание powershell —
300 МиБ. Остальные хосты не меняются (проверено nix eval по всем).
2026-10-27 01:44:58 +03:00
oqyude ab01bfecc1 docs(adr-0007): развёрнуто на sapphira и otreca, ядро 26.10.21, REALITY проверен владельцем
nixos flake checks / invariant-checks (push) Successful in 1m30s
test-runner / smoke (push) Successful in 1s
2026-10-27 01:31:24 +03:00
oqyude 7faf942962 Merge agent/3xui-311: 3x-ui pinned v3.11.0 (xray 26.10.21), ADR-0007 2026-10-27 00:29:59 +03:00
oqyude fd776bfc20 chore(opencode): default model -> opencode-go/deepseek-v4.1-flash
nixos flake checks / invariant-checks (push) Successful in 1m38s
test-runner / smoke (push) Successful in 0s
The MINIMAX Token Plan keeps its own ceiling, invisible to the director's
quota probe: on 2026-10-26 every sub-agent died on spawn with
"Token Plan usage limit reached (2056)" while the probe for the same
provider reported decision=ok. The director already mints its worker
sessions on opencode-go/deepseek-v4.1-flash (state/quota.json
provider_selection), so this makes agents, workers and the gate share one
provider and one budget.

modelFast drives all five slim agents and the global default model, so the
whole set moves together. Build-verified: nixos-rebuild build --flake
.#sapphira -> rc=0. Not activated: switch restarts opencode-web, where the
sessions doing the deploy live.
2026-10-26 16:09:42 +03:00
oqyude a4ee09dca0 3x-ui: pin image v3.11.0 (xray 26.10.21), ADR-0007
Бандл v3.10.2 тянул ядро Xray 26.10.10, которое апстрим отозвал:
release notes v3.11.0 говорят «the pulled v26.10.10 binary pins are
replaced». Пин остаётся явным тегом (R1.5) — :latest не возвращается.

- modules/containers/3x-ui.nix: v3.10.2 -> v3.11.0, история инцидента в
  комментарии сохранена и дополнена.
- .agent/decisions/0007-3x-ui-3.11.0.md: контекст, решение, последствия
  (REALITY: fp in {chrome,firefox,safari}, minClientVer 1.0.0, R1.16),
  риски, откат через бэкап тома db/ (миграции БД необратимы), чеклист
  после rebuild. index.json: запись 0007.
- AGENTS.md, project-rules.md (R1.5/R1.8), project-state.md,
  manifest.md (T43/T44), .ci/checks.sh: фактические упоминания версии и
  номера строки (:62 -> :71). Хроника notes/3x-ui-xray-26.9.md не
  переписана, добавлена ссылка на 0007.
2026-10-25 23:42:09 +03:00
oqyude 9890786136 docs(agent): nix-checks CI verified (run 144, success ~97s)
nixos flake checks / invariant-checks (push) Successful in 1m13s
test-runner / smoke (push) Successful in 0s
After the runs-on: native fix the workflow finally executes: run 141 was
cancelled by the concurrency group, run 144 on 3c1269b succeeded in ~97
seconds with checks.sh --no-build plus the sapphira drvPath evaluation.
2026-10-25 02:29:03 +03:00
oqyude 3c1269b107 docs(agent): record the real CI blocker (runner label)
test-runner / smoke (push) Successful in 1s
nixos flake checks / invariant-checks (push) Successful in 1m27s
nix-checks.yml asked for ubuntu-latest while the only runner advertises the
single label 'native'; it therefore never produced a run. After switching to
runs-on: native, Gitea created run 141 for nix-checks.yml. Update T39 notes
and the checks/CI docs; use eval drvPath wording (not a build).
2026-10-25 02:26:59 +03:00
oqyude 1c11079833 ci: actually schedule nix-checks on the host runner
nixos flake checks / invariant-checks (push) Canceled after 47s
test-runner / smoke (push) Successful in 1s
The workflow could never run: it asked for 'runs-on: ubuntu-latest', but the
only runner (gitea-runner-ci-sapphira) advertises exactly one label, 'native'
(host executor). test-runner.yml used 'native' and runs; nix-checks never
produced a single run.

- runs-on: native
- drop cachix/install-nix-action and 'nix profile install sops': the host
  profile already provides nix, sops, git and python3
- evaluate sapphira with 'nix eval --raw ...toplevel.drvPath' instead of
  'nix build --dry-run': the runner user is not a Nix trusted user, so a
  dry-run build would want store write access; evaluation is the actual gate
- timeout 15 min, concurrency cancel-in-progress
2026-10-25 02:26:20 +03:00
oqyude 61c5f01b4b ci: evaluate only sapphira on the self-hosted runner
test-runner / smoke (push) Successful in 1s
nixos flake checks / invariant-checks (push) Canceled after 0s
The only runner is gitea-runner-ci-sapphira, running on the same 2-core /
5.6 GiB host as ~20 production services. Evaluating all seven configurations
took 40+ minutes and pushed the host into swap.

- checks.sh is invoked with --no-build, so check #2 (full nix flake check,
  every host) no longer runs in push CI
- only .#nixosConfigurations.sapphira is evaluated: a broken sapphira is an
  immediate CI-runner outage; other hosts are verified explicitly per change
- workflow_dispatch added, timeout 45 -> 20 min, and concurrency group
  cancels superseded runs instead of queueing them on the same host

Docs: AGENTS checks section, project-state test-runner row, T39 notes.
2026-10-25 02:23:56 +03:00
oqyude b7bce546b6 chore(agent): record the sapphira activation (generation 859)
test-runner / smoke (push) Successful in 2s
nixos flake checks / invariant-checks (push) Canceled after 0s
Live state after switch: guard condition present on 13/13 units under [Unit],
phantom samba/nextcloud/immich units gone, nginx serves lamet with upstream
100.106.21.39:4096 (6061 no longer answers). systemctl --failed is empty.
2026-10-25 02:21:40 +03:00
oqyude 5f3131ea3e chore(agent): close T3/T20/T38/T57 and sync metadata with the tree
test-runner / smoke (push) Successful in 1s
nixos flake checks / invariant-checks (push) Canceled after 0s
- T3: premise refuted by a runtime 'nft list ruleset' on otreca - 'inet nixos-fw'
  already has 'policy drop'; the hand-written 'inet filter' only rate-limits SYN
  and must NOT get a drop (it would blackhole the VDS). AGENTS invariant 6 and
  the traps table updated; T3-A proposal marked withdrawn. No code change.
- T38: herdr_web_token rotated (old -> 401, new -> 200); literal removed from
  manifest.json (token -> secret_ref). Old token in git history is now invalid.
- T20: completed (100755, bash invocation, .gitea workflow).
- T57: T38-T57 registered in manifest.json, schemas aligned with the real
  format, dangling request.json $schema resolved, new dependency-free
  validator wired as check #9.
- T4/T52: completed; invariant 2, R1.2, ADR-0004 and project-state updated;
  checkpoints.phases.execution -> completed, handoff -> in_progress.
- T58 filed: triple 'allowedUDPPorts = [ 53 ]' duplicate.

AGENTS.md also carries the .omo trap-row update from the parallel opencode
session (commit 8079536), which was left uncommitted in the shared tree.
2026-10-25 02:10:18 +03:00
oqyude 066b3acec1 refactor(nix): consolidate fragmented attribute-path writes
Same owner written as '.a = ...; .b = ...;' repeated dotted paths is now one
attrset block. Behaviour-preserving (values, list order and comments kept):

- 3xui-reconfig description/serviceConfig in server/ and vds/ (separate units,
  different PANEL_URL - deliberately not extracted into a shared module)
- authelia after/wants inside the existing config = mkIf wrapper
- gitea-actions-runner settings: runner/metrics/health_check/container
- boot.loader.grub, services.logind, pxe-infra.bridge, pipewire.alsa
- nix.{distributedBuilds,buildMachines}; nix.settings on WSL (mkForce kept)
- build.activation on termux (nix-on-droid freeform)

Also in this commit: lamet.opencodes.zeroq.su upstream 6061 -> 4096
(verified by nix eval of the vhost proxyPass).

nix-instantiate --parse: 12/12 files OK.
2026-10-25 02:10:05 +03:00
oqyude 69691f96d1 fix(systemd): move the storage guard into [Unit] (T4/T52)
mkStorageGuard returned a serviceConfig fragment, so ConditionPathIsMountPoint
landed in [Service] where systemd ignores it - the guard was dead on 13 units.

- helper now returns a unitConfig fragment ([Unit]); RequiresMountsFor still
  intentionally absent
- consumers re-pointed at the real unit names: samba-smbd, phpfpm-nextcloud,
  immich-server, podman-3xui_app, podman-taperotation-{backend,frontend};
  the old serviceConfig keys silently rendered three empty phantom units
- vds excluded: otreca has no /home/oqyude/External and a live condition would
  skip podman-3xui_app and kill the 3x-ui panel at pubray1.zeroq.su

Verified: sapphira and otreca toplevel builds exit 0; all 13 units carry the
condition under [Unit] (line 3), zero occurrences under [Service].
2026-10-25 02:09:40 +03:00
oqyude 8079536db2 chore(opencode): drop legacy oh-my-openagent config 2026-10-25 00:42:17 +03:00
oqyude fb2efcecc4 Merge branch 'update' into dev — nix flake update (ревизии уже в dev, добавлен nixpkgs-master)
test-runner / smoke (push) Successful in 1s
nixos flake checks / invariant-checks (push) Canceled after 0s
2026-10-24 17:06:29 +03:00
oqyude 96431cc32b docs(agent): record the outcome of the tech-debt session (T38-T48, T46)
test-runner / smoke (push) Successful in 1s
nixos flake checks / invariant-checks (push) Canceled after 0s
Metastate only — no code touched. Brings the three state files in line with
what actually landed between f484a89 and 1adf6dd.

.agent/tasks/manifest.md
  Overview table now carries the real status per task: 10 done, 10 blocked.
  T38 is marked partial (handoff-summary.md cleaned, manifest.json:412 is
  outside this session's mandate). T47/T49/T56 are re-classified from
  "pending" to "blocked" because doing them needs home-manager merge
  semantics confirmed and there is no nix binary on this machine.
  Adds a section for a finding that was not in the plan: HEAD contained
  invalid Nix — modules/server/default.nix:79 and modules/vds/default.nix:40
  called `config.modules."3x-ui".reconfig` without declaring `config` in the
  module arguments, so sapphira and otreca should not have evaluated. Fixed
  in 39e1887. That is independent proof that `nix flake check` never ran.

.agent/context/project-state.md
  "What's next" becomes "what was done", with the commit for each item.
  Testing status updated: 4 checks now (the import-graph one was added), and
  the "never ran" claim is scoped to the pre-2026-10-24 state since T39 fixed
  all three defects. modules/options.nix row updated — it is 81 lines now,
  with modules/pxe-infra/options.nix added.

.agent/handoff-summary.md
  Entry point gains the commit table, the parallel-session collision note
  (two commits were absorbed by the other session: 95a4f92 for T40 and
  39e1887 for T42, plus 2991164 swallowing my staged deletions), and a
  next-action list that is addressed to the owner rather than the next agent.

Not pushed.
2026-10-24 02:36:36 +03:00
oqyude 1adf6dd90c refactor(pxe-infra): move the pxe-infra option surface next to the feature (T46)
modules/options.nix was 433 lines, of which 351 (80%) were the
`options.pxe-infra` block. That file is documented as the home of
cross-module options, but the pxe-infra surface belongs to one feature that
already owns a directory of eight modules.

modules/pxe-infra/default.nix had already made this call for the sibling
option and said so at :26-33: "Declared here (not in modules/options.nix)
because this task's scope is modules/pxe-infra/ only". This commit applies the
same rule to the rest of the surface, which also removes the split where
`pxe-infra.bootloader` lived in one file and
`pxe-infra.bootloader.bypassFallback` in another.

The moved block is byte-identical — md5 e672a94dd9676cff1e3dd5096499232c for
both the old range (modules/options.nix:82-432) and the new
(modules/pxe-infra/options.nix:15-365), 351 lines. modules/options.nix is now
81 lines and holds only `host.builder` and `host."3x-ui"`, plus a pointer to
where feature-local options live.

Behaviour is preserved:
  - the declared option set is unchanged: still exactly
    `options.pxe-infra` and `options.pxe-infra.bootloader.bypassFallback`;
  - `modules/pxe-infra/default.nix` imports ./options.nix, so the option
    exists on every host that imports the umbrella;
  - the only place outside modules/pxe-infra/ that touches it is
    configurations/mini-laptop.nix:88, and that host imports
    ../modules/pxe-infra at :17. No other host reads config.pxe-infra.

Verified: import-graph green (120 files, 120 references), checks PASS 3 /
FAIL 0.

Not verified here: `nix flake check`. There is no nix binary on this machine,
so evaluation must be confirmed by the owner before this is deployed.

Not pushed.
2026-10-24 02:33:22 +03:00
oqyude 2ed525b9f5 chore: anchor the scripts ignore rule and keep the guard verifier (T48)
test-runner / smoke (push) Successful in 0s
nixos flake checks / invariant-checks (push) Canceled after 0s
.gitignore had `scripts` as an unanchored pattern. A pattern without a slash
matches a directory of that name at ANY depth, so a future
modules/*/scripts/ would have been silently ignored — the kind of thing that
only shows up as "why is my file not in git". It is anchored to /scripts/
now. No tracked file was matched before or after (verified with
`git ls-files | git check-ignore --stdin --no-index`, empty both ways).

The 22 scripts in .temp/ are not committed wholesale: they are eight
iterations of one T4 test (t4-final-v5..v8), three of another
(t4-live-test{,v2,v3}), plus one-shot deploy/cleanup/diagnose scripts that
hardcode `cd /mnt/s/Git/nixos` and perform umount / mount --move. Committing
them would be noise, not knowledge.

One of them is reusable and non-destructive, so it is preserved:
.ci/verify/guard-non-destructive-verify.sh. It creates two throwaway systemd
units (ConditionPathIsMountPoint=/nonexistent must refuse to start,
=/mnt/services must start) and resets them, so it can be run against a live
host to prove the condition is evaluated at all. That is the check the owner
needs for T52. Content is byte-identical to the .temp original
(md5 b0ac8081aae568a3db921fb64f4c0a05) and passes shellcheck -S error.

Not pushed.
2026-10-24 02:28:32 +03:00
oqyude 0d52f2058d refactor(modules): drop the duplicated WSL nix-serve module (T45)
modules/wsl/nix-serve.nix was a byte-identical copy of
modules/server/nix-serve.nix — md5 0aca1128f12f975d2376db21fbd92e40 for both.
Two live hosts, two copies of the same 25 lines: any fix to one silently
missed the other.

The WSL module now imports ../server/nix-serve.nix.

Equivalence is established by content, not by a run: the module body is
identical, and its `sopsFile = ./secrets/nix-serve.yaml` resolves relative to
the importing file — so WSL now reads
modules/server/secrets/nix-serve.yaml, which is itself byte-identical to the
copy it used to read (md5 af6e04419e8b3dd467c8cb693f374782 for both). The
evaluated configuration is therefore unchanged; only the paths differ.

`services.nix-serve` is now declared by exactly one file in the repo.

Verified: import-graph check green (119 .nix files, 119 references), and
`bash .ci/checks.sh --no-build` -> PASS 3 / FAIL 0.

Note: modules/wsl/secrets/nix-serve.yaml is now unreferenced. It is NOT
deleted here — secrets need explicit owner sign-off, see
.agent/tasks/manifest.md T53.

Not pushed.
2026-10-24 02:25:38 +03:00
oqyude 8c864667dd docs(agents): point every AGENTS.md reference at a file that exists (T44)
AGENTS.md is the one file an agent always reads, so a wrong path there sends
the next reader somewhere that does not exist. Eleven references were stale:

  :78   modules/server/nginx.nix:109,253  -> :109 and :378
        (253 is inside the herdr forward-auth block, not a Tailscale bind)
  :97   server.nix:130        -> configurations/server.nix:129
  :100  3x-ui.nix:54          -> modules/containers/3x-ui.nix:62
        (the file `modules/3x-ui.nix` does not exist; modules/3x-ui/ holds
         only default.nix, which declares the reconfig option)
  :101  3x-ui.nix:33-35       -> modules/containers/3x-ui.nix:35
  :104  server/default.nix:7-44, comment 38-41
        -> :9-50, comment 43-49
  :105  opencode.nix:354      -> home/modules/opencode.nix:449
  :98   mobile.nix / wsl.nix  -> configurations/mobile.nix / configurations/wsl.nix
  :99   users.nix:66          -> modules/users.nix:66
  :109  vds.nix:73-91         -> configurations/vds.nix:71-92
  :111  server.nix:61-63      -> configurations/server.nix:61-63
  :123  users.nix:99          -> modules/users.nix:99

The bare names in the trap table were ambiguous: `server.nix` could mean
configurations/server.nix or modules/server/default.nix. They now carry their
directory.

Verified with a one-off scan: all 16 `path:line` references in AGENTS.md now
resolve to an existing file with at least that many lines. Documentation only
— no .nix file is touched, so nothing can change evaluation.

Not pushed.
2026-10-24 02:23:21 +03:00
oqyude 3fb1f3ca6e fix(ci): drop the stale 3x-ui whitelist entry and the wrong helper name (T43)
Check #1 allows `:latest` images listed in LATEST_ALLOWLIST. The list still
carried `ghcr.io/mhsanaei/3x-ui:latest` with the comment "panel frozen on
:latest", but the panel has been pinned to `ghcr.io/mhsanaei/3x-ui:v3.10.2`
since 2026-10-20 (modules/containers/3x-ui.nix:62, R1.5). The entry matched
nothing, and the comment stated the opposite of the invariant it cited.

Consequence of the stale entry: if someone reverted the pin to `:latest`, the
check would have stayed green and said nothing. Verified by mutation — with
v3.10.2 temporarily replaced by :latest the check now reports
"Images using :latest (not in whitelist): ghcr.io/mhsanaei/3x-ui:latest";
before this commit the same mutation passed silently.

Also: check #4's description named `mkServiceStorage`, while the guard the
consumers actually call is `mkStorageGuard` (lib/xlib/helpers.nix:180). Both
names exist in that file and mean different things, so the comment pointed at
the wrong helper. Now it names the right one and says so explicitly.

`bash .ci/checks.sh --no-build` -> PASS 3 / FAIL 0, before and after; the
current tree contains exactly two `:latest` images, both tape-rotation, both
still whitelisted.

Not pushed.
2026-10-24 02:19:39 +03:00
oqyude 39e1887d78 docs(modules): уточнить пути и счётчики в комментариях
test-runner / smoke (push) Successful in 1s
nixos flake checks / invariant-checks (push) Canceled after 0s
- xlib: mkXlib из lib/xlib/default.nix (было lib/xlib.nix);
- архив: ../../archive/ от modules/server, 12+3 модуля;
- убраны устаревшие номера строк в ссылке на T16.

Проверки: PASS 3, FAIL 0; граф импортов 120 файлов, 119 ссылок.
2026-10-24 02:17:25 +03:00
oqyude 13e90d06b5 chore(modules): delete 12 unreferenced modules (T41)
None of these are reachable from any import, so removing them cannot change
evaluation. Verified with the import-graph check added in 1b188fb, which is
green before and after (132 -> 120 .nix files, 119 references resolve), and
with an exact import-shaped grep for each path (zero hits outside archive/).

Deleted:
  modules/other/{daw,musnix,virtual,wine}.nix
  modules/other/gaming/{aagl,nix-gaming}.nix
  modules/other/self/fingerprint.nix
      modules/default.nix only imports ./<device-type>, and `other` is not a
      device type (lib/xlib/device.nix:12-41). Four of these also import flake
      inputs that are commented out in flake.nix (:8 fingerprint, :102
      nix-gaming, :103 aagl, :110 musnix), so they could not even evaluate.
  modules/server/requirements.nix
      Orphaned copy of a subset of the pins that modules/server/engipy-backend.nix
      embeds inline at :46-67. The two lists had already diverged: the orphan
      had 14 entries, the live one has 20+ (structlog, pandas, openpyxl,
      python-multipart, python-dotenv were missing from the orphan).
  modules/containers/remnanode.nix
      tmpfiles-only; its three rules duplicate modules that are imported.
  modules/containers/remnawave-examples/{docker-compose-local,docker-compose-prod}.nix
      compose2nix snapshots of the abandoned remnawave stack; the real module
      is preserved in archive/containers/remnawave.nix.
  modules/vds/glances.nix
      Byte-identical to modules/server/glances.nix (md5 f0133606...), whose
      import at modules/vds/default.nix:13 was commented out.

Also drops the now-dangling `# ./glances.nix` line from modules/vds/default.nix.

Deliberately NOT deleted, because "not imported" there means "disabled on
purpose" rather than "abandoned", and git history alone would not recover the
intent:
  modules/vds/netbird.nix            (40 lines, every option `enable = false`)
  modules/wsl/tools/default.nix      (16 lines, a commented-out dev toolchain)
  home/apps/v2rayn.nix               (23 lines, pairs with a package that is
                                      still installed in home/modules/packages.nix:19)

Note: the commented-out flake inputs in flake.nix that existed only for
modules/other/ are now vestigial. Left in place — removing them also rewrites
flake.lock behaviour and needs a nix run, see .agent/tasks/manifest.md T54.

Not pushed.
2026-10-24 01:46:23 +03:00
oqyude 299116495c test(ci): проверка целостности графа импортов вынесена в скрипт
test-runner / smoke (push) Successful in 1s
nixos flake checks / invariant-checks (push) Canceled after 0s
.ci/tests/import-graph.py — проверяет, что каждый .nix ссылается только
на существующие файлы и каталоги. Раньше логика жила инлайн в
checks.sh и не была переиспользуема.

Проверки: PASS 3, FAIL 0.
2026-10-24 01:45:59 +03:00
oqyude 1b188fbdb5 test(ci): add an import-graph check, green on the current tree (T41 net)
Nothing in this repo verifies that an import actually resolves. That matters
here more than usual: several modules are referenced only through
commented-out import lines, and 15 .nix files sit outside the import graph
entirely, so a stale reference is invisible until someone uncomments it or
nix evaluation happens to touch that file.

The check is deliberately narrow: it matches only two import shapes — a line
whose whole content (after an optional `#`) is a relative path, and
`import ../foo` / single-line `imports = [ ./a ./b ]`. Prose and shell-script
bodies are not matched, and anything containing `${...}` is skipped because it
cannot be resolved statically. Commented-out import lines ARE matched on
purpose: a comment naming a deleted file still misleads the next reader.

Baseline on the current tree: 132 .nix files, 120 import references, all
resolve. Wired in as check #8 of .ci/checks.sh; skips when python3 is absent.

`bash .ci/checks.sh --no-build` → PASS 3 / FAIL 0.

Not pushed.
2026-10-24 01:44:27 +03:00
oqyude 262b966b1e regress need to be reversed
test-runner / smoke (push) Successful in 1s
nixos flake checks / invariant-checks (push) Canceled after 0s
2026-10-24 01:40:02 +03:00
oqyude 95a4f92075 fix(ci): проверка sops должна обходить все secrets/, а не только корневой
test-runner / smoke (push) Successful in 1s
nixos flake checks / invariant-checks (push) Canceled after 0s
Проверка #7 искала файлы только в secrets/ и не замечала вложенные
каталоги: modules/server/secrets/, modules/containers/secrets/,
modules/essentials/secrets/, modules/wsl/secrets/.

Теперь обходятся все файлы под */secrets/*, а совпадения, требующие
непривязанного правила (поведение sops для вложенных каталогов),
перечисляются отдельно — предположение видно, а не спрятано.

PASS: 2  FAIL: 0; 13 файлов помечены как требующие непривязанного
правила.
2026-10-23 20:23:33 +03:00
oqyude 029725499c fix(ci): move the checks workflow to .gitea/workflows and let it fail (T39c)
test-runner / smoke (push) Successful in 0s
nixos flake checks / invariant-checks (push) Canceled after 0s
Two independent reasons why the CI never ran a single check:

1. The workflow lived under .github/workflows/, but the only remote of this
   repo is gitea@git.zeroq.su — there is no GitHub remote, so GitHub Actions
   never saw it. Gitea Actions reads .gitea/workflows/ in preference to
   .github/workflows/, and .gitea/workflows/ already contained
   test-runner.yml, which does not call .ci/checks.sh. The file is moved
   with `git mv` so history follows it.

2. Every step of the job ended in `|| true` and used `--dry-run`, so even
   if it had run, the job could never go red. The `|| true` is dropped:
   the step now fails the job when a host configuration fails to evaluate.
   `--dry-run` is kept on purpose — the value of this step is evaluation,
   not building — and `--no-link` keeps the workspace free of `result`
   symlinks.

Also: the `default` (minimal) configuration was missing from the list and is
now evaluated; epral is evaluated with `nix eval` (cheap, and it is an
aarch64 target that cannot be built on the x86_64 runner); `nix-env -iA` is
replaced by the supported `nix profile install`; a job timeout is added so a
hung evaluation cannot hold the runner.

The check script is invoked through `bash`, so the step no longer depends on
the file mode (see ca450f1 and db3cbd0).

Not pushed.
2026-10-23 12:56:47 +03:00
oqyude db3cbd023a fix(ci): invoke .ci/checks.sh through bash in the pre-commit hook (T39b)
pre-commit's `language: script` execs the entry directly, without a shell.
Running the script through `bash` removes the dependency on the file mode
entirely, so the hook keeps working in checkouts made with core.fileMode
=false, from a tarball, or on a filesystem that does not preserve the
executable bit.

The previous commit (ca450f1) sets the mode to 100755 as well; both are
kept because they fail independently.

Not pushed.
2026-10-23 12:56:10 +03:00
oqyude ca450f1332 fix(ci): mark .ci/checks.sh executable (T39a)
The script has a shebang and its own usage header documents `./.ci/checks.sh`,
but git tracked it as mode 100644. Both call sites exec it directly:

  .pre-commit-config.yaml:10        entry: .ci/checks.sh --no-build
  .github/workflows/nix-checks.yml:20  run: .ci/checks.sh

so both failed with "Permission denied" before running a single check. This
was already tracked as T20 in .agent/tasks/manifest.json.

core.fileMode is false in this checkout, which is why the on-disk permission
never made it into the index. `git update-index --chmod=+x` sets the mode in
the index explicitly, regardless of core.fileMode.

Mode-only change: no content of the script is touched.

Not pushed.
2026-10-23 12:55:52 +03:00
oqyude d76cbc3ff2 fix(agent): remove committed herdr_web_token literal (T38)
The live 256-bit herdr_web_token was committed in cleartext. This repo only has
a gitea remote and the token is the sole gate for herdr.zeroq.su (vhost
without authelia — R1.15 / ADR-0005), so a leaked literal is a real exposure.

The identical 64-hex literal lived in two files. Only .agent/handoff-summary.md
is in scope for this session (.agent/tasks/manifest.json:412 is off-limits by
the session constraints), so this commit removes it from the reachable file
and documents the remainder explicitly.

The value is still in git history, so removing it from the tree is not enough:
the token must be rotated on the host. Left as an open item — see
.agent/tasks/manifest.md T38 and the note added next to the redacted token.

Not pushed.
2026-10-23 12:55:07 +03:00
oqyude f484a89226 docs(agent): fix metastate — register tech-debt audit tasks T38–T57
A read-only audit of the whole repo (233 tracked files, 147 .nix) surfaced 20
tech-debt items across structure, duplication, doc drift, fragility, test
coverage and junk. This commit records the metastate only — no code is touched.

.agent/tasks/manifest.md — NEW. Human-readable register of the T38+ series
(20 items: 11 pending, 9 blocked); each with id, path:line, type
(restructuring / drift / junk / fragility), risk, benefit and "safe now or
needs a safety net". Deliberately NOT a copy of manifest.json: that file was
deleted on 2026-10-15 precisely because it was a duplicate, so it stays the
machine source of truth for T1–T37. PROTOCOLS/07_HANDOFF.md:39 requires both
files to exist, so this restores the protocol without reintroducing the drift.

.agent/context/project-state.md — new session section (was / done / next) and
removal of stale claims: the 3x-ui panel is pinned to v3.10.2 (not :latest),
T18 is committed, ADR-0003/0005/0006 exist, CI status is "never ran once",
192.168.1.20 occurs 42 times, nginx.nix:253 -> :378.

.agent/handoff-summary.md — new entry point at the top for the next agent,
pending count 8 -> 9 (T37 was missing), manifest.json described as T1–T37.

Not pushed.
2026-10-23 12:53:50 +03:00
oqyude af12e286c0 feat(3x-ui): вынести панель в отдельный модуль и подключить на сервере и VDS
test-runner / smoke (push) Successful in 1s
- modules/3x-ui/: новый модуль вместо правок внутри modules/containers/
- modules/server/default.nix и modules/vds/default.nix: подключение модуля
2026-10-23 00:30:01 +03:00
opencode 69fd72b602 chore(pxe-infra): drop the diagnostic autoexec.ipxe (T24 RCA done)
test-runner / smoke (push) Successful in 0s
The diagnostic (ifstat/route/ping) is what identified the closed
interface behind the 'Network unreachable' chain failure; the root cause
is fixed in vm.nix (e1000), so the rig goes back to a plain chain.
2026-10-21 21:08:22 +03:00
opencode 33bc04e6ef fix(pxe-infra): move the e1000 rationale out of the continued qemu command
test-runner / smoke (push) Successful in 1s
A '#' comment inside a backslash-continued shell command is not a
comment: the shell swallowed the rest of the script, so qemu started
without the -device line ('netdev net0 has no peer'). The rationale now
sits above the exec.
2026-10-21 21:03:03 +03:00
opencode 456236792f fix(pxe-infra): give the rig guest an e1000 NIC instead of virtio-net (T24)
test-runner / smoke (push) Successful in 1s
With virtio-net the guest's OVMF claims the device with its own
virtio-net driver and exposes no SNP handle, so iPXE falls back to its
own virtio-net driver and cannot open the device the firmware already
holds. The interface stays closed, the routes are marked inaccessible
and every HTTP fetch fails with 'Network unreachable' - the chain dies
before the payload is even fetched.

Measured on rydiwo 2026-10-21 with the diagnostic autoexec.ipxe:

  virtio-net-pci: net0: ... using virtio-net ... [closed]
                   route: net0: 10.66.0.10/255.255.255.0 gw 10.66.0.1 (inaccessible)
                   ping: timeout ; http://10.66.0.1/boot.ipxe... Network unreachable

  e1000:           net0: ... using 82540em ... [open]
                   route: net0: 10.66.0.10/255.255.255.0 gw 10.66.0.1
                   ping: replies ; boot.ipxe / vmlinuz-virt / initramfs-virt all ok

The guest kernel is unaffected: linux-virt ships e1000.ko and the
read-only payload loads it from the rootfs.
2026-10-21 20:59:16 +03:00
opencode a49916549f diag(pxe-infra): print iPXE network state in autoexec (T24 diagnosis)
test-runner / smoke (push) Successful in 1s
2026-10-21 20:55:06 +03:00
opencode 46cac7acf2 config(rydiwo): run the pxe-infra guest in bootMode=pxe (T24)
test-runner / smoke (push) Successful in 1s
The read-only payload boots over the network: iPXE loads the kernel and
the initramfs over HTTP, and the initramfs carries the squashfs rootfs
inside itself - no disk, no root UUID, no SAN-boot dependency.

 (attach alpine-worker.raw and boot from disk) stays available
as the legacy disk profile.
2026-10-21 18:12:07 +03:00
opencode 0c4139cd1f feat(pxe-infra): chain the read-only payload (kernel+initrd) instead of sanboot (T24)
test-runner / smoke (push) Successful in 0s
The worker payload is now a read-only squashfs rootfs carried INSIDE the
initramfs (build/alpine-worker/build-squashfs.sh), so the guest needs no
disk and no root UUID.

boot.ipxe therefore loads vmlinuz-virt + initramfs-virt over HTTP and
boots them; the initramfs attaches the embedded squashfs read-only and
switch_roots into the worker system.

This drops iPXE's SAN-boot extension from the production chain - the
dependency behind T14 (the 6.18.57 PCI-match regression) and risk R1
(SAN under ESXi EFI, never verified). The disk profile and its sanboot
chain stay reachable through boot-bypass.ipxe as the legacy path.

bootMode=pxe already attached no disk (vm.nix), so no change there.
2026-10-21 18:09:51 +03:00
oqyude 5a7db9fd36 fix(opencode): глобальный model в opencode.json, чтобы агенты slim-плагина не сбивались на free-тариф
test-runner / smoke (push) Successful in 0s
В v2 без явного выбора CLI берёт модель из реестра сам
(opencode/minimax-m3.1-flash-free) и передаёт её явно — она перебивает
модель агента, заданную oh-my-opencode-slim. Проверено по сообщению в БД:
без фикса запрос шёл на бесплатной модели. Рабочая машина обходится за счёт
«помни последний использованный» в TUI, серверная БД пустая.
2026-10-21 17:09:27 +03:00
oqyude 6791e6c741 docs(opencode): herdr-интеграцию не ставим, oc фильтрует --server (ADR-0006, R1.19)
test-runner / smoke (push) Successful in 0s
- herdr: установка opencode-интеграции пишет V2-регистрацию в cli.json, а он
  read-only симлинк в /nix/store ⇒ herdr отказывается («config has multiple
  hard links», не EROFS). На sapphira не установлена НИ ОДНА agent-интеграция
  herdr ⇒ интеграцию не ставим, решение владельца снято.
- oc: --server принимают не все подкоманды (run/attach/tui/api/models/agent —
  да; mcp/service/auth/serve/plugin — нет) ⇒ обёртка фильтрует по подкоманде.
- legacy ~/.omo/omo.jsonc проверен на хосте: реальные model id реестра.
- Вычищен мёртвый кэш v1 (~/.cache/opencode/packages, npm/oh-my-openagent@latest).
- T36 → completed.
2026-10-21 17:05:23 +03:00
oqyude 1323982ac3 fix(opencode): oc добавляет --server только тем подкомандам, которые его принимают
test-runner / smoke (push) Successful in 1s
v2 разбирает --server per subcommand: run/attach/tui/api/models/agent его
берут, mcp/service/auth/serve/plugin — нет ("Unrecognized flag: --server in
command opencode plugin list"). Обёртка добавляла флаг всем подряд, из-за
чего локальные команды (plugin list, auth, service) падали.

Дополнительно: если сервер на 4096 не поднят — понятная подсказка вместо
connection refused.
2026-10-21 14:42:22 +03:00
oqyude 68294e8e0b 3x-ui update
test-runner / smoke (push) Successful in 0s
2026-10-21 13:53:10 +03:00
opencode 0f372b49a6 docs(meta): T37 на перенос данных opencode на /mnt/services (XDG_DATA_HOME)
test-runner / smoke (push) Successful in 0s
Владелец 2026-10-21: перенос БД — отдельная задача, не в этой миграции.
Зафиксированы риск (мёртвый mount-guard ⇒ opencode молча создаст новую
пустую БД, если /mnt/services не смонтирован) и приёмочные критерии.
Счётчики backlog приведены в соответствие (pending 9, backlog 31).
2026-10-21 13:51:32 +03:00
opencode d98636ed6a feat(opencode): миграция sapphira на OpenCode v2 (2.0.32) из nixpkgs master
test-runner / smoke (push) Successful in 1s
v2 есть только в nixpkgs master (nixos-unstable = 1.19.0), поэтому пакет
берётся из inputs.nixpkgs-master, а конфиг пишется вручную: HM-модуль
programs.opencode — v1-only (plugin ед.ч., mcp плоской картой, tui.json,
validateFiles.tui требует отсутствующего passthru.jsonschema.tui).

- home/modules/opencode.nix: v2-конфиг (plugins/mcp.servers), cli.json,
  oh-my-opencode-slim 3.0.5 (единственный v2-совместимый плагин), --port 4096
  (дефолт serve в v2 — 4097, nginx проксирует на 4096), фон-сервис v2 выключен,
  обёртка oc (CLI к работающему юниту: пароль из sops server.env, --server
  после подкоманды), cgroup-защита в [Service], активация ставит пакет
  плагина и прогревает npx-кэш MCP
- flake.lock: nixpkgs-master -> c4f353ac
- ADR-0006 (контекст, факты, инциденты деплоя, herdr) + index.json + T36

Деплой выполнен 2026-10-21 на самой sapphira (сборка + nixos-rebuild switch),
проверено: юнит active на 0.0.0.0:4096, 10 агентов, 3 MCP connected,
LLM smoke на minimax-coding-plan/MiniMax-M3.1-Flash.

AGENTS.md и .agent/rules/project-rules.md оставлены в рабочем дереве:
там вперемешку правки 3x-ui/REALITY/WARP (чужие) — не смешивать.
2026-10-21 13:43:05 +03:00
oqyude d0df318553 feat(ci): add shellcheck to the ci tool set
test-runner / smoke (push) Successful in 0s
work/pxe-infra-automation is adding a Gitea Actions pipeline, and its
checks live in ci/check.sh: shellcheck over the build scripts AND over
the guest payload (image/*.sh, which is copied into the image verbatim),
plus a YAML validation of the workflow files.

That script exits 2 when shellcheck is missing, so on this runner —
where the job PATH is frozen into the systemd unit at activation time
and cannot gain a package without a nixos-rebuild — the linter has to
come from the ci devshell instead. shellcheck is now in lib/ci-tools.nix,
which is the single list both consumers use (the runner's hostPackages
and the devshell), so the two cannot drift apart.

PyYAML did NOT make it in: the obvious fix,
`python3.withPackages (ps: [ ps.pyyaml ])`, is not a valid buildInput
(nix rejects it with 'Dependency is not of a valid type: element N of
buildInputs'), and the devshell is the consumer that breaks. The
workflow YAML stays validated on GitHub and locally, where PyYAML is
present; the Gitea job says so in its log instead of pretending to have
checked it.

The nixos repo's own flake.lock pins nixpkgs; the pipeline uses that
revision instead of a floating nixos-unstable, because the nix registry
on sapphira is empty and 'nixpkgs#...' cannot resolve there.
2026-10-20 16:30:25 +03:00
oqyude 4940a1e287 docs(pxe-infra): correct the stale description of the latest/ path
test-runner / smoke (push) Successful in 0s
The comment said 'A latest/ symlink points at the newest <rev>'. Since
T18 the worker deploy publishes into a real latest/ directory with a
rename(2); the symlink scheme was measured to be non-atomic (GNU
mv -T on a symlink-to-directory copies instead of renaming). The
iPXE scripts address the path, not the object type, so nothing in the
behaviour changes - only the description.
2026-10-20 16:03:04 +03:00
oqyude 0d9c892b4f feat(pxe-infra): make the kernel+initrd chain boot the real rootfs (T19)
test-runner / smoke (push) Successful in 1s
Mirrors the change in pxe-infra-automation (T19). The bypass chain
loaded the kernel and the initramfs over HTTP and then failed with
"mounting /dev/ram0 on /sysroot failed" - the root filesystem is the
worker's ext4 partition, addressed by UUID, and the script pointed at a
device that does not exist. The disk was visible the whole time
(virtio_blk virtio1: [vda] 2097152); only the command line was wrong.

Now the script fetches the root UUID from the HTTP root with isset and
puts it on the kernel command line, matching the options the
systemd-boot entry uses. The image must be attached to the guest as a
local block device (EXTRA_DRIVES in direct mode); the rootfs is not
inside the initramfs.

This path does not use iPXE's sanboot, so it works on firmware without
INT13 SAN extensions - which is what makes the ESXi rig usable
regardless of risk R1.

The production chain (boot.ipxe, sanboot) is unchanged; this script is
only reached when pxe-infra.bootloader.bypassFallback.enable is set.

The UUID is published next to the image by the pxe-infra-automation
deploy script, and is written without a trailing newline because iPXE
copies the file's contents into a variable verbatim.

Not verified on hardware: the artifact has not been republished since
the change.
2026-10-20 15:48:45 +03:00
oqyude 75da0d5fbb fix(ci): devshell banner to stderr
test-runner / smoke (push) Successful in 1s
Workflow берёт PATH devshell'а из stdout команды `nix develop ... --command
bash -c 'printf %s "$PATH"'`, и баннер на stdout попадал внутрь PATH.
2026-10-20 15:14:25 +03:00