← Back to PRs

#11816: fix(cron): forward agent-specific exec config to isolated cron sessions

by AnonO6 open 2026-02-08 10:55 View on GitHub →
stale
#### 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