openclaw - 💡(How to fix) Fix feat: time-bounded exec approvals (approve for N minutes/hours) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62284Fetched 2026-04-08 03:06:40
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

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.

Root Cause

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.

Code Example

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

---

/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)

---

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

---

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

---

{
  tools: {
    exec: {
      approvals: {
        defaultDuration: "30m"  // default: "30m"
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

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

extent analysis

TL;DR

Implement a time-bounded approval mode by adding a duration parameter to the approval store and checking its expiry before prompting for approval.

Guidance

  • Update the src/tools/exec-approvals.ts file to include the approvedUntil field in the approval store and implement the logic to check for expiry.
  • Modify the src/auto-reply/reply/commands/approve.ts file to parse the /approve <duration> syntax and store the corresponding approvedUntil value.
  • Add a timed option button to the approval card UI and update the openclaw approvals get CLI to display active timed approvals with a countdown.
  • Consider adding a default duration configuration option to simplify the approval process for users.

Example

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

// Example usage:
const approval: TimedApproval = {
  commandPattern: 'systemctl restart',
  agentId: 'general-agent',
  approvedUntil: Date.now() + 30 * 60 * 1000, // 30 minutes
};

Notes

The implementation should focus on adding the approvedUntil field to the approval store and updating the relevant files to support the timed approval mode. The example provided demonstrates how to create a TimedApproval object with a 30-minute duration.

Recommendation

Apply the workaround by implementing the time-bounded approval mode as described in the guidance section. This will provide users with a more flexible and secure approval process during active work sessions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING