Skip to content

Conversation

@marius-kilocode
Copy link
Contributor

Summary

This PR enables Agent Manager sessions to respect the same permission settings as the main sidebar, rather than always running in YOLO mode (auto-approving everything).

Problem

Previously, Agent Manager always spawned CLI processes with --yolo flag, causing all tool operations (file reads, writes, command execution, etc.) to be auto-approved without user consent. This was inconsistent with the sidebar behavior where users could configure granular auto-approval settings.

A Discord user reported: "The agent manager ignores my permission settings - it just runs commands without asking for approval even though I have auto-approval disabled."

Solution

Extension Side:

  • Created autoApprovalEnv.ts with helper functions to extract auto-approval configuration from extension state and serialize it to JSON
  • Modified AgentManagerProvider.ts to read permission settings from extension state before spawning CLI
  • Modified CliProcessHandler.ts to pass autoApprovalConfig via KILO_AUTO_APPROVAL_JSON environment variable
  • Modified CliArgsBuilder.ts to NOT include --yolo by default - it's now only added when explicitly requested (YOLO mode enabled in extension)

CLI Side:

  • Added KILO_AUTO_APPROVAL_JSON to env-utils.ts ENV_VARS
  • Added parseAutoApprovalFromJsonEnv() in env-config.ts to parse the JSON config
  • Modified applyAutoApprovalOverrides() to check for JSON config first (from Agent Manager) before falling back to individual env vars
  • Changed DEFAULT_AUTO_APPROVAL.enabled to false for safety - if config isn't loaded before first approval request, defaults to requiring approval

How It Works

  1. Extension extracts config from state (autoApprovalEnabled, alwaysAllowReadOnly, alwaysAllowExecute, etc.)
  2. Config is serialized to JSON and passed via KILO_AUTO_APPROVAL_JSON env var
  3. CLI reads env var during config loading via applyEnvOverrides()
  4. CLI uses config in useApprovalMonitor hook to determine approval decisions
  5. If auto-approval disabled, CLI shows approval UI and waits for user input via JSON-IO bidirectional communication

@changeset-bot
Copy link

changeset-bot bot commented Dec 23, 2025

⚠️ No Changeset found

Latest commit: 458d2f3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

2 participants