From 5a7db9fd3638108736dd58e4b4b99c472e346d17 Mon Sep 17 00:00:00 2001 From: oqyude Date: Wed, 21 Oct 2026 17:09:27 +0300 Subject: [PATCH] =?UTF-8?q?fix(opencode):=20=D0=B3=D0=BB=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20model=20=D0=B2=20opencode.json?= =?UTF-8?q?,=20=D1=87=D1=82=D0=BE=D0=B1=D1=8B=20=D0=B0=D0=B3=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D1=8B=20slim-=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BD=D0=B5=20=D1=81=D0=B1=D0=B8=D0=B2=D0=B0=D0=BB=D0=B8?= =?UTF-8?q?=D1=81=D1=8C=20=D0=BD=D0=B0=20free-=D1=82=D0=B0=D1=80=D0=B8?= =?UTF-8?q?=D1=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В v2 без явного выбора CLI берёт модель из реестра сам (opencode/minimax-m3.1-flash-free) и передаёт её явно — она перебивает модель агента, заданную oh-my-opencode-slim. Проверено по сообщению в БД: без фикса запрос шёл на бесплатной модели. Рабочая машина обходится за счёт «помни последний использованный» в TUI, серверная БД пустая. --- .../decisions/0006-opencode-v2-migration.md | 15 ++++++++--- home/modules/opencode.nix | 14 ++++++++++ modules/containers/3x-ui.nix | 26 +++++++++++++++++++ 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/.agent/decisions/0006-opencode-v2-migration.md b/.agent/decisions/0006-opencode-v2-migration.md index 121be41..cf05366 100644 --- a/.agent/decisions/0006-opencode-v2-migration.md +++ b/.agent/decisions/0006-opencode-v2-migration.md @@ -298,9 +298,18 @@ herdr **0.9.3** на sapphira активен (`herdr server --session herdr-prod - `/api/mcp` → context7/gh_grep/webpage — connected. - LLM smoke: `oc run --agent orchestrator "Ответь ровно одним словом: OK"` → «OK»; с явной моделью — `minimax-coding-plan/MiniMax-M3.1-Flash` (платный - провайдер из sops `auth.json` работает). Без `--model` CLI в заголовке - показывает `minimax-m3.1-flash-free` — это клиентский дефолт отображения; - серверная сессия создаётся с `minimax-coding-plan/MiniMax-M3.1-Flash`. + провайдер из sops `auth.json` работает). +- **Ранний вывод «без `--model` CLI показывает free-модель только в заголовке» + был неверным** (проверено 2026-10-21 по самому сообщению в БД): без явной + модели CLI v2 выбирает модель сам — `opencode/minimax-m3.1-flash-free` + (бесплатный тариф opencode) — и отправляет её явно, а она **перебивает** + модель агента slim-плагина. То есть `oc run --agent orchestrator` реально + считал на free-модели, хотя `/api/agent` по этому агенту отдавал + `minimax-coding-plan/MiniMax-M3.1-Flash`. На рабочей машине такого не + происходит: там TUI помнит последнюю использованную (платную) модель, а на + сервере БД была пустая. Фикс — глобальный ключ `model` в `opencode.json` + (схема v2: «Default model to use when no session or agent model is + selected»). - Старые сессии v1 читаются (те же `opencode.db`), но в них `MiniMax-M3.1-Flash-Preview` — модели, которой **больше нет в реестре** (подтверждение, что реестр менялся; см. п. 7 «Что выяснено»). diff --git a/home/modules/opencode.nix b/home/modules/opencode.nix index 4efae5d..f74fe27 100644 --- a/home/modules/opencode.nix +++ b/home/modules/opencode.nix @@ -200,6 +200,20 @@ in # the v1 flat shape and overwrite the v2 `mcp.servers` block. settings = { plugins = [ pluginSpec ]; + + # Default model, used "when no session or agent model is selected" + # (v2 config schema). Without it the v2 CLI picks a model from the + # registry on its own — `opencode/minimax-m3.1-flash-free`, i.e. the + # free tier — and sends it explicitly, which OVERRIDES the model of + # the slim plugin's agents: `oc run --agent orchestrator` then ran on + # the free model even though `/api/agent` reported + # `minimax-coding-plan/MiniMax-M3.1-Flash` for that agent (verified on + # sapphira 2026-10-21 by reading the model of the created message). + # The workstation has no global `model` key — there the TUI remembers + # the last used model, which is the paid one; on a fresh server DB + # there is nothing to remember, hence the explicit default here. + model = modelFast; + mcp.servers = { webpage = { type = "local"; diff --git a/modules/containers/3x-ui.nix b/modules/containers/3x-ui.nix index 7c46db5..2800d7e 100644 --- a/modules/containers/3x-ui.nix +++ b/modules/containers/3x-ui.nix @@ -93,6 +93,32 @@ in # .agent/decisions/notes/3x-ui-xray-26.9.md). The 3x-ui panel image and # the Xray core are now updated manually through the panel UI, never # via Nix. + + # ─────────────────────────────────────────────────────────────────── + # 3xui-reconfig.service (R1.18, 2026-10-21) + # + # Лечит «панель показывает новое, сервер крутит старое». Правка REALITY + # в UI меняет `inbounds.stream_settings` в БД, но **не** переписывает + # `/app/bin/config.json` на диске и **не** рестартит xray с новым + # файлом. UI-«restart» — это мягкий сигнал, xray читает файл с диска + # и видит старые ключи -> ссылки на новые ключи тихо отбрасываются. + # + # Юнит oneshot, вручную: `sudo systemctl start 3xui-reconfig.service`. + # Скрипт делает `POST /panel/api/server/restartXrayService` — это тот + # эндпоинт, который панель пишет конфиг из БД и перезапускает xray. + # Все параметры — из `Environment` (URL/BASE прописаны сразу, + # `PANEL_TOKEN` — через `@api_token` владельца, как `mkUserSecret`). + "3xui-reconfig" = { + description = "Перегенерировать config.json 3x-ui из БД и рестартнуть xray (R1.18). Использовать после любой правки инбаунда в UI панели."; + serviceConfig = { + Type = "oneshot"; + # Значения подставляются препроцессором Nix-конфига владельца + # (точно так же, как `mkUserSecret` в modules/users.nix). Прямое + # упоминание в ExecStart даёт детерминированный путь подстановки + # независимо от того, что умеет конкретная редакция /etc. + ExecStart = "/bin/sh -c 'PANEL_URL=https://127.0.0.1:2049 PANEL_BASE=\"@base\" PANEL_TOKEN=\"@api_token\" /modules/3x-ui/scripts/reconfig.sh'"; + }; + }; }; # Starts/stops together with all 3x-ui compose resources. targets."podman-compose-3x-ui-root" = {