Commit Graph
22 Commits
Author SHA1 Message Date
oqyude 22d29e52ba docs: правильный синтаксис nix develop .#fmt — без лишнего --
Тест поймал: задокументированная команда гейта была сломана.

  nix develop .#fmt --command treefmt -- --fail-on-change .
  -> Error: failed to create walker: path .../--fail-on-change not found

`nix develop --command` передаёт разделитель `--` самому treefmt'у как
позиционный аргумент, и тот считает его именем каталога. Правильно:

  nix develop .#fmt --command treefmt --fail-on-change .      # exit 0
  nix develop .#fmt --command bash -c 'treefmt --fail-on-change .'  # тоже

Попутно подтверждено: полный `nix flake check` (с билдом) на этой ветке
проходит — exit 0, all checks passed, включая checks.deploy-schema и
checks.deploy-activate. И devshell .#fmt собирается: в PATH treefmt, nixfmt,
shfmt и shellcheck.
2026-11-15 23:08:17 +03:00
oqyude 129c6b0aef fix(agent): ADR-0011 перепроверен — виноват баг nix, а не пин nixpkgs
Первая редакция ADR-0011 утверждала: «на закреплённом nixpkgs nix flake check
падает на любом derivation-выводе, поэтому output'ов formatter и checks быть
не может». Перепроверка это опровергла, и ADR переписан.

Измерено (WSL, nix 2.34.9):

  formatter = pkgs.hello                    -> error: 'outPath' is not a valid system type
  formatter = hand-written derivation        -> та же ошибка (nix-internal/derivation-internal.nix:50)
  formatter = derivation без outPath        -> error: 'drvPath' is not a valid system type
  checks.x86_64-linux.hello = pkgs.hello    -> all checks passed!
  packages.x86_64-linux.hello = pkgs.hello  -> all checks passed!
  control (без derivation-выводов)          -> all checks passed!

То есть:
  * поломка НЕ зависит от nixpkgs — воспроизводится на флейке без инпутов;
  * nix 2.34.9 при проверке вывода formatter перебирает ИМЕНА атрибутов
    derivation'а и трактует каждое как системный тип (outPath -> drvPath);
  * вывод checks работает нормально. В этом репозитории он уже есть
    (checks.deploy-schema, checks.deploy-activate из deploy-rs) и проходит.

