Skip to content

fix: elevatedDefault should default to off when tools.elevated.enabled is true#19624

Open
stakeswky wants to merge 1 commit intoopenclaw:mainfrom
stakeswky:fix/elevated-default-off
Open

fix: elevatedDefault should default to off when tools.elevated.enabled is true#19624
stakeswky wants to merge 1 commit intoopenclaw:mainfrom
stakeswky:fix/elevated-default-off

Conversation

@stakeswky
Copy link
Contributor

@stakeswky stakeswky commented Feb 18, 2026

Summary

Fixes #19574

When tools.elevated.enabled is set to true but no explicit elevatedDefault is configured, the fallback was "on" — causing all exec commands to route through the elevated approval gate, which times out silently after 120s.

Changes

  • src/auto-reply/reply/get-reply-directives.ts: Changed the final fallback in the resolvedElevatedLevel resolution chain from "on" to "off", making elevated mode opt-in per session.
  • src/auto-reply/reply/bash-command.ts: Changed the hardcoded defaultLevel: "on" to "off" in the chat bash command elevated config.
  • Updated e2e test: Adjusted the expected default from "on" to "off" in the directive behavior test.

Behavior

  • Before: Enabling tools.elevated.enabled without setting elevatedDefault caused all exec commands to require elevated approval (defaulting to "on").
  • After: Elevated mode defaults to "off". Users must explicitly opt in via /elevated on, /elevated ask, or by setting elevatedDefault in their agent config.

Greptile Summary

Changed the fallback default for elevatedDefault from "on" to "off" when tools.elevated.enabled is true but no explicit elevatedDefault is configured. This fixes issue #19574 where all exec commands were routing through the elevated approval gate and timing out silently after 120 seconds.

The fix ensures elevated mode is now opt-in through:

  • Explicit /elevated on|ask|full directives per session
  • Setting elevatedDefault in agent config
  • Inline /elevated directives per message

Changes are applied consistently across:

  • Main directive resolution logic (get-reply-directives.ts:356)
  • Chat bash command handler (bash-command.ts:345)
  • E2E test expectations updated to reflect new default

The logic is correct and well-tested. The change makes elevated mode behavior more explicit and prevents unexpected approval gate timeouts.

Confidence Score: 4/5

  • This PR is safe to merge with low risk - it fixes a problematic default behavior where enabling elevated mode would cause silent timeouts
  • The fix is straightforward, logically sound, and addresses a real UX issue. Score is 4 rather than 5 due to the documentation examples not being updated in this PR, which could cause minor confusion for users referencing the docs.
  • No files require special attention - the changes are minimal and well-contained

Last reviewed commit: cf6fe4f

…d is true

When tools.elevated.enabled is set to true but no explicit elevatedDefault
is configured, the fallback was 'on' — causing ALL exec commands to route
through the elevated approval gate, which times out silently after 120s.

Changed the default fallback from 'on' to 'off' so elevated mode is opt-in
per session via /elevated on or by setting elevatedDefault explicitly.

Fixes openclaw#19574
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 353 to +356
? (directives.elevatedLevel ??
(sessionEntry?.elevatedLevel as ElevatedLevel | undefined) ??
(agentCfg?.elevatedDefault as ElevatedLevel | undefined) ??
"on")
"off")
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider updating documentation examples in docs/gateway/configuration-reference.md and docs/gateway/configuration-examples.md (plus zh-CN versions) - they currently show elevatedDefault: "on" which may confuse users with this new default.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/get-reply-directives.ts
Line: 353:356

Comment:
Consider updating documentation examples in `docs/gateway/configuration-reference.md` and `docs/gateway/configuration-examples.md` (plus zh-CN versions) - they currently show `elevatedDefault: "on"` which may confuse users with this new default.

How can I resolve this? If you propose a fix, please make it concise.

@arosstale
Copy link
Contributor

Important fix — defaulting elevated to "on" means any exec tool call runs elevated unless explicitly disabled. The default should definitely be "off" (principle of least privilege). LGTM 👍

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: tools.elevated.enabled: true causes elevatedDefault to default to "on", silently breaking all non-PTY exec calls

2 participants

Comments