Skip to content

feat(codewhale): document project MCP approval and add auto_review passthrough - #3978

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-issue-3174-codewhale-mcp-approval-auto-review
Nov 26, 2026
Merged

dyoshikawa merged 2 commits into
mainfrom
resolve-issue-3174-codewhale-mcp-approval-auto-review

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Follows up on the 2026-11-19 upstream re-check in #3174 with the two Codewhale gaps it found:

  1. Project MCP approval is documented. Codewhale now loads <workspace>/.codewhale/mcp.json only when the workspace is trusted and the exact bytes of the file have been approved with /mcp review + /mcp approve <digest>. Any later change, a regeneration included, loads none of its servers until the file is approved again. (docs/MCP.md)
  2. [auto_review] can be authored. A new global-only codewhale.auto_review passthrough writes Codewhale's tool-call review policy into the user ~/.codewhale/config.toml. (docs/CONFIGURATION.md, [auto_review])

Changes

MCP

  • src/features/mcp/codewhale-mcp.ts
    • The docblock now covers the approval requirement: mcp_sha256 stored in the user config, re-approval after every change, and refusal of a symlinked file.
    • A project generate that changes the bytes of .codewhale/mcp.json logs an info line reminding the user to run /mcp review / /mcp approve <digest>.
    • Global mode does not log it, because no approval is needed there.
  • docs/reference/file-formats.md: the Codewhale MCP note says the same.

Permissions

  • src/types/permissions.ts: codewhale.auto_review is validated as z.looseObject({}).
  • src/features/permissions/codewhale-project-config.ts: new helpers.
    • createCodewhaleUserConfigFile patches { auto_review } into ~/.codewhale/config.toml through the shared-config gateway.
    • readCodewhaleUserAutoReview reads the table back for import.
    • warnAboutProjectAutoReview warns about the override in project mode.
  • src/features/permissions/codewhale-permissions.ts
    • Global getAuxiliaryFiles emits the user config when the override is set.
    • Project mode warns and skips the override.
    • Global import reads [auto_review] into codewhale.auto_review, next to codewhale.rules.
    • getExtraSharedWritePaths now declares .codewhale/config.toml in both scopes.
  • src/features/shared/shared-config-gateway.ts: permissions now own ["allow_shell", "auto_review"] in .codewhale/config.toml.
    • Global hooks keep owning [hooks].
    • A patch touches only the keys it carries, so every other table is kept.
  • docs/reference/file-formats.md: new codewhale.auto_review paragraph with an example. src/generated/docs-content.ts is regenerated.
  • Tests:
    • the merge keeps [hooks] and top-level keys
    • the file is created when missing
    • nothing happens without the override
    • an invalid TOML file is refused
    • the project-mode warning
    • schema rejection of a non-object
    • import with and without permissions.toml
    • a project import ignores the table
    • import → generate round-trip
    • the MCP reminder's three cases

Design decisions

  • The override key is auto_review, not autoReview as the triage plan suggested. The value is the native table, written verbatim. The Codex CLI passthrough of the same kind of table (codexcli.auto_review) and the existing codewhale.rules both use the native name, and CodeBuddy's autoReview is also just its native key.
  • Validation is shape-only (looseObject).
    • Codewhale validates its own rules: matchers, action_kind, and the retired text_contains.
    • Modelling the soft-rule semantics in rulesync would drift with every Codewhale release.
  • Only the auto_review table is replaced, and only when the override is set.
    • Removing the override leaves the table in place, which matches CodeBuddy's autoReview behavior.
    • A table in the user config could also be hand-written, so rulesync does not delete it.
  • In project mode the override is skipped with a warning. Codewhale ignores a project-scope [auto_review], and writing one would only produce Codewhale's own warning.
  • The MCP reminder is info, not warn. Re-approval is the expected workflow, not a problem. It fires only in project scope and only when the bytes change, comparing trimmed content to ignore the trailing newline.

Skipped items

  • approval_policy / sandbox_mode overlay passthrough: these keys have no canonical counterpart, and whether to add a passthrough is a maintainer design call.
  • Mapping rules into the constitution prose fields (authority, branch_policy, ...): needs a product decision, and AGENTS.md already carries the rules.
  • The managed-only auto_review.disabled key: not special-cased. It is passed through like any other key and Codewhale decides what to do with it.

Refs #3174. The two design-call items above stay open.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4

dyoshikawa and others added 2 commits November 26, 2026 16:33
…ssthrough

Codewhale now loads a project .codewhale/mcp.json only after its exact bytes
are approved with /mcp review and /mcp approve <digest>, and every change needs
approving again. Document this and log a reminder when a project generate
changes the file.

Add a global-only codewhale.auto_review permissions override that replaces the
[auto_review] table of ~/.codewhale/config.toml through the shared-config
gateway, keeping [hooks] and every other key. Project mode skips it with a
warning because Codewhale ignores a project-scope table; global import reads
it back.

Refs #3174

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…dewhale-mcp-approval-auto-review

# Conflicts:
#	src/generated/docs-content.ts
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