openclaw - 💡(How to fix) Fix Discord sessions carry stale exec config through gateway restarts [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#59273Fetched 2026-04-08 02:26:37
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Root Cause

Root cause identified: 2026-04-01 (security audit by ion-ctrl)

Fix Action

Fix / Workaround

Current workaround: tools.exec.security = "full" bypasses both approval layers entirely, sidestepping the staleness issue.

RAW_BUFFERClick to expand / collapse

Bug: Discord sessions carry stale exec config through gateway restarts

Severity: MEDIUM

Root cause identified: 2026-04-01 (security audit by ion-ctrl)

Description: AcpSessionManager.ensureRuntimeHandle() caches runtime handles without checking whether the runtime config has changed. Discord sessions reuse cached handles after gateway restarts, ignoring updates to safeBins and tools.exec.security in openclaw.json.

Code location: auth-profiles, line ~46727, ensureRuntimeHandle()

The cache comparison checks:

  • backendMatches
  • agentMatches
  • modeMatches
  • cwdMatches

But does NOT check whether cfg (runtime config) has changed since the handle was cached.

Secondary factor: When messages arrive during the gateway restart window (lanes cleared by resetAllLanes() via SIGUSR1), pending Discord jobs capture cfg at message-arrival time. After restart, these jobs process with the old cfg snapshot.

Impact:

  • Discord sessions don't pick up safeBins changes after restarts
  • Discord sessions don't pick up tools.exec.security changes after restarts
  • allowlist mode is unreliable on Discord because of stale handles

Current workaround: tools.exec.security = "full" bypasses both approval layers entirely, sidestepping the staleness issue.

Recommended fix (Option A): Add a config fingerprint or hash to the runtime cache validity check in ensureRuntimeHandle() to detect config changes and invalidate the cache accordingly.

Alternative (Option B): Force all Discord session lanes to re-initialize their runtime handles after a gateway restart.

Files examined:

  • auth-profiles (ensureRuntimeHandle method)
  • system-events (resetAllLanes / SIGUSR1)
  • ~/.openclaw/exec-approvals.json
  • ~/.openclaw/openclaw.json

extent analysis

TL;DR

To fix the issue of Discord sessions carrying stale exec config through gateway restarts, add a config fingerprint or hash to the runtime cache validity check in ensureRuntimeHandle() to detect config changes and invalidate the cache accordingly.

Guidance

  • Review the ensureRuntimeHandle() method in auth-profiles to understand the current cache comparison logic and identify where to add the config fingerprint or hash check.
  • Consider the trade-offs between the recommended fix (Option A) and the alternative (Option B), which involves forcing all Discord session lanes to re-initialize their runtime handles after a gateway restart.
  • Verify that the tools.exec.security configuration is not set to "full" as a workaround, as this bypasses approval layers and may introduce security risks.
  • Test the fix by updating safeBins and tools.exec.security in openclaw.json and verifying that Discord sessions pick up the changes after a gateway restart.

Example

// Pseudo-code example of adding a config fingerprint to ensureRuntimeHandle()
const configFingerprint = calculateConfigFingerprint(cfg);
if (backendMatches && agentMatches && modeMatches && cwdMatches && configFingerprintMatches) {
  // Use cached runtime handle
} else {
  // Invalidate cache and create a new runtime handle
}

Notes

The fix may require additional testing to ensure that the config fingerprint or hash is correctly calculated and compared, and that the cache is properly invalidated when the config changes.

Recommendation

Apply the recommended fix (Option A) by adding a config fingerprint or hash to the runtime cache validity check, as this approach is more targeted and less likely to introduce additional complexity or performance issues.

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