Skip to content

[bug] mcp inject --dry-run can still save a config migration #893

Description

@SaulMoro

Description

teamai mcp inject --dry-run can still write config: it loads the scope without { dryRun }, so a pending legacy role migration (or a partition rename, or a self-mode bootstrap) is saved even though nothing should change.

 mcpInject(options)                                   src/mcp-cmd.ts:97
-  autoDetectInit()                                   loads with LoadOptions = {}  → migrations persist
+  autoDetectInit(undefined, { dryRun: options.dryRun })
   reconcileMcpForConfig(…, { dryRun })               already honours it

#866 threaded { dryRun } through the loaders pull, push, status and list use; mcp inject was left out. mcp list (:27) is read-only and could load with dryRun: true unconditionally, as #866 does for status and list.

Expected: mcp inject --dry-run writes nothing, config included.

Proposed fix: the diff above, plus a ['mcp inject --dry-run', …] row in the LOAD_ONLY_COMMANDS table the #866 tests use, so the regression is pinned.

Reproduction

  1. A user scope whose config.yaml is due for the legacy role migration (the fixture fix(dry-run): thread { dryRun } through the loaders pull, push, status and list use #866's tests use).
  2. teamai mcp inject --dry-run.
  3. config.yaml has been rewritten.

Environment

  • OS: macOS 27.0
  • Node.js: v24.21.0
  • teamai: main at b3b3a0b
  • Provider: any
  • AI tool(s): any

Logs

Where it was found

Found while merging main (#866) into #880, which threads { dryRun } through the env commands and env exec the same way (with tests). Evidence here is from reading the code on main; not reproduced with the CLI.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions