fix(exec): emit approval timeout suppression events#98301
Conversation
|
Thanks for the contribution. ClawSweeper proposes closing this for now: the implementation may be reasonable, but passing review and proof does not establish that OpenClaw should add this product surface. Close: the patch is coherent and proof-backed, but it adds new public diagnostic event vocabulary and persisted stability metadata while competing candidate PRs use different contracts and no maintainer has selected the product/API direction. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. This is a proposal only until the separate default-off apply policy is enabled and all live maintainer-signal checks pass. A maintainer can sponsor the direction, request a narrower version, or apply Review detailsBest possible solution: Keep #98279 as the canonical request until a maintainer selects one stable public diagnostic contract and sponsors a single implementation. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main has direct and gateway stale suppression branches that only log or return an ok dropped summary, while public diagnostic subscribers filter out Is this the best way to solve the issue? Conditionally yes: emitting at the existing stale drop points is the narrow implementation shape, but maintainers still need to accept one public event vocabulary across the competing PRs. Security review: Security review cleared: No concrete security or supply-chain issue found; the diff adds bounded diagnostic event emission, stability sanitization, OTEL handling, tests, and script budget updates without dependency, workflow, secret, or package execution changes. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 7006e6fcac9b. |
|
@clawsweeper re-review Fixed the P2 finding: diagnostics-otel now explicitly ignores exec.approval.timeout-suppressed in the diagnostic event switch. Verified:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Thanks for the implementation. Closing this as superseded by #98293, landed as 9f98b6e. The selected patch uses the narrower |
Summary
exec.approval.timeout-suppresseddiagnostic event for stale exec approval timeout follow-ups that are intentionally dropped after a session rebound.approvalId,source, andreason; no session key, route id, command text, or channel target is added.What Problem This Solves
When an exec approval timeout follow-up is stale because the target session was rebound by reset/new-session flow, OpenClaw intentionally suppresses the follow-up. Before this patch, that suppression was only visible through a free-form log line, so operator tooling could not reliably distinguish an intentional stale suppression from lost delivery or a stuck approval path.
Closes #98279
Why This Change Was Made
The existing stale-session guards already know when the approval-time session no longer matches the current session. The fix emits a structured diagnostic event at those existing guards without changing delivery, dedupe, session mutation, or approval resolution behavior.
The event name follows the issue wording:
exec.approval.timeout-suppressed. The payload usessource: "agent-direct" | "gateway-preflight"to identify which suppression point fired andreason: "session-rebound"for a stable low-cardinality reason code.User Impact
Operators and diagnostics consumers can subscribe to the public diagnostic stream or inspect stability/support bundles to see when an approval timeout follow-up was intentionally suppressed. Existing end-user behavior is unchanged.
Change Type
Scope
Evidence
node scripts/run-vitest.mjs src/agents/bash-tools.exec-approval-followup.test.tspassed.node scripts/run-vitest.mjs src/infra/diagnostic-events.test.ts src/logging/diagnostic-stability.test.ts src/logging/diagnostic-stability-bundle.test.tspassed.OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway.config.ts src/gateway/server-methods/agent.test.ts -t "drops a stale exec approval followup at preflight"exited 0.node scripts/plugin-sdk-surface-report.mjs --checkpassed.OPENCLAW_OXLINT_SKIP_PREPARE=1 node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <changed files>passed.timeout 360s node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfopassed.timeout 180s node scripts/run-tsgo.mjs -p extensions/diagnostics-otel/tsconfig.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/diagnostics-otel.tsbuildinfopassed.timeout 180s node scripts/run-tsgo.mjs -p extensions/diagnostics-prometheus/tsconfig.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/diagnostics-prometheus.tsbuildinfopassed.git diff --checkpassed.Real behavior proof
Behavior addressed: A stale approval-timeout follow-up is suppressed and emits a structured
exec.approval.timeout-suppressedevent with the approval id, suppression source, reason, and dispatcher timestamp.Environment tested: Linux workspace, Node 22.22.0, current
mainplus this patch.Steps run after the patch: Ran
node --import tsx --no-warnings -e ...and imported the realsendExecApprovalFollowup,onDiagnosticEvent, andwaitForDiagnosticEventsDrainedfunctions. The script seeded a temp session store whereagent:main:mainhad already rebound fromsession-originaltosession-after-reset, then sent an approval-timeout follow-up for the original session.Evidence after fix:
Observed result after the fix: The follow-up returned
false, no delivery was attempted, and the public diagnostic subscriber received exactly the new suppression event withapprovalId,source,reason, andts.What was not tested: A live external channel timeout with real user interaction was not exercised; the proof calls the production follow-up function directly with a real session-store rebound scenario.
Root Cause
Regression Test Plan
exec.approval.timeout-suppressedwhen a denied timeout follow-up is stale.Impact Assessment
Security Impact