Skip to content

[BUG] AGENT_EMERGENCY_STOP does not block several mutating tools #70

Closed

Description

@OkiriGabriel

Bug Description

AGENT_EMERGENCY_STOP=true is supposed to disable mutating operations. check_emergency_stop_for_tool() only inspects MUTATING_AGENT_TOOLS. That set is missing tools that change infrastructure or open PRs:

  • create_github_pr
  • retry_cicd_pipeline
  • create_cicd_pr
  • restart_cloud_resource
  • scale_cloud_service

With the kill switch on, the agent can still retry pipelines, open fix PRs, restart VMs, and scale services.

Steps to Reproduce

  1. Set AGENT_EMERGENCY_STOP=true.
  2. Call agent.execute_tool("retry_cicd_pipeline", {...}) or "restart_cloud_resource" / "create_github_pr".
  3. Observe the tool running instead of returning {"blocked": true, "emergency_stop": true}.

Expected Behavior

Every mutating agent tool returns the emergency-stop block while the flag is set. Read-only tools (get_*, terraform_plan/validate, suggest_fix, notify_slack) remain allowed.

Actual Behavior

Only the names in MUTATING_AGENT_TOOLS are blocked:

MUTATING_AGENT_TOOLS = {
    "apply_k8s_manifest",
    "run_kubectl",
    "rollback_deployment",
    "run_shell_command",
    "sync_argocd_app",
    "rollback_argocd_app",
    "helm_rollback",
    "helm_upgrade",
    "restart_ec2_instance",
    "scale_ecs_service",
    "restart_gce_instance",
    "restart_azure_vm",
}

restart_ec2_instance / scale_ecs_service are also stale names — the registered tools are restart_cloud_resource and scale_cloud_service, so even those AWS/GCP/Azure paths are not covered.

Additional Context

Issue #9 added the kill switch. execute_tool in agent/core.py consults check_emergency_stop_for_tool before dispatch. SafeExecutor still honors the flag for shell commands; the gap is the tool allow-list.

Possible Solution

Derive the mutating set from AGENT_TOOLS (or keep a complete list that matches registered names). Add a unit test that, with the flag on, every non-read-only tool returns emergency_stop: true.

Activity

  1. added
    bug
    security
    on Sep 19, 2026
  2. added a commit that references this issue on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions