#11816: fix(cron): forward agent-specific exec config to isolated cron sessions
stale
Cluster:
Cron Session Enhancements
#### Summary
Cron-launched isolated agents ignored per-agent `tools.exec` overrides (e.g. `ask: "off"`) and always fell back to global defaults. This PR resolves agent- and global-level exec config and passes it as `execOverrides` to `runEmbeddedPiAgent`, mirroring the auto-reply path.
Closes #11559
lobster-biscuit
#### Repro Steps
1. Configure an agent with `tools.exec.ask: "off"` in `agents.list`
2. Start the agent through the cron isolated-agent runner
3. Trigger execution requiring the exec tool
4. Observe that execution still behaves as if approval is required (gateway mode)
#### Root Cause
`runEmbeddedPiAgent` in `src/cron/isolated-agent/run.ts` was called without `execOverrides`. The auto-reply path already resolves agent → global exec config via `resolveExecDefaults`, but the cron runner did not.
#### Behavior Changes
- Cron-launched isolated agent sessions now respect per-agent `tools.exec` config (host, security, ask, node)
- Agent-specific exec config takes precedence over global config (same precedence as `resolveExecDefaults` in auto-reply)
- When no exec config is set at either level, no `execOverrides` are passed (preserves existing defaults)
#### Codebase and GitHub Search
- Reviewed `resolveExecDefaults` in `src/auto-reply/reply/directive-handling.impl.ts` for the reference implementation
- Verified `runEmbeddedPiAgent` accepts `execOverrides` via `src/agents/pi-embedded-runner/run/params.ts`
- Confirmed `resolveAgentConfig` returns `tools` field from agent entries
#### Tests
4 new unit tests in `src/cron/isolated-agent.exec-overrides.test.ts`:
- passes global `tools.exec` config as `execOverrides` ✅
- agent-specific exec config takes precedence over global ✅
- falls back to global exec when agent has no `tools.exec` ✅
- does not pass `execOverrides` when no exec config is set ✅
All 91 cron tests pass. `pnpm build`, `pnpm check` pass.
**Sign-Off**
- Models used: Claude (AI-assisted)
- Submitter effort: Investigated issue, reviewed reference implementation, implemented fix, wrote tests
- Agent notes: Fix mirrors the established `resolveExecDefaults` pattern from the auto-reply path. The resolution order is agent-specific → global, matching precedence used elsewhere.
Made with [Cursor](https://cursor.com)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR fixes cron-launched isolated agent runs so they honor per-agent and global `tools.exec` configuration.
In `src/cron/isolated-agent/run.ts`, it resolves `tools.exec` from the selected agent config (preferred) and falls back to global config, then forwards that as `execOverrides` into `runEmbeddedPiAgent`. This mirrors the auto-reply path’s precedence logic.
It adds `src/cron/isolated-agent.exec-overrides.test.ts` to assert the `execOverrides` passed to `runEmbeddedPiAgent` for: global-only config, agent-over-global precedence, global fallback when agent has no `tools.exec`, and the no-config case (no overrides passed).
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Change is narrowly scoped (only forwards already-configured exec defaults into cron isolated runs) and is covered by targeted unit tests verifying precedence and the no-config behavior. No other control flow or security boundaries are altered.
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#12310: cron: pass agentDir to embedded runner for isolated sessions
by magendary · 2026-02-09
89.1%
#22845: Pass agentDir through cron and followup embedded runs
by seilk · 2026-02-21
85.9%
#16390: fix(cron): jobs land in wrong agent session when agentId isn't in a...
by yinghaosang · 2026-02-14
84.8%
#22707: fix: pass agentDir to runEmbeddedPiAgent in cron isolated sessions
by mrlerner · 2026-02-21
84.0%
#21646: fix(cron): pass agentDir to runEmbeddedPiAgent for correct auth res...
by zhangjunmengyang · 2026-02-20
83.5%
#11854: fix: resolve per-agent tools.exec config in pi-tools
by Yida-Dev · 2026-02-08
83.0%
#19385: fix: pass authProfileId from cron session to runEmbeddedPiAgent
by gigi-trifle · 2026-02-17
82.1%
#13638: fix: pass delivery context to cron isolated agent subagents
by dario-github · 2026-02-10
81.6%
#11474: fix(cron): respect subagents.model in isolated cron sessions
by AnonO6 · 2026-02-07
81.1%
#23501: fix(cron): force new session ID for isolated cron jobs (#23470)
by stakeswky · 2026-02-22
79.9%