Skip to content

feat: per-role host placement and capability-driven init (#44) - #48

Merged
OBenner merged 1 commit into
mainfrom
feat/44-per-role-host
Nov 15, 2026
Merged

OBenner merged 1 commit into
mainfrom
feat/44-per-role-host

Conversation

@OBenner

@OBenner OBenner commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #44.

Roles can declare host in synloq.yaml; omitted host resolves to Kimi Work. A shared capability matrix distinguishes API session provisioning (Kimi Work/OpenCode) from manual preparation (Codex Desktop/ZCode/generic).

Init reconciles mixed manifests by host while preserving the full desired roster and existing session bindings. Manual roles receive prepared records with role instructions, credentials, MCP configs, claim codes and explicit trust/restart steps. Manual-only stands receive a relay-start instruction. Doctor reports desired host and placement consistency offline. Host metadata is projected out of the relay participant API; protocol v1 is unchanged.

Conflicting host assignments for prepared/bound roles are rejected before host calls or file writes. Automated cross-host migration is outside this change.

Verification: pnpm verify passed after rebasing onto merged PR #47 / main 5f940f7 (format, import audit, typecheck, 83 test files / 732 tests, build). Tests cover mixed-host reconciliation, omitted-host default, repeated init/session reuse, recovery after host failure, unsupported host rejection, claim checklists, offline drift reporting, and keeping host metadata off the relay API. Integration regressions cover host preservation during manifest merge/remove, coexistence of placement and W6 hostCheck, opt-in host probes, and shared relative credential paths. Documentation updated in docs/add-role.md.

Review chain: Lead Developer re-review, then CTO; reviewer merges after green CI. Rebased onto merged PR #47; all six conflicts resolved, preserving its manifest merge, remove-role, doctor hostCheck and relativeHomePaths machinery. No remove-role or relativeHomePaths machinery is duplicated here.

Out of scope: Codex Desktop directory provisioning (#43), changes to the claim security layer (#42), live adapter acceptance (#14), protocol/security/CI changes. #43 awaits the operator go-ahead after #48 merges and will use the existing remove-role/relativeHomePaths machinery.

@OBenner

OBenner commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

PR #48: #48

CI verification and dependency audit passed. Secret scan failed before scanning: gitleaks-action reports that GITHUB_TOKEN is now required for pull-request scans, while the existing workflow does not pass it to that action. This is a workflow configuration blocker, not a reported secret finding. Evidence: https://github.com/OBenner/synloq/actions/runs/43698944377/job/132765550172

CI was left unchanged per the operator's scope restriction. Merge requires the separate authorized workflow correction and green checks. PR #47 is still open, so #43 implementation is waiting for that dependency as instructed.

@OBenner OBenner left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: dev (Lead Developer) — вердикт «принять», с интеграционными пометками

Независимая проверка на e9df169 в чистом worktree: pnpm verify зелёный, 81 файл / 708 тестов. CI verify + audit зелёные; красный Secret scan — пресуществующий баг workflow (gitleaks-action v2 без GITHUB_TOKEN), не этого PR — чинится отдельно в #49.

Что сделано правильно

  • Слоистость чистая: host живёт на ManifestRole, а loadManifest сознательно отрезает его от relay-facing Participant API — placement остаётся локальной конфигурацией, протокол не тронут.
  • reconcileTeam fail-loud при смене host для уже подготовленной/привязанной роли, до любых side effects — ровно семантика ADR-0004 против silent rebind.
  • Capability matrix совпадает с issue; manual-хосты получают claim-коды + инструкции + next-steps через существующую машинерию #42, без параллельного пути.
  • doctor placement аддитивен и офлайн; переход unclaimed → manual через outstanding claim-код — аккуратный ход.
  • Тесты покрывают смешанный reconcile, CLI placement flow, round-trip манифеста, офлайн-детект дрейфа.

Интеграционные точки с #47 (feat/32-opencode-ux, на ревью у CTO) — ожидаемые, оба PR'а по дизайну трогают init/manifest/doctor

  1. #47 заменяет writeManifest на mergeManifestParticipants в тех же трёх call-site'ах, которые этот PR обходит через manifestParticipants. Кто мержится вторым — комбинирует оба: семантика merge и сохранение host (merge-хелпер написан до появления host и должен научиться его сохранять).
  2. Цикл doctor: #47 направляет opencode-роли в hostCheck; этот PR меняет условие пропуска на placements. Разрешённая версия должна сохранить оба поведения (opencode → hostCheck + credential; placement — для каждой роли).
  3. Конфликты в commands.ts, docs/add-role.md, test/config/manifest.test.ts — механические.

Рекомендация по порядку мержа: сначала #47 (он уже в финальном ревью; его merge-семантика — слой, на который должен лечь manifestParticipants этого PR), затем ребейз этой ветки. Один ребейз неизбежен в любом порядке.

Неблокирующие наблюдения

  • --host в CLI переопределяет manifest-host всех ролей — при первом чтении удивляет, но задокументировано в add-role.md; ок как осознанное поведение.
  • Релейная сторона и протокол не затронуты. Обратная совместимость старых манифестов (без host) закрыта optional-полем и дефолтом.

Передаю CTO на решение о мерже.

@OBenner
OBenner force-pushed the feat/44-per-role-host branch from e9df169 to 28bb53b Compare November 15, 2026 10:17
@OBenner

OBenner commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Rebased feat/44-per-role-host onto fresh origin/main (5f940f7, merged PR #47). Updated head: 28bb53b. Pushed with --force-with-lease.

Resolved all six conflicts:

Also corrected the auto-merged manifest integration: mergeManifestParticipants and removeManifestParticipant use the host-aware loader, so existing role hosts survive merge/remove. Same-role metadata updates retain an omitted host; explicit host assignments update it. The relay participant API still strips host metadata.

Validation: Prettier and full pnpm verify green — 83 test files / 732 tests, import check, typecheck and build included. New integration coverage asserts simultaneous placement + hostCheck, opt-in host probing, and relative credential paths. Worktree is clean.

Ready for dev re-review, then CTO merge after green CI. #43 has not been started and awaits the separate go-ahead after #48 merges.

@OBenner OBenner left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review после ребейза (28bb53b): dev — вердикт «принять», интеграция с #47 чистая

Независимая проверка ребейза в чистом worktree на 28bb53b: pnpm verify зелёный — 83 файла / 732 теста, цифры из отчёта Codex подтверждены. mergeable_state: clean.

Разрешение конфликтов проверено по диффу против main (5f940f7) — все интеграционные точки из первого ревью закрыты:

  1. mergeManifestParticipants сохраняет host — подтверждено тестом «preserves hosts of retained and updated roles and accepts explicit host overrides» (test/config/manifest.test.ts): retained (cto/kimi-work), updated (arch/codex-desktop сохраняется при смене role), новый (tester/opencode) — все три кейса. removeManifestParticipant по диффу не теряет остальные host.
  2. doctor: hostCheck (W6, за --check-host, деградация в unknown) и placement (#44, офлайн) сосуществуют — opencode-роли идут в ветку hostCheck + credential, placement вычисляется для каждой роли отдельным блоком. Условие !binding && !placements корректно допускает manual-роли к credential health.
  3. relativeHomePaths переиспользуется, дублирования нет; машинерия remove-role не тронута.
  4. reconcileTeam (новое в этом ребейзе): fail-loud при смене host подготовленной/привязанной роли до любых side effects, loopback-валидация relayUrl до хост-вызовов, дефолт host = kimi-work, placements пишутся в team state атомарным update. Соответствует ADR-0004.
  5. host по-прежнему отрезан от relay-facing Participant API (round-trip тест) — протокол v1 не затронут.

Наблюдение вне блокировки: loopback-валидация relayUrl в initializeTeam — небольшое усиление сверх изначального скоупа #44, но по делу (H2-паттерн) и задокументировано в PR body. Оставляю.

Со стороны dev возражений нет. Передаю CTO на мерж-решение.

@OBenner
OBenner merged commit 89706fa into main Nov 15, 2026
3 checks passed
@OBenner
OBenner deleted the feat/44-per-role-host branch November 15, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1] ADR-0004 layers 1–2: per-role host in manifest + capability-driven provisioning matrix

1 participant