Skip to content

fix(control): preserve Codex tool approvals during MCP setup - #818

Merged
Juliusolsson05 merged 3 commits into
mainfrom
fix/mcp-tool-policy
Sep 5, 2026
Merged

Juliusolsson05 merged 3 commits into
mainfrom
fix/mcp-tool-policy

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

Fixes #817.

Adding per-tool approval settings inside Agent Code's managed Codex server block made its ownership checksum fail, which stopped the enabled MCP listener. Setup now recovers the exact original connection prefix using its existing checksum, moves the ownership boundary before the tool policies, and preserves those policies through restart, retry, key rotation and disable/re-enable.

The TOML transformation is isolated from file installation and transport. It verifies complete parsed before/after semantics so marker-shaped string contents, scope changes and actual connection edits cannot be mistaken for owned configuration. Existing skill ownership, symlink refusal and compare-before-replace checks remain. When policy survives disable, Codex retains an explicitly disabled URL-only server definition with no connection credential; re-enable restores the managed connection around the same policies.

Validation:

  • The sanitized structural fixture reproduces the real bug(control): tool approval settings prevent external MCP server startup #817 configuration and fails with the original implementation.
  • All 9 tests in the 5 targeted settings/transport files pass, covering migration, policy edits, lifecycle, true conflicts, unrelated TOML and authenticated HTTP startup/rotation/disable.
  • Full npm run typecheck, npm run test:contract and git diff --check pass.
  • A separate curl trial using the production integration/settings/host and a private temporary copy of the current user config returns HTTP 200 for initialize, tools/list and tools/call. It exercises the real connection-status capability, preserves tool policy, and confirms the live config is byte-identical afterward.
  • Self-review completed; CI status is tracked on this PR.

Limits: arbitrary connection reformatting or edits still require manual conflict resolution. This verifies server recovery and its status capability, not every live renderer control. The running app was not restarted or hot-patched and needs the fixed build before its existing listener can recover. This change does not alter the separate agent-names work in #816.

Plan-first history: docs/decomposition/mcp-tool-policy.md, followed by the implementation. No merge without user confirmation.

Recover the original hash-proven connection prefix when nested tool approval tables have been added, and move the ownership boundary ahead of preserved policy. Validate complete TOML semantics before publishing changes. Retain a disabled URL-only connection without credentials when policy needs to survive disable/re-enable.

Refs #817
@Juliusolsson05
Juliusolsson05 merged commit f750798 into main Sep 5, 2026
2 checks passed
@Juliusolsson05
Juliusolsson05 deleted the fix/mcp-tool-policy branch September 5, 2026 21:28
Juliusolsson05 added a commit that referenced this pull request Sep 6, 2026
…signatures

origin/main advanced past the review base (external operator toolkit #812,
MCP tool policy #818) while pane-runtime-isolation was in review, and those
PRs added control tests that call the pre-isolation hook signatures. The
merged-tree quality-gate caught two TS errors that the stale worktree base
could not surface:

- control.renderer.test.tsx passed a Dispatch<SetStateAction<number>> as the
  draft-version signal, which now types as a plain () => void bump; the test
  reads drafts imperatively via inspectAgentDraft, so a stable no-op bump is
  behaviorally faithful.
- preferences.renderer.test.tsx passed the render-time runtimes snapshot that
  useWorkspaceHelpers no longer takes; the helper reads runtimes through refs
  and toggles via the setRuntimes updater, so only (setRuntimes, refs) remain.

No production code changed. Merged-tree verification: forced typecheck clean,
full renderer suite 123 files / 523 tests green on Node 24 with two workers.
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.

bug(control): tool approval settings prevent external MCP server startup

1 participant