Skip to content

fix(cron): wire bashElevated into isolated agentTurn runs#30425

Closed
liuxiaopai-ai wants to merge 1 commit into
openclaw:mainfrom
liuxiaopai-ai:codex/issue-30379-cron-bash-elevated
Closed

fix(cron): wire bashElevated into isolated agentTurn runs#30425
liuxiaopai-ai wants to merge 1 commit into
openclaw:mainfrom
liuxiaopai-ai:codex/issue-30379-cron-bash-elevated

Conversation

@liuxiaopai-ai

Copy link
Copy Markdown
Contributor

Summary

  • resolve elevated permissions for isolated cron agentTurn runs using a cron-event context
  • pass bashElevated into runEmbeddedPiAgent for cron isolated runs
  • add regression coverage asserting bashElevated is propagated to embedded runs

Fixes #30379.

Why

Previously cron isolated runs omitted bashElevated entirely, so exec tool elevated gates always treated elevated mode as disabled.

Testing

  • pnpm exec vitest run src/cron/isolated-agent.skips-delivery-without-whatsapp-recipient-besteffortdeliver-true.test.ts
  • pnpm exec oxlint src/cron/isolated-agent/run.ts src/cron/isolated-agent.skips-delivery-without-whatsapp-recipient-besteffortdeliver-true.test.ts
  • pnpm exec oxfmt --check src/cron/isolated-agent/run.ts src/cron/isolated-agent.skips-delivery-without-whatsapp-recipient-besteffortdeliver-true.test.ts

@greptile-apps

greptile-apps Bot commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a bug where cron isolated agent runs were missing elevated bash permissions configuration. Previously, bashElevated was not passed to runEmbeddedPiAgent, causing all elevated permission checks to default to disabled mode regardless of the configuration.

Changes:

  • Added resolveElevatedPermissions call in src/cron/isolated-agent/run.ts using a cron-event provider context
  • Wired the resolved bashElevated object (enabled, allowed, defaultLevel) into runEmbeddedPiAgent calls
  • Added regression test verifying bashElevated is properly propagated with correct values

Implementation notes:

  • Follows the same pattern used in the main auto-reply flow (get-reply-run.ts)
  • Uses cron-event as the provider context for permission resolution
  • Correctly extracts elevated defaults from agent config with "off" fallback

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it's a focused bug fix with appropriate test coverage
  • The changes are straightforward and follow established patterns. The implementation correctly mirrors the elevated permissions resolution used in the main auto-reply flow, the test coverage validates the fix, and the scope is minimal (only 2 files changed). No logical errors, security issues, or unintended side effects identified.
  • No files require special attention

Last reviewed commit: c7186b2

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.

Isolated cron agentTurn sessions missing bashElevated — elevated exec always denied

2 participants