-
Notifications
You must be signed in to change notification settings - Fork 88
fix: prevent agent from deleting user workspace when adding MCP support #999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ Activate this skill when user wants to: | |
| 5. **Validate before deploy** — Invoke azure-validate before azure-deploy | ||
| 6. **Confirm Azure context** — Use `ask_user` for subscription and location per [Azure Context](references/azure-context.md) | ||
| 7. ⛔ **Destructive actions require `ask_user`** — [Global Rules](references/global-rules.md) | ||
| 8. ⛔ **NEVER delete user project directories** — When adding features to an existing project, MODIFY existing files. Templates and `azd init` are for NEW projects only. NEVER run `rm -rf` on user workspace directories. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If an agent follows this instruction exactly it will lose the ability to delete directories for other valid reasons. |
||
|
|
||
| --- | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,8 @@ ask_user( | |||||
| - Do NOT assume user wants to delete/overwrite | ||||||
| - Do NOT proceed based on "the user asked to deploy" (deploy ≠ delete old) | ||||||
| - Do NOT batch destructive actions without individual confirmation | ||||||
| - ⛔ Do NOT delete user project directories (`rm -rf <project>`) even when adding features, converting, or migrating — use MODIFY mode to edit existing files instead | ||||||
| - ⛔ `azd init` and template commands are for NEW projects only — NEVER run on an existing workspace without explicit user confirmation | ||||||
|
||||||
| - ⛔ `azd init` and template commands are for NEW projects only — NEVER run on an existing workspace without explicit user confirmation | |
| - ⛔ `azd init` and template commands are for NEW projects only — run them **only** in an empty/new directory. If the user explicitly requests re-initialization of an existing project, create a separate new directory, run the template there, and then migrate changes into the existing project with user-confirmed edits. Never run these commands directly in a non-empty existing workspace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to say azd init commands with a template in the arguments? You can azd init without a template in an existing workspace.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,19 @@ Templates for hosting MCP (Model Context Protocol) servers on Azure Functions. | |||||
|
|
||||||
| **Indicators**: `mcp_tool_trigger`, `MCPTrigger`, `@app.mcp_tool`, project name contains "mcp" | ||||||
|
|
||||||
| ## Standard MCP Templates | ||||||
| > ⚠️ **Warning: Templates are for NEW projects only.** | ||||||
| > If the user has an existing Azure Functions project, do NOT use `azd init` — this will overwrite their workspace. | ||||||
| > For existing projects, use the **recipe approach** instead: [recipes/mcp/](recipes/mcp/README.md). | ||||||
| > ⛔ **NEVER run `rm -rf` or delete the user's project directory.** Destructive actions require `ask_user` confirmation — see [global-rules.md](../../../global-rules.md). | ||||||
|
||||||
| > ⛔ **NEVER run `rm -rf` or delete the user's project directory.** Destructive actions require `ask_user` confirmation — see [global-rules.md](../../../global-rules.md). | |
| > ⛔ **NEVER run `rm -rf` or delete the user's project/workspace directory under any circumstances.** For all other destructive actions (excluding deletion of user workspaces), follow `ask_user` confirmation rules as described in [global-rules.md](../../../global-rules.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rule #8 states templates/
azd initare for new projects only, while global-rules.md currently allowsazd initon existing workspaces with explicit confirmation. Align the wording across these documents so the agent doesn’t get conflicting guidance about whether in-place initialization is ever acceptable.