Skip to content

feat: time-bounded exec approvals (approve for N minutes/hours) #62284

Description

@scottgl9

Summary

Add a time-bounded approval mode so users can approve a command pattern for a specified duration (e.g. 30 minutes, 1 hour) without having to approve every single invocation or permanently allow it.

Motivation

The current approval modes are:

  • once — approve this command once, prompt again next time
  • off — never prompt (YOLO)
  • on — always prompt

This leaves a gap for active work sessions: approving systemctl restart or git push --force 10 times in a row is noisy, but permanently allowing them reduces security visibility.

A timed approval (e.g. /approve 30m) lets users stay productive during an active session while ensuring approvals expire automatically when they walk away.

Proposed Design

New approval action: duration

When an agent requests exec approval, the approval card shows:

✅ Allow once   ⏱ Allow 30m   🕐 Allow 1h   ⚠️ Always allow   ❌ Deny

Or via slash command:

/approve        → allow once (existing behavior)
/approve 30m    → allow for 30 minutes
/approve 1h     → allow for 1 hour  
/approve 4h     → allow for 4 hours
/approve always → permanent allow (existing behavior)

Storage

Add approvedUntil?: number (Unix ms timestamp) to approval store entries:

type TimedApproval = {
  commandPattern: string;
  agentId?: string;
  approvedUntil: number; // Date.now() + durationMs
};

Resolution logic

Before prompting for approval:

  1. Check if command matches a timed approval entry
  2. If approvedUntil > Date.now(): skip prompt, execute
  3. If expired: remove entry, prompt as normal

CLI visibility

openclaw approvals get should show active timed approvals with time remaining:

Timed approvals (active):
  systemctl --user restart *  →  expires in 24m (scottgl9, agent: general-agent)
  git push --force*           →  expires in 47m (scottgl9, agent: general-worker)

Config default duration

Optional config to set the default duration when user presses the timed-approve button:

{
  tools: {
    exec: {
      approvals: {
        defaultDuration: "30m"  // default: "30m"
      }
    }
  }
}

Implementation scope

  • src/tools/exec-approvals.ts — add approvedUntil to store, check expiry
  • src/auto-reply/reply/commands/approve.ts — parse /approve <duration> syntax
  • Approval card UI — add timed option buttons
  • openclaw approvals get CLI — show active timed approvals with countdown
  • Type: ApprovalDuration = string (e.g. "30m", "1h", "4h")

Non-goals

  • Per-command-argument granularity (approve git push origin main specifically) — out of scope
  • Cross-session persistence of timed approvals — timed approvals should not survive gateway restart

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions