Skip to content

feat: provision role configs with scoped ownership and placement - #82

Merged
OBenner merged 1 commit into
mainfrom
feat/58-config-provisioner
Nov 16, 2026
Merged

OBenner merged 1 commit into
mainfrom
feat/58-config-provisioner

Conversation

@OBenner

@OBenner OBenner commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Codex Desktop init previously treated the entire config.toml as generated, so host-added project/trust settings caused false drift or prevented safe removal. It also hard-coded Desktop dispatch and had no optional per-role placement. This change owns only the role's MCP table subtree, preserves other TOML bytes, and dispatches config provisioning/inspection/removal through a ConfigProvisioner registry.

Behavior

  • Add canProvisionConfig alongside session provisioning. The default registry provides Codex Desktop; reconcile, doctor, and remove-role use the registry. Existing desktop CLI result fields remain compatible.
  • Preserve non-owned TOML verbatim, including CRLF, comments, other servers, and host-added project tables. Own [mcp_servers.synloq-<role>] and child tables. Drift detection hashes that subtree; AGENTS.md stays full-file SHA-256. Old single-table full-file hashes remain readable. Removal strips only the unchanged owned subtree and unchanged instructions.
  • Optional manifest placement resolves against the source project (absolute paths also supported). Default stays <home>/runtime/<project-key>/roles/<role>; no project-local layout is imposed. Save the resolved directory in team state; doctor/remove use that saved path even when the desired manifest changes.
  • Refuse symlink/junction parents, project roots/ancestors, Synloq service directories (except the standard role slot), overlapping roles, and implicit placement changes. A host or path move requires explicit operator migration.
  • Successful claim persists bound/configured state. Doctor reports it directly, and re-init preserves claimed manual roles without reissuing claim codes.

Verification and limitations

  • pnpm verify: PASS — 89 files / 793 tests plus format, import hygiene, typecheck, and build.
  • New tests cover registry dispatch, CLI manifest placement, host TOML mutations, quoted headers, multiline strings/arrays, ambiguous ownership rejection, foreign-byte preservation on remove, legacy hashes, drift, path collisions/moves/service roots/junctions, saved-path inspection/removal, and claim/re-init state.
  • git diff --check: clean. No dependencies added; no wire-protocol changes.
  • The lexical TOML editor deliberately rejects ambiguous/unsupported forms instead of reconstructing the document. It is not a full TOML parser. Config ownership is not a hostile-local-process boundary; filesystem races by the owning OS user remain outside the threat model. No live role directories were provisioned or removed outside temporary tests.
  • Code/docs are delivered in one coherent commit because registry, saved placement, and subtree hashes are consumed together. ADR-0004, Codex guide, claim instructions, and security documentation are updated with the implementation.

Checklist

  • Full verify green.
  • Documentation updated with code.
  • New behavior covered; existing tests only updated for the added capability field.
  • No real tokens, credentials, message bodies, or conversation identifiers.
  • Protocol unchanged; filesystem ownership limitations documented.

Refs #58. Review: dev → CTO (architecture feedback welcome). Independent branch from main, not stacked on PR #80 or #81.

@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.

dev review — ACCEPT ПОСЛЕ REBASE (одно обязательное условие).

Проверено по диффу (8216d27) и прогону на ветке (worktree review-82): config-provisioner 6/6, codex-config 10/10, init-placement 1/1, codex-desktop 1/1 — 18/18 PASS. CI 3/3 зелёный.

Сильные места:

  • TOML-сканер fail-closed при любой неоднозначности (дубли таблиц, array-of-tables, dotted/inline переопределения вне owned-секции, незакрытые строки); lookalike-заголовки в строках/массивах/комментариях игнорируются корректно; foreign-байты сохраняются verbatim. Покрытие тестами ровно по этим классам.
  • Placement guards: symlink/junction проверка всех предков, запрет projectRoot и служебных home-каталогов, overlap-проверки planned/stored директорий в reconcile, смена placement fail-closed.
  • Claim flip bound/configured и сохранение bound при re-init соответствуют утверждённому плану.
  • doctor/remove идут по сохранённому state, не по манифесту — как договаривались.

ОБЯЗАТЕЛЬНОЕ условие (блокирует мерж):
PR собран на 7cd06b0, а main уже содержит #81 (e25fa04). git merge-tree показывает реальные конфликты в src/init/codex-desktop.ts и docs/security/threat-model.md. При ребейзе критично НЕ потерять находку #81: provisionDesktopRoles обязан конструировать CredentialStore с new FileSecurityAuditLog(auditLogPath(paths.home, paths.key)) — в текущей ветке этот аргумент отсутствует, и молчаливый resolve конфликта вернёт audit-gap. После ребейса: pnpm verify + убедиться, что тест «audits Desktop credential issuance …» из #81 зелёный; CI перезапустится на новом base.

Неблокирующее:

  • В doctor упрощена раскладка state (prepared?.state вместо claims/manual-логики) — принимаю как осознанное упрощение, state теперь персистентен.
  • Проверка смены placement дублируется в reconcile и provisionDesktopRoles — harmless defense in depth, оставить.

После ребейса передаю CTO на финал без повторного полного ревью — только проверка разрешения конфликтов.

@OBenner
OBenner force-pushed the feat/58-config-provisioner branch from 8216d27 to 682830f Compare November 16, 2026 10:26
@OBenner
OBenner merged commit 0ef8373 into main Nov 16, 2026
3 checks passed
@OBenner
OBenner deleted the feat/58-config-provisioner branch November 16, 2026 10:39
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.

1 participant