Skip to content

fix(permission): don't halt agent on permission rejection by default#11511

Open
Elshayib wants to merge 5 commits into
Kilo-Org:mainfrom
Elshayib:fix/permission-reject-halt
Open

fix(permission): don't halt agent on permission rejection by default#11511
Elshayib wants to merge 5 commits into
Kilo-Org:mainfrom
Elshayib:fix/permission-reject-halt

Conversation

@Elshayib

Copy link
Copy Markdown

Summary

When a user rejects a file read (or any tool permission), the agent should continue without the rejected tool call, not halt entirely. The previous default was to stop the agent loop on any rejection, which is almost never the desired behavior.

Changes

  • packages/opencode/src/session/processor.ts: Changed shouldBreak default from true to false. The agent now continues the loop when a permission is rejected, unless experimental.stop_on_deny is explicitly set to true.
  • packages/opencode/src/config/config.ts: Added stop_on_deny config option (default false). Deprecated continue_loop_on_deny in favor of the more intuitive stop_on_deny.

Verification

  • bun test test/session/processor-effect.test.ts — all 14 tests pass
  • bun test test/permission-task.test.ts — all 8 tests pass
  • bun test test/cli/run/permission.shared.test.ts — all 18 tests pass
  • Pre-existing test timeout in session-prompt-permission-refresh.test.ts is unrelated (fails on main too)

Testing Evidence

All existing processor and permission tests continue to pass. The behavior change is minimal: only the default value of shouldBreak flips from true to false. Users who want the old behavior can set experimental.stop_on_deny: true in their config.

Fixes #7338

islam666 added 4 commits June 21, 2026 06:01
…openai-compatible

MiMo and other OpenAI-compatible providers reject reasoning_effort: 'none'
(they only accept 'low', 'medium', 'high'). When user-provided variants
contain { reasoning: { effort: 'none' } }, rewrite them to
{ reasoning: { enabled: false } } so the SDK never sends an unsupported
effort value.

Fixes Kilo-Org#11501
Spread the original variant object (...v) so sibling keys like
temperature are not dropped when replacing reasoning.effort.

Addresses code review feedback on PR Kilo-Org#11510.
The connect() and disconnect() functions only modified in-memory
state, so MCP server toggle changes were lost after restart. Now
both functions update the enabled field in the project config file
via cfgSvc.update(), bridging the gap between the runtime toggle
endpoints (added Dec 2025) and the enabled config field (added
Jun 2025).

Fixes Kilo-Org#6157
When a user rejects a file read (or any tool permission), the agent
should continue without the rejected tool call, not halt entirely.
The previous default was to stop the agent loop on any rejection.

Changes:
- processor.ts: flip shouldBreak default from true to false
- config.ts: add stop_on_deny config option (default false),
  deprecate continue_loop_on_deny

Users who want the old behavior can set experimental.stop_on_deny: true.

Fixes Kilo-Org#7338
ctx.needsCompaction = false
ctx.compactionError = undefined // kilocode_change
ctx.shouldBreak = (yield* config.get()).experimental?.continue_loop_on_deny !== true
ctx.shouldBreak = (yield* config.get()).experimental?.stop_on_deny === true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Existing continue_loop_on_deny settings become ineffective

processor.ts now only checks experimental.stop_on_deny, but the current VS Code settings UI still reads and writes experimental.continue_loop_on_deny (packages/kilo-vscode/webview-ui/src/components/settings/ExperimentalTab.tsx:162-163). That makes existing configs and the shipped toggle silently stop affecting runtime behavior unless the deprecated key is still aliased or migrated here.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

if (model.api.npm === "@ai-sdk/openai-compatible") {
return mapValues(model.variants, (v) => {
if (v?.reasoning?.effort === "none") {
return { ...v, reasoning: { enabled: false } }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Nested reasoning options get discarded

This preserves top-level variant siblings, but it overwrites the entire reasoning object. Any existing nested keys alongside effort are lost when effort === "none", so the remap is not behavior-preserving for user-defined variants that carry additional reasoning settings.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/session/processor.ts 981 The backward-compat fallback only preserves continue_loop_on_deny: true; existing configs that explicitly set continue_loop_on_deny: false now flip from halt-on-deny to continue-on-deny unless users also migrate to stop_on_deny: true.
packages/opencode/src/provider/transform.ts 641 Remapping reasoning.effort === "none" overwrites the whole reasoning object and drops any sibling nested fields.

Fix these issues in Kilo Cloud

Files Reviewed (8 files)
  • .changeset/mcp-toggle-persist.md - 0 issues
  • .changeset/mimo-reasoning-none-fix.md - 0 issues
  • .changeset/permission-continue-on-deny.md - 0 issues
  • packages/opencode/src/config/config.ts - 0 issues
  • packages/opencode/src/mcp/index.ts - 0 issues
  • packages/opencode/src/provider/transform.ts - 1 issue
  • packages/opencode/src/session/processor.ts - 1 issue
  • packages/opencode/test/provider/cf-ai-gateway-e2e.test.ts - 0 issues
Previous Review Summary (commit f52689f)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit f52689f)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/session/processor.ts 979 Existing continue_loop_on_deny configs and the current VS Code settings toggle become ineffective because runtime now reads only stop_on_deny.
packages/opencode/src/provider/transform.ts 641 Remapping reasoning.effort === "none" overwrites the whole reasoning object and drops any sibling nested fields.

SUGGESTION

File Line Issue
packages/opencode/src/session/processor.ts 979 This default permission-denial behavior change is user-facing, but there is no matching changeset covering it for release notes.

Fix these issues in Kilo Cloud

Files Reviewed (7 files)
  • .changeset/mcp-toggle-persist.md - 0 issues
  • .changeset/mimo-reasoning-none-fix.md - 0 issues
  • packages/opencode/src/config/config.ts - 0 issues
  • packages/opencode/src/mcp/index.ts - 0 issues
  • packages/opencode/src/provider/transform.ts - 1 issue
  • packages/opencode/src/session/processor.ts - 2 issues
  • packages/opencode/test/provider/cf-ai-gateway-e2e.test.ts - 0 issues

Reviewed by gpt-5.4-20260305 · Input: 47.9K · Output: 7.3K · Cached: 138.8K

Review guidance: REVIEW.md from base branch main

@Elshayib

Copy link
Copy Markdown
Author

Good catch on the backward compat. Fixed in the latest commit — continue_loop_on_deny: true now explicitly sets shouldBreak = false, preserving the existing behavior for users who have it configured. The default behavior (when neither flag is set) is now shouldBreak = false (don't halt on deny), and stop_on_deny: true opts in to the old halt-on-deny behavior.

@Elshayib

Copy link
Copy Markdown
Author

Changeset added (permission-continue-on-deny.md) documenting the user-facing behavior change and the stop_on_deny opt-out.

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.

Rejecting a file read halts agent execution

1 participant