#18193: fix: default elevatedDefault to 'off' instead of 'on' (#18177)
size: S
experienced-contributor
Cluster:
Elevated Default Configuration Fixes
## Summary
Fixes #18177.
When `tools.elevated.enabled` is `true` and `elevatedDefault` is not explicitly configured, the fallback value in `resolveReplyDirectives` was `"on"` instead of `"off"`. This caused **all** `exec` tool calls to be routed through the elevated approval gate, resulting in 120-second timeouts for cron jobs and non-interactive agent sessions.
## Root Cause
In `src/auto-reply/reply/get-reply-directives.ts`, the nullish coalescing chain for `resolvedElevatedLevel` ended with `"on"`:
```ts
const resolvedElevatedLevel = elevatedAllowed
? (directives.elevatedLevel ??
sessionEntry?.elevatedLevel ??
agentCfg?.elevatedDefault ??
"on") // <-- BUG
: "off";
```
## Fix
Change the fallback from `"on"` to `"off"`. Elevated mode should be opt-in per session (e.g. via `/elevated on` or `agents.defaults.elevatedDefault: "on"`), not automatically enabled.
## Before
```
❌ BUG CONFIRMED: elevatedDefault fallback = "on" (should be "off")
```
## After
```
✅ PASS: elevatedDefault fallback = "off" (correct)
```
## Changes
- `src/auto-reply/reply/get-reply-directives.ts`: change fallback from `"on"` to `"off"` (1 line)
- `src/auto-reply/reply/elevated-default.test.ts`: regression test
- `CHANGELOG.md`: entry added
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Changed the fallback value for `elevatedDefault` from `"on"` to `"off"` in `get-reply-directives.ts:356`. When `tools.elevated.enabled` is `true` but no explicit `elevatedDefault` is configured, exec commands will no longer be automatically routed through the elevated approval gate, fixing 120-second timeouts in cron jobs and non-interactive agent sessions.
**Changes:**
- Fixed fallback value in nullish coalescing chain from `"on"` → `"off"` (1 line change in `get-reply-directives.ts:356`)
- Added comprehensive regression test with 3 test cases covering the fix and related elevated permissions logic
- Updated `CHANGELOG.md` with clear user-facing description of the fix
**Analysis:**
- The fix aligns with the documented design: elevated mode should be opt-in per session (via `/elevated on` or explicit `elevatedDefault: "on"` config), not automatically enabled
- Follows the same pattern as `resolvedReasoningLevel` (line 348-351) which also defaults to `"off"`
- Test directly exercises the real `resolveReplyDirectives` function with mocked downstream dependencies, ensuring the fix works end-to-end
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- Single-line fix addresses a critical timeout issue with clear root cause. The change is well-isolated, follows existing patterns in the codebase (e.g., `resolvedReasoningLevel` also defaults to "off"), and includes comprehensive regression tests that verify the fix. The behavior change is intentional and aligns with the documented design that elevated mode should be opt-in.
- No files require special attention
<sub>Last reviewed commit: b9eb0fd</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#19624: fix: elevatedDefault should default to off when tools.elevated.enab...
by stakeswky · 2026-02-18
93.7%
#19684: fix: change elevatedDefault fallback from 'on' to 'off'
by neipor · 2026-02-18
91.6%
#19595: fix: elevatedDefault should default to off when tools.elevated.enab...
by guirguispierre · 2026-02-18
89.0%
#23752: Auto-reply: enforce per-session TTL elevated exec grants
by bmendonca3 · 2026-02-22
79.1%
#21661: fix(agents): treat approval timeout as denial regardless of askFall...
by AI-Reviewer-QS · 2026-02-20
78.9%
#19412: fix(status): prefer configured contextTokens over session entry
by rafaelipuente · 2026-02-17
78.5%
#20435: fix(exec): prioritize user 'always allow' config over tool defaults...
by ChisomUma · 2026-02-18
77.8%
#10998: fix(agents): pass session thinking/reasoning levels to session_stat...
by wony2 · 2026-02-07
76.9%
#23071: fix(tts): make config auto=off a hard-disable that overrides user p...
by hydro13 · 2026-02-22
76.8%
#19632: fix: suppressToolErrors now suppresses exec tool failure notifications
by Gitjay11 · 2026-02-18
76.4%