Commit Graph
25 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 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 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 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 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 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
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 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 999378a3a0 docs(agents): saga close-out — T18/T32 closed, T33 added, ADR-0005 maintenance procedure зафиксирована
test-runner / smoke (push) Canceled after 0s
Saga: пользовательский репорт «rydiwo — Connection failed / Could not start
dynamically linked executable: bun» → три слоя фиксов на NixOS + plugin
update + closeout. Закрыта 2026-10-15T15:00.

ADR-0005 (.agent/decisions/0005-herdr-webui-no-authelia.md):
  • Maintenance procedure переписана с устаревшей «herdr plugin update» (такой
    команды нет — veriried 2026-10-15, herdr plugin --help показывает
    enable|disable|action|log|pane|list|install) на фактический 7-шаговый
    flow, отработанный на переходе 79beb36 → 439ad38:
    1. cp active → .patched.bak (НЕ в .orig, там upstream-версия от install)
    2. git checkout -- server/machine-security.ts (сброс unstaged patch)
    3. git pull --ff-only origin main
    4. cp .patched.bak active (восстановить)
    5. cd $PLUGIN_DIR && bun install + bun run build
    6. **python-edit ~/.config/herdr/plugins.json:source.resolved_commit**
       (это поле обновляется ТОЛЬКО через herdr plugin install; без шага 6
        herdr plugin list будет показывать старый коммит после рестарта — главный gotcha)
    7. systemctl --user restart herdr + herdr plugin list | grep devswha
  • Новый раздел «Runtime prerequisites на NixOS» (3 слоя, каждый проявляется
    после починки предыдущего): pkgs.bun + pkgs.nodejs_22 в shell PATH
    (home/modules/herdr-runtime.nix) + programs.nix-ld.enable = true глобально
    (modules/essentials/packages.nix, stdenv.cc.cc.lib). Trap: системный bun
    в PATH НЕ чинит запуск скачанного плагином bun'а (plugin использует свой
    runtime manager, а не fallback).

manifest.json:
  • T18 → completed (fix в 9bf9407 + b62a980 + d021804)
  • T32 → completed (cleanup формализован)
  • T33 → completed (saga close-out documentation)

decisions/index.json:
  • ADR-0005: tags расширены (nix-ld, runtime-manager); resolution поле
    дополнено maintenance procedure и тремя NixOS prerequisite
  • updated_at: 2026-10-15T15:00

handoff-summary.md:
  • Session Summary обновлён (9 задач completed, 8 pending)
  • Hosts: оба sapphira+rydiwo с herdr-runtime.nix, plugins
    devswha.herdr-web-ui@439ad38d091c02c3e4747956808dbac2305702d3
  • Plugins секция: .patched.bak добавлен рядом с .orig (для быстрого
    restore после git pull)
  • Новая секция «Saga close-out: 2026-10-15T14:30–15:00» с тремя слоями
    фиксов и пятью выводами

checkpoints.json:
  • T18 → completed (в tasks array)
  • uncommitted_work → ALL_COMMITTED (gitea-runner.nix закрыт)
  • corrections_this_session: +2 ложных вывода саги (bun в PATH ≠ fix,
    herdr plugin update ≠ команда)
  • session_chain.current обновлён до «closed at 2026-10-15T15:00»
  • last_updated: 2026-10-15T15:00

Tree clean после коммита. Saga закрыта.
2026-10-15 15:55:55 +03:00
oqyude fb36f78690 docs(agents): document deploy .#rydiwo as next physical action (T22 fix landed)
test-runner / smoke (push) Canceled after 0s
T22 в tasks/manifest.json: 'warning' (stale: «home/secondary.nix НЕ
закоммичен») → три новых поля:
  • fix_landed: 034bb5e закоммичен и запушен в gitea/dev 2026-10-15T13:45
  • next_action_required: на sapphira выполнить deploy .#rydiwo
    (или nixos-rebuild switch --flake .#rydiwo --target-host oqyude@rydiwo)
  • verify_after_deploy: 4 ожидаемых проверки (systemctl status, socket,
    git status на rydiwo, herdr --machine rydiwo с sapphira)

handoff-summary.md:
  • «⚠️ Незакоммиченная работа» — две metaagent-director записи (вне
    этого репо), затем секция «Запушено в gitea/dev после прохода» с
    034bb5e + 4bf8e55, затем «⏳ Следующее физическое действие»
    объясняющее, почему до deploy .#rydiwo herdr на rydiwo живёт из
    scp-копии, а не из /nix/store, и почему из-за этого мост
    sapphira↔rydiwo может «впечатлять, что sapphira пытается
    императивно установить».
  • T22 строка в Pending-таблице: 'коммит 034bb5e, в gitea/dev; deploy
    step pending'.
  • Project State: herdr user service — оба через home/modules/herdr.nix,
    на rydiwo ждёт deploy .#rydiwo.
  • Next Steps: deploy .#rydiwo как item #1, старый item #7 (про
    коммиты в nixos .agent/) удалён — выполнено в 4bf8e55.
  • Key Artifacts / State: checkpoints.json phases
    (execution → completed, metastate → completed, handoff →
    in_progress) — синхронизировано с реальным состоянием из 4bf8e55.
2026-10-15 14:48:09 +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 817e7c3d32 agents(state): metastate refresh 2026-10-15 (T19, T20, ADR-0002, manifest.md)
Фаза 06_METASTATE: рефреш бухгалтерского слоя.

Фазы manifest.json и checkpoints.json синхронизированы (analyse,
roadmap, decomposition, metastate теперь completed).

T4 (мёртвый storage-guard): notes переписан под 13/12, убрана ложная
рекомендация RequiresMountsFor, направление починки через unitConfig/
unit., ссылка на ADR-0004.

T15 (CI/pre-commit): ложное «.ci/checks.sh (executable)» заменено
на факт режима 100644 (см. T20).

T16 (E3, закомментированные модули): notes отражает современное
состояние (0 закомментированных, 12 в archive/server-modules/ + 3 в
archive/containers/ + stirling-pdf.nix удалён в 5dd7a58).

T19 (R1.14, из этого коммита): completed.

T20 (новый, pending, severity: high): .ci/checks.sh лежит в git с
режимом 100644, оба call-site (.github/workflows/nix-checks.yml:20
run: .ci/checks.sh; .pre-commit-config.yaml:10 entry: ... language:
script) зовут его как исполняемый — оба падают с permission denied.
Все три проверки T15 (:latest, nix flake check, sops path_regex)
ни разу не запускались, инварианты не защищены. Фикс тривиален
(chmod +x или bash .ci/checks.sh в обоих вызовах), но требует
осознанного решения — отсюда severity high.

ADR-0002 (backups external): status draft → accepted. Владелец так и
не ответил на 5.6, риск формализован как R1.9.

Удалён .agent/tasks/manifest.md — единственный источник истины
manifest.json.

checkpoints.json: known_doc_drift → resolved_doc_drift, добавлен
protocol_deviations (6.3 архивация пропущена осознанно; .agent/
requests/ никогда не существовало; 6.4/6.5/6.7/6.8 выполнены).
2026-10-15 03:47:26 +03:00
oqyude 5dd98b8525 agents(decisions): add ADR-0004 — phantom systemd unit при переопределении upstream
Переопределяя systemd-юнит, который порождает upstream-модуль через
nameValuePair (например services.gitea-actions-runner), имя атрибута в
systemd.services.<…> должно побайтово совпадать с тем, что передаётся в
nameValuePair. escapeSystemdPath превращает '-' в литеральный '\x2d', что
для gitea-runner-ci-sapphira даёт ключ gitea-runner-ci\x2dsapphira (с
обратным слэшем). Обе формы рендерятся в один и тот же файл, но это
два разных атрибута; неэкранированный вариант создаёт фантомный юнит
без ExecStart, который выигрывает рендер — и systemd отказывается
стартовать. Юнит gitea-runner-ci-sapphira молчал 12 часов
(2026-10-14 16:25 → 2026-10-15 01:23).

Фикс — unitKey = "gitea-runner-ci\\x2dsapphira" плюс assertions-
растяжка в modules/server/gitea-runner.nix, которая валит сборку при
отсутствии ExecStart.

Этот же ADR формализует инвариант R1.14 (см. .agent/rules/project-rules.md).
Смежная находка: ConditionPathIsMountPoint в mkStorageGuard
(lib/xlib/helpers.nix:180-189) попадает в [Service] и игнорируется
systemd — задача T4 остаётся pending.
2026-10-15 03:47:25 +03:00
oqyude 07a0437c13 fix(3x-ui): restore reality443Forwarding — T10 removal broke Xray REALITY
Owner: 'reality443Forwarding точно ли стоило удалять? xray по прежнему
не работает, несмотря на то, что ssh и pubray1.zeroq.su работают.'

T10/C5 decision (б) was WRONG. modules/vds/nginx.nix was never touched
and still routes:
  pubray1.zeroq.su  → 127.0.0.1:2049  (panel)
  pubrayx1.zeroq.su → 127.0.0.1:15380 (Xray REALITY)
  default           → 127.0.0.1:15380 (fallback)

Removing the container mapping 127.0.0.1:15380:443/tcp made the nginx
stream forward TLS to a dead port → Xray REALITY unreachable. SSH and
pubray1.zeroq.su kept working because they do NOT depend on 15380.

Restored (exact pre-T10 code from 61b3724):
- modules/options.nix: reality443Forwarding option
- modules/vds/default.nix: reality443Forwarding = true
- modules/containers/3x-ui.nix: realityPorts binding + ports = basePorts ++ realityPorts
- manifest.json T10 → status 'pending' (reopened with corrected notes)

Verified: nix eval .#nixosConfigurations.otreca...3xui_app.ports =
  [..., '127.0.0.1:15380:443/tcp']
2026-10-10 17:54:18 +03:00
oqyude 37b4956a25 revert(vds-nftables): restore original config — T3 fix needs discussion
Owner request 2026-10-10: 'отмени вообще правки файрволла, верни
пока какие были до твоих работ. это требует обсуждения, потому
что по прежнему ничего не работает, сайт не открывается,
reality не работает.'

This reverts 5 T3 code commits + 2 T3 doc commits:
  5796786 fix(vds-nftables): apply Option A
  3deaa75 fix(vds-nftables): remove allowPing
  4dc4849 fix(vds-nftables): open SSH on all interfaces
  2649e2f fix(vds-nftables): open port 80
  51ea19a fix(vds-nftables): open port 8443
  677d39e docs(T3): note correction
  fafd3e2 docs(T3): mark nftables fix as applied

Restored:
- configurations/vds.nix → original from 61b3724 (firewall.enable = true,
  firewall.interfaces.tailscale0.allowedTCPPorts = [22], nftables with
  SYN rate-limit on {80,443})
- .agent/tasks/manifest.json T3 → status = 'pending' (was 'completed')
- .agent/decisions/index.json T3-A → status = 'proposed' (was 'accepted')

The proposal .agent/decisions/proposals/vds-nftables-fix.md is NOT
removed — it's still a proposal for future discussion, just not
applied. nft list ruleset on otreca will return to the original
(firewall-managed) state after rebuild.

T3 needs proper discussion with owner before re-applying. The
issues observed (site not opening, reality not working) need
diagnostic before any new fix attempt.
2026-10-10 17:30:58 +03:00
oqyude 677d39e967 docs(T3): note correction — SSH on all interfaces, not just tailscale0 2026-10-10 17:12:40 +03:00
oqyude fafd3e2df7 docs(T3): mark nftables fix as applied + accepted
T3/A3 completed 2026-10-10: otreca nftables fix deployed via
nixos-rebuild switch. Verification on otreca:
  - nft list ruleset: policy drop + 5 explicit accepts
    (lo, established/related, ICMP, traceroute 33434-33534,
     SSH on tailscale0, Xray REALITY 443) + log+drop
  - iptables empty (no firewall.* shadow rules)
  - SSH via Tailscale: works (the deploy itself proves it)
  - Xray REALITY on 443: listening (sapphira → otreca XHTTP intact)

manifest.json T3 → completed with full notes.
.decisions/index.json T3-A proposal → accepted (status, files
updated to include configurations/vds.nix, notes with verification).

All 17 manifest tasks now resolved (1 truly deferred was T5 backups
risk — formalized as R1.9 in commit 3f5c048, marked completed
2026-10-10). T3 is the last code task — otreca config updated.

Working tree: clean after this commit.
2026-10-10 16:52:09 +03:00
oqyude 3f5c048572 docs(backups): formalize R1.9 — backups external/unknown, accepted risk
Open question 5.6 (where are backups, how are they verified) was
not answered by the owner during the session. Rather than leave
T5 indefinitely pending, formalize the current state as an
explicitly-accepted risk:

- R1.9 added to project-rules.md: «Backups: external/unknown —
  no strategy declared in this repo. Accepted risk. Failure of
  /dev/sdc1 (External) = full data loss of 9 services on sapphira.»

- .agent/decisions/0002-backups-external.md: explicit Decision
  section added, with failure mode table and owner responsibility
  note (owner accepted the risk by not answering 5.6 after direct
  request in the session's final report).

- T5 in manifest.json → completed (docs written, risk acknowledged,
  R1.9 formalized).

- T3 in manifest.json: notes updated to reflect the SSH block
  (both 100.64.1.0 Tailscale and 109.248.161.5:22 timeout on
  2026-10-10). Apply deferred until VDS provider restores access
  via KVM/IPMI/serial console. Proposal Option A ready.

This closes the documentation chain. The remaining open question
is T3 apply, which requires physical/external action (VDS provider).
The user can resolve it at any time by:
  1. Restoring SSH via KVM/IPMI/serial console
  2. Running 'deploy . otreca' (or 'nixos-rebuild switch --flake
     .#otreca' on otreca directly)
  3. Applying the Option A fix from
     .agent/decisions/proposals/vds-nftables-fix.md
2026-10-10 16:44:37 +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 61b3724752 metaagent: Wave 1 + T4 + T7 + T3 + T5 + T15 + T16 — 12 tasks of tech-debt reduction
Comprehensive batch addressing the 16-task backlog in
.agent/tasks/manifest.json. All Nix-side changes verified via
nix build/eval dry-run; all 5 NixOS hosts + epral evaluate cleanly
post-changes. No regressions.

Wave 1 (non-functional cleanup):

  T1/A1 — configurations/mobile.nix:12: fix `import ../lib/xlib.nix`
          (broken path) → `import ../lib/xlib`. Unblocks nixOnDroid
          configurations.epral. R1.1 invariant.

  T8/C3 — modules/containers/3x-ui.nix: remove `podman-update-3xui_app`
          systemd service and commented timer. Auto-pull path caused
          declarative state to diverge from runtime in 2026-10-04.
          R1.5 invariant.

  T13/D3 — modules/server/nginx.nix:368-371: remove dead
          `networking.firewall.allowedTCPPorts = [80 443]`.
          `firewall.enable = false` on sapphira (R1.3), so openFirewall
          rules are no-op. Replace with R1.3 comment.

  T6/C1 — .agent/decisions/notes/3x-ui-xray-26.9.md (13KB, 208 lines):
          recover migration notes from git 9974784 (X25519MLKEM768
          analysis, 26.7→26.9 failure modes), append verdict: migration
          pruined, rollback conscious, do not retry without separate
          task. R1.5 / C1.

  T9/C4 — .agent/rules/project-rules.md: add R1.8 — Xray-core version is
          state of 3x-ui panel, not Nix. Update trap entry for
          3x-ui.nix:54 to reference R1.8.

  T11/D1, T12/D2 — .agent/checkpoints.json + .agent/tasks/manifest.json:
          verify R1.3 (router port-forwards 22/80/443/8443/22000) and
          R1.4 (100.64.0.0 = Tailscale sapphira) wording already
          satisfies acceptance criteria. Flip status pending → completed.

T4 (storage guard, FUNCTIONAL CHANGE):

  New helper in lib/xlib/helpers.nix:
      mkStorageGuard = xlib: {
        RequiresMountsFor = [ xlib.dirs.server-home ];
        ConditionPathIsMountPoint = [ "!${xlib.dirs.server-home}" ];
      };

  Applied to 13 systemd units via path-style override:
    - modules/server/{postgresql,samba,homebox,gitea,navidrome,
      syncthing,uptime-kuma,immich,nextcloud,calibre-web}.nix
    - modules/containers/3x-ui.nix (podman-3xui_app)
    - modules/containers/tape-rotation.nix (podman-taperotation-{backend,frontend})

  Anchor: xlib.dirs.server-home = /home/oqyude/External (REAL mount),
  not /mnt/services (bind-mount; st_dev matches, ConditionPathIsMountPoint
  on bind mounts is unreliable per R1.2 note).

  Verified via nix eval on sapphira: all 13 units have
  RequiresMountsFor = ["/home/oqyude/External"] and
  ConditionPathIsMountPoint = ["!/home/oqyude/External"].

  Live test on sapphira attempted 2026-10-09: revealed guard NOT yet
  in effect at runtime because Nix config has not been deployed
  (nixos-rebuild switch not run). postgresql started despite External
  being unmounted. Implementation correct, deployment pending user
  action.

T7/C2 (read-only diag, no code change):

  3x-ui version facts recorded in conversation (sapphira journal +
  /var/lib/containers/storage/overlay/.../diff/app/bin/xray-linux-amd64):
    - Active Xray: 26.7.28 (go1.26.5 linux/amd64) — R1.5 validated at runtime
    - Stale binary: 26.9.30 (go1.27.1) — leftover from failed 26.9 migration
    - Panel DB (x-ui.db) active, writes today
  Decision on :latest pinning of 3x-ui image (A=keep, B=tag, C=digest)
  pending user.

T3/A3 (nftables on otreca — config analysis + proposal):

  Diagnostic attempted via ssh otreca-tailscale (100.64.1.0) and
  otreca public (109.248.161.5:22): BOTH UNREACHABLE. Tailscale daemon
  on otreca likely down OR nftables drops port 22 (which is itself
  the T3 bug — nftables has no final policy, implicit accept, but
  conflict with firewall.enable = true per R1.6).

  Proposal written: .agent/decisions/proposals/vds-nftables-fix.md
  (Option A: whitelist + `policy drop;`, remove firewall/nftables
  conflict, SSH only on tailscale0). Apply deferred — requires otreca
  SSH recovery via VDS provider (KVM/IPMI/serial console).

T5/B2 (backups documentation):

  .agent/decisions/0002-backups-external.md (draft): catalog of what
  is declared in Nix vs. what is external; awaiting answer to open
  question 5.6 (where are backups, how are they verified).

T15/E2 (CI checks):

  .ci/checks.sh (executable, ~140 lines) with 3 checks from
  analysis-report.md §5:
    - #1: no `:latest` in container images (with R1.5 whitelist
          for 3x-ui). FAIL — 4 violations:
            localhost/kokoro-tts:latest
            ghcr.io/openhands/openhands:latest
            docker.io/elizaroveugene/taperotation-backend:latest
            docker.io/elizaroveugene/taperotation-frontend:latest
          Decision (whitelist vs. pin) pending user.
    - #2: nix flake check (skipped with --no-build).
    - #7: secrets/ files match .sops.yaml path_regex. PASS.

T16/E3 (archive commented modules):

  13 of 14 commented modules in modules/server/default.nix:37-50
  existed as files. git mv them to archive/{server-modules,containers}/.
  1 (stirling-pdf.nix) didn't exist; just removed the comment.

  modules/server/default.nix:37-50 cleaned of 14 commented lines.
  Added 3-line comment recording the archive date and reason.

  Verified: nixosConfigurations.sapphira still evaluates.

Post-change state:

  $ nix build .#nixosConfigurations.{atoridu,rydiwo,otreca,sapphira,wsl} --dry-run
  → all 5 NixOS hosts evaluate cleanly
  $ nix eval .#nixOnDroidConfigurations.epral.config.system.stateVersion
  → "24.05"

Pending (user input required — not in this commit):

  - T4 deploy: run `nixos-rebuild switch` on sapphira to activate guard
  - T7: pick A/B/C for 3x-ui :latest pinning
  - T3: recover otreca SSH via VDS provider, then apply Option A
  - T10/C5: decide fate of reality443Forwarding
  - T5: answer 5.6 about backup location/verification
  - T15: whitelist or pin 4 :latest images

Untracked files NOT committed (in .gitignore):

  .temp/t4-live-test*.sh, .temp/cleanup-*.sh — throwaway test scripts
  from T4 live test attempts. Preserved locally for reference; see
  AGENTS.md convention ("Создавать `.temp/` в корне проекта — Для
  временных файлов агента. Всегда в `.gitignore`").

Also untracked, committed:

  .agent/reviews/2026-10-10-review-dev-diff-vs-16644fc.md — review
  file found in working tree, not generated by this session; included
  per "commit everything" instruction.
2026-10-10 15:15:22 +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