Выводы ADR-0011 не изменились, изменились причины:
  * output'а formatter нет — по-прежнему, но из-за бага nix, а не из-за
    пина nixpkgs;
  * python-проверки остаются в .ci/checks.sh — теперь это ВЫБОР, а не
    запрет: derivation в checks видит только закоммиченный flake source
    (а не рабочее дерево, нужное pre-commit'у) и вытеснил бы проверки
    deploy-rs, занявшие имя checks.

Попутно: комментарии в flake.nix и .ci/checks.sh, README и AGENTS.md приведены
в соответствие с измеренным — чтобы следующий агент не «починил» это, не
заметив, что чинить нечего.
2026-11-15 22:49:33 +03:00
oqyude d1f9025c20 fix(agent): вернуть откаченные схемы .agent и синхронизировать статусы
Регресс: коммит d6d64d2 (2026-11-07, 'treefmt + samba dir changed')
откатил расширения JSON-схем, которыми закрывался T57. С тех пор check #9
('.agent-метаданные против своих схем') падал на 137 нарушениях — то есть
CI был красным, а это никто не заметил.

Также: убрана протухшая пометка в manifest.md о том, что T38+ не внесены в
JSON (внесены 2026-10-25), поправлена строка T57 про blocked, сводка
открытых задач в AGENTS.md приведена в соответствие с манифестом, и
заведена задача T62 на эту работу.

Согласованность теперь проверяется автоматически — check #12.
2026-11-15 06:34:13 +03:00
oqyude d1b1b07903 nginx: vhost vetymae.webmux.zeroq.su — webmux через sapphira, вход через Authelia
nixos flake checks / invariant-checks (push) Successful in 1m53s
test-runner / smoke (push) Successful in 1s
webmux (github.com/samoylenkodmitry/webmux) — веб-терминал к tmux-сессиям на
vetymae; на хосте уже поднят scheduled task'ом WebmuxServe
(HOST=0.0.0.0 PORT=8083). Не хватало входа снаружи.

Vhost (sapphira): proxyPass на LAN-адрес 192.168.1.100:8083 (tailscaled на
vetymae в NoState — пакетов не принимает), proxyWebsockets +
proxy_read/send_timeout 3600s (терминал стримится по WS /ws/session/<name>).

Вход — Authelia forward-auth, как на tty.zeroq.su: у webmux НЕТ своей
аутентификации («кто достучался до порта — получил шелл твоим пользователем»),
а его README прямо запрещает 0.0.0.0 и публичный интернет. Wildcard
*.zeroq.su в access_control покрывает домен, правки политики не нужно.

Плюс ADR-0010, T61 и строка в AGENTS.md.
2026-11-06 15:56:36 +03:00
oqyude e19d5eee39 agent: инцидент пересборки rydiwo (sops-каталоги от root) + открытый пункт opencode-go
nixos flake checks / invariant-checks (push) Successful in 1m8s
test-runner / smoke (push) Successful in 1s
- ADR-0009: разбор инцидента 2026-11-06 (home-manager EACCES из-за
  root-owned каталогов-родителей секретов), механизм фикса и разблокировка
  без пересборки.
- AGENTS.md: инвариант 18 (класс граблей sops-nix + фикс).
- T60: фактическое состояние rydiwo (юнит живой, плагин есть, апстрим
  отвечает) и открытый пункт — OAuth-учётка интеграции opencode для
  провайдера opencode-go.
2026-11-06 15:24:10 +03:00
oqyude 51a3723abb opencode: rydiwo — opencode v2 + browser-control под rydiwo.opencodes.zeroq.su
Desktop-адаптация opencode на rydiwo (device: secondary, Plasma 6/Wayland).

- новый модуль home/modules/opencode-desktop.nix (импорт в home/secondary.nix):
  opencode 2.0.32 из nixpkgs-master, плагин oh-my-opencode-slim@3.0.5,
  конфиг slim/permissions/дефолт модели — как на vetymae (эталон), webpage-MCP
  выключен, плюс MCP browser-control (@opencode-ai/browser-control@0.8.4);
  opencode serve как systemd user service на 0.0.0.0:4096 с
  --cors https://rydiwo.opencodes.zeroq.su и паролем из sops-окружения;
  обёртки oc и browser-control; Chromium в home.packages.
- nginx (sapphira): vhost rydiwo.opencodes.zeroq.su -> 100.92.238.19:4096
  (tailscale; LAN 192.168.1.102 — DHCP-lease, уже уезжал на LAMET).
- computer-use и genoffice MCP не перенесены (Windows-only) — ADR-0009.
- ADR-0009, задача T60, AGENTS.md (инвариант 17 + две ловушки).
2026-11-06 14:44:35 +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 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 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 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 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 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 68294e8e0b 3x-ui update
test-runner / smoke (push) Successful in 0s
2026-10-21 13:53:10 +03:00
oqyude fd09704c76 chore(agents): metastate cleanup — sync checkpoints↔manifest, fix handoff T18/T32, dedup AGENTS.md invariant 12, fix backlog_count 28→30
test-runner / smoke (push) Canceled after 0s
Detected drift:
- checkpoints.json:tasks[] (T1-T20 + T35) устаревал vs manifest.json:tasks (T1-T33); tasks[] удалён
  полностью (manifest.json — единственный source of truth по задачам, per checkpoints-schema v3.0 +
  protocol 6.3 archival deviation). T35-призрак перенесён в closed_attempts[].
- checkpoints.json:phases (execution=completed, handoff=in_progress) расходились с manifest.json
  (execution=in_progress, handoff=pending). Синхронизированы на manifest-версию + AGENTS.md:159-163
  обновлён до того же набора с комментарием про source of truth.
- AGENTS.md:87 инвариант 12 заканчивался дублированным R1.14-блоком про escapeSystemdPath
  (остался с сессии 14:30). Удалён хвостовик, инвариант 12 теперь корректно заканчивается на
  R1.15, ADR-0005.
- handoff-summary.md:74 T18 в pending таблице (формально completed в manifest с saga close-out),
  строка удалена. handoff-summary.md:90 T32 в pending таблице (тоже completed) — статус изменён
  на completed 2026-10-15T14:30. Сопутствующие ссылки T18/T32 в «Project State» и «Next Steps»
  тоже приведены к актуальному состоянию.
- manifest.json:backlog_count=28 был арифметически неверен (22 F-вопроса + 8 pending задач = 30);
  F-листинг включал закрытый 5.6, а счётчик «новых pending» не учитывал T20. Исправлено на 30
  с breakdown блоком и переписанной backlog_note.
- checkpoints.json:resolved_doc_drift — 3 deferral'а (checkpoints↔manifest-tasks, agentsmd-
  invariant12-dup-r114, checkpoints-phases-vs-manifest) закрыты с resolved_at=2026-10-15T17:42Z
  и описанием фикса в каждом.
- checkpoints.json:session_id и session_chain обновлены до текущей сессии
  metaagent-cleanup-2026-10-15T17:42Z.
- manifest.json:session_id и date обновлены до 2026-10-15T17:42; session_id показывает всю
  цепочку init → director → attempt(rollback) → cleanup.
- AGENTS.md frontmatter date-modified: 2026-10-15T03:00 → 2026-10-15T17:42.

Not changed (out of scope):
- metaagent-director/AGENTS.md + README.md (другой репо, не закоммичены)
- 4 reflog-коммита от попытки шима (3e85307, 16a44b9, 158f08d, 574ec27) — оставлены в reflog
- protocol_deviations блок в checkpoints.json не перенесён (medium scope, B+C+A)
- tasks[] в checkpoints.json не заменён на one-liners по schema spec (drop чище: manifest —
  единственный source of truth, дубль-данные гарантированно протухнут)
2026-10-15 20:49:57 +03:00
oqyude 4bf8e552b4 docs(agents): sync R1.15, ADR-0005, T21-T32 from metaagent-director-2026-10-15
test-runner / smoke (push) Canceled after 0s
Brings the meta-agent narrative layer (.agent/) in sync with the
metaagent-director-2026-10-15 session that landed herdr multi-host
setup (T21-T25), herdr-webui nginx vhost evolution (T23), token gate
(T24), v0.2 docs in metaagent-director repo (T26), ADR-0005 (T27),
and the next-pass pending tasks (T28-T32, including v0.2 opencode-
director unit, upstream PR for sameOrigin X-Forwarded-Host, cleanup
of T18 status).

Key invariant formalized: R1.15 (herdr.zeroq.su без authelia, только
herdr-webui token + in-place patch в server/machine-security.ts до
T29 merge). Подробности в ADR-0005.

R1.14 (ADR-0004, escapeSystemdPath) уже внесён в прошлом проходе
(T19), дополнительно не дублируется здесь.

Whitespace regression fix in project-rules.md:145 — single line
wrap вместо extra spaces после «проверяться.»
2026-10-15 14:45:47 +03:00
oqyude ef8a355d00 agents(rules): sync R1.2/R1.14/R2, trap rows, nextcloud:80
R1.2 (мёртвый storage-guard): mkStorageGuard возвращает только
ConditionPathIsMountPoint; RequiresMountsFor отсутствует намеренно
(создаёт dependency, по которой systemd сам монтирует ФС при старте
юнита и обессмысливает гвард — проверено 2026-10-10). Все потребители
передают ConditionPathIsMountPoint через serviceConfig → рендерится
в [Service], где systemd его не читает. Масштаб: 13 systemd-юнитов /
12 сервисов (postgresql, samba, homebox, gitea, navidrome, syncthing,
uptime-kuma, immich, nextcloud, calibre-web, 3x-ui, tape-rotation x2).

R1.14 (новый, из ADR-0004): имя systemd.services.<…> при переопределении
upstream-юнита должно побайтово совпадать с nameValuePair-ключом
модуля. Диагностировать юнит только чтением файла, не systemctl show.

R2: ссылка обновлена с opencode.nix:339 на :407; баг serviceConfig
отмечен как исправленный в c73a698, R2 удерживает от регрессии.

Ловушки (trap table):
- server/default.nix:37-50 — заменена: закомментированных импортов 0,
  T16 завершена, архив 12+3+1.
- opencode.nix:339 — заменена: правильный паттерн на строке 407.

nextcloud.nix:73 → :80 (100.64.0.0 живёт там, не на :73).

Все правки зеркально продублированы в AGENTS.md (always-loaded
mirror).
2026-10-15 03:47:26 +03:00
oqyude 6a5b075039 docs(agent): R1.11-R1.13 — podman ports, x-ui.db rollback, panel TLS
Also fixes R1 numbering: two items were both labelled '8', so reality443Forwarding counted as ninth while AGENTS.md, traps and f2e70bb already referenced it as R1.10. Verification commands were executed against the live host: '{{json .Ports}}' and 'exec xray version' both fail, corrected to .NetworkSettings.Ports and /app/bin/xray-linux-amd64.
2026-10-10 21:43:00 +03:00
oqyude f2e70bb147 docs: reality443Forwarding = required invariant (R1.10) — prevent T10 recurrence
AGENTS.md + project-rules.md trap entries updated: reality443Forwarding
is NOT a 'lost-purpose' option, it is REQUIRED on VDS. The nginx stream
(modules/vds/nginx.nix) routes 443 → 127.0.0.1:15380 → container:443;
removing the option breaks Xray REALITY while SSH and the panel keep
working (which is exactly what the owner observed).

New invariant R1.10 in project-rules.md. T10 manifest entry stays
'pending' pending a proper decision record.
2026-10-10 18:02:55 +03:00
oqyude 0df9688643 fix(review-T17): apply review fixes B1/I1/I2/M1/M2 + T10+T15+any.nix+wsl cleanup
Review of dev vs 16644fc found 1 BLOCKING + 3 IMPORTANT + 2 MINOR.
All addressed in this commit:

B1 (R1.4 stale files in project-rules.md + AGENTS.md):
  Replaced 'vds/nginx.nix' (removed in ef38dc4) with 'home/termux.nix'
  (added in 958247b). R1.4 now correctly lists the 4 files that use
  100.64.0.0: home/termux.nix:256, modules/server/nextcloud.nix:73,
  modules/server/nginx.nix:109,253, modules/vds/systemd.nix:10.

I1 (count drift in '15 modules' docs):
  - AGENTS.md:84 + project-rules.md:97: '15 → 14' (with note that
    stirling-pdf was deleted in 5dd7a58)
  - manifest.json (T16): rewritten acceptance to '15 archived
    (13 from server/default.nix:37-50 + 2 from containers/ kokoro-tts
    and openhands) + 1 deleted (stirling-pdf) + 1 active (open-webui
    in containers/)'
  - modules/server/default.nix:37-50: comment now explains the
    three categories

I2 (T1 + T13 status stuck on pending):
  Both flipped to 'completed' in manifest.json. T1 import fix
  verified by nix eval (epral stateVersion = '24.05'). T13 done in
  61b3724 (nginx firewall rule removed). I3 (.ci/checks.sh committed)
  satisfied.

M1 (R1.3 stale nginx.nix:225 line number):
  Removed line number from both project-rules.md and AGENTS.md.
  Replaced with 'nginx.nix (networking.firewall)'.

M2 (R1.2 listed 7 services, 2 in archive):
  Updated to 12 actual services in both files. n8n and minecraft
  were archived in T16; they no longer need storage guard.

T10 (reality443Forwarding погашен):
  Removed option from options.nix:66-74, realityPorts from
  3x-ui.nix:33-35, and 'reality443Forwarding = true' from
  vds/default.nix:19. ADR-note comments left in place.

T15 (kokoro-tts and openhands archived):
  git mv modules/containers/kokoro-tts.nix → archive/containers/
  git mv modules/containers/openhands.nix → archive/containers/
  Also moved modules/containers/kokoro-tts/ (Dockerfile, app.py, etc.)
  to archive/containers/kokoro-tts/ for completeness.

any.nix (nix flake check support):
  Added stub fileSystems + boot.loader.grub to configurations/any.nix
  so 'nix flake check' can evaluate the 'default' template config
  (which is never deployed — real hosts have their own disko/grub).

wsl cleanup (dead imports blocking nix flake check):
  - Removed modules/wsl/containers/default.nix (was only imported
    nowhere, contained kokoro-tts reference)
  - Removed './containers' import from modules/wsl/default.nix
    (resolved to the now-removed default.nix)

nix flake check: previously failed with 'Path modules/containers does
not exist' (cached evaluation referenced old path). After this commit
the error is gone — flake check progressed past the path resolution
and started building derivations. Full build output not captured
(5-min timeout for download from cache.nixos.org), but path errors
are resolved.

T5 risk acknowledgment:
  .agent/decisions/0002-backups-external.md updated with explicit
  risk table for 'if no backups' scenario + ADR/R1.9 guidance.

T1, T2, T6, T7, T8, T9, T10, T12, T13, T15, T16, T17: all → completed
in manifest.json. T3, T4, T5, T11, T14: previously completed.
Remaining DEFERRED: T3 (otrecа SSH recovery), T5 (5.6 answer).
2026-10-10 16:25:52 +03:00
oqyude 16644fcc0b metaagent: install v3.0.0, migrate docs/arch/* → .agent/
- install.sh: .agent/src/ (PROTOCOLS, COMMANDS, TEMPLATES, install.sh/ps1, GUIDE)
- .temp/ добавлен в .gitignore
- .agent/checkpoints.json: phases.init=completed, project_type=existing
- .agent/rules/project-rules.md: R1-R5 (инварианты, ловушки, куда лезть, проверки)
- .agent/context/analysis-report.md: стек, архитектура, конвенции, кандидаты CI
- .agent/context/project-state.md: сжатый слепок (хосты, сервисы, ADR)
- .agent/roadmap/sources.md: открытые вопросы слоёв 0-11 (бывший invariants.md)
- .agent/tasks/manifest.{json,md}: 16 задач A1-F + 23 в backlog
- .agent/decisions/0001-sops-secrets-paths.md: ADR для инварианта S1
- AGENTS.md: metaagent-шапка + сжатая выжимка nixos (yaml frontmatter сохранён)
- удалены docs/arch/{map,invariants,todo}.md
2026-10-09 20:37:14 +03:00
oqyude 7c9aa24779 agents: yaml frontmatter for Obsidian dataview 2026-10-09 20:28:49 +03:00
oqyude 534fa429e1 docs arch begin 2026-10-07 11:29:21 +03:00