Skip to content

fix(gateway): dedupe exec followup continuations#82717

Merged
steipete merged 1 commit into
openclaw:mainfrom
udaymanish6:forge/openclaw-82711-async-exec-duplicates
May 16, 2026
Merged

fix(gateway): dedupe exec followup continuations#82717
steipete merged 1 commit into
openclaw:mainfrom
udaymanish6:forge/openclaw-82711-async-exec-duplicates

Conversation

@udaymanish6

@udaymanish6 udaymanish6 commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace the async exec approval follow-up expectFinal path with explicit agent.wait handling for accepted gateway runs, avoiding direct fallback duplicates while the agent continuation is still running.
  • Add stable approval-id dedupe across nonce idempotency keys, with early overlap reservation, cleanup on pre-run failures, active-run TTL protection, and regression coverage.
  • Add a changelog entry for [Bug]: Multiple parallel sessions deliver duplicate messages for every async exec completion #82711

Verification

  • pnpm -s format -- src/gateway/server-methods/agent.ts src/gateway/server-methods/agent.test.ts src/gateway/server-maintenance.ts src/gateway/server-maintenance.test.ts src/agents/bash-tools.exec-approval-followup.ts src/agents/bash-tools.exec-approval-followup.test.ts
  • git diff --check origin/main...HEAD
  • node scripts/run-vitest.mjs src/agents/bash-tools.exec-approval-followup.test.ts src/gateway/server-methods/agent.test.ts src/gateway/server-maintenance.test.ts -- --reporter=verbose
  • Codex review: /Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --mode branch --base origin/main -> clean, no accepted/actionable findings reported.
  • Crabbox approval scenario: provider=aws, leaseId=cbx_43f0ff1be053, slug=silver-lobster, run=run_c59813d12220, command exited 0 with 5 test files and 245 tests passed.

Real behavior proof

Behavior addressed: Duplicate async exec approval follow-up continuations when approval retries use different nonce idempotency keys.

Real environment tested: AWS Crabbox Linux lease synced from this PR branch after Node 22 runtime setup; provider=aws, leaseId=cbx_43f0ff1be053, slug=silver-lobster, run=run_c59813d12220.

Exact steps or command run after this patch: On the AWS Crabbox lease, ran the approval follow-up scenario command with env CI=1 NODE_OPTIONS=--max-old-space-size=4096 OPENCLAW_TEST_PROJECTS_PARALLEL=6 OPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=900000 node scripts/run-vitest.mjs src/agents/bash-tools.exec-approval-followup.test.ts src/gateway/server-methods/agent.test.ts src/gateway/server-maintenance.test.ts -- --reporter=verbose.

Evidence after fix: Terminal output from AWS Crabbox run run_c59813d12220:

run context:
  run=run_c59813d12220 portal=https://crabbox.openclaw.ai/portal/runs/run_c59813d12220 logs=https://crabbox.openclaw.ai/v1/runs/run_c59813d12220/logs
  lease=cbx_43f0ff1be053 slug=silver-lobster provider=aws target=linux type=c7a.8xlarge
  workdir=/work/crabbox/cbx_43f0ff1be053/clawdbot7 workspace=raw actions=-
RUN v4.1.6 /work/crabbox/cbx_43f0ff1be053/clawdbot7
Test Files 5 passed (5)
Tests 245 passed (245)
command complete in 2m19.495s total=2m22.297s
{"provider":"aws","leaseId":"cbx_43f0ff1be053","slug":"silver-lobster","syncSkipped":true,"commandMs":139495,"totalMs":142297,"exitCode":0}

Observed result after fix: The approval follow-up path now waits on accepted gateway runs instead of falling through to direct delivery; overlapping retries with a fresh nonce reuse the stable approval-id reservation and do not start a second agent command; failed pre-run reservations are cleared so a retry can start normally.

What was not tested: Live Telegram/Discord user approval with real channel credentials.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 16, 2026
@clawsweeper

clawsweeper Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

Summary
Review failed before ClawSweeper could summarize the requested change.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Real behavior proof
Not applicable: Real behavior proof was not assessed because the Codex review failed.

Next step before merge
Review did not complete, so no work-lane recommendation was made.

Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

Do we have a high-confidence way to reproduce the issue?

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

What I checked:

  • failure reason: codex execution failed.
  • codex failure detail: Codex review failed for this PR with exit 1.
  • codex stdout: Per-item Codex failure; continuing with the rest of the shard.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)

Remaining risk / open question:

  • No close action taken because the review did not complete.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 842e6f16437c.

@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P1 High-priority user-facing bug, regression, or broken workflow. labels May 16, 2026
@steipete steipete force-pushed the forge/openclaw-82711-async-exec-duplicates branch from da50bd0 to 0f05565 Compare May 16, 2026 21:19
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL and removed size: S labels May 16, 2026
@steipete

Copy link
Copy Markdown
Contributor

Proof for the rewritten fix:

  • Focused local format: pnpm -s format -- src/gateway/server-methods/agent.ts src/gateway/server-methods/agent.test.ts src/gateway/server-maintenance.ts src/gateway/server-maintenance.test.ts src/agents/bash-tools.exec-approval-followup.ts src/agents/bash-tools.exec-approval-followup.test.ts
  • Diff whitespace: git diff --check origin/main...HEAD
  • Focused local tests: node scripts/run-vitest.mjs src/agents/bash-tools.exec-approval-followup.test.ts src/gateway/server-methods/agent.test.ts src/gateway/server-maintenance.test.ts -- --reporter=verbose -> 5 files passed, 245 tests passed.
  • Codex review: /Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --mode branch --base origin/main -> clean, no accepted/actionable findings.
  • Crabbox approval scenario: provider=aws, leaseId=cbx_43f0ff1be053, slug=silver-lobster, run=run_c59813d12220 -> 5 files passed, 245 tests passed.

The first raw Crabbox attempt lacked Node and was setup-only (env: node: No such file or directory); the successful run above used the same AWS Crabbox path after provisioning Node 22 and pnpm install.

@openclaw-barnacle openclaw-barnacle Bot added triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels May 16, 2026
@steipete steipete force-pushed the forge/openclaw-82711-async-exec-duplicates branch from 0f05565 to cc5fff0 Compare May 16, 2026 21:23
@steipete steipete force-pushed the forge/openclaw-82711-async-exec-duplicates branch from 02ec834 to 1eaac9f Compare May 16, 2026 21:31
@clawsweeper clawsweeper Bot removed the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 16, 2026
@steipete steipete merged commit 91f45d9 into openclaw:main May 16, 2026
116 checks passed
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 20, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Co-authored-by: Miya <miya@Miyas-Mac-mini.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: supplied External PR includes structured after-fix real behavior proof. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants