Skip to content

fix: keep accepted chat messages queued through retryable failures - #137267

Merged
jalehman merged 14 commits into
mainfrom
openclaw/accepted-send-retry-custody-v2
Sep 3, 2026
Merged

jalehman merged 14 commits into
mainfrom
openclaw/accepted-send-retry-custody-v2

Conversation

@jalehman

@jalehman jalehman commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where an accepted chat message could turn into a terminal red error and later be marked interrupted when a retryable transcript projection rebuild temporarily blocked dispatch before the model started.

Originating session: https://openclaw-fsn1.tailf72dd7.ts.net/chat/main/dashboard/660ed975-cf31-4aee-bb0f-4e7cf9c8edc5

Failure session: https://openclaw-fsn1.tailf72dd7.ts.net/chat/main/review-and-fix-pr-136773-studio-631cb697

Why This Change Was Made

The Gateway now classifies accepted-send failures through a typed custody boundary. Retryable pre-model projection failures remain Gateway-owned and redispatch with the same run/idempotency identity for a bounded three attempts; failures after model start or observable side effects are reconciliation-only and are never blindly redispatched. Pre-ACK projection failures remain client-retryable without projecting a terminal transcript error.

User Impact

Optimistic and queued chat messages stay visible through transient projection rebuilds, reconnects cannot claim the same pending input twice, and accepted input is consumed exactly once. A terminal error appears only after retry exhaustion or a non-retryable failure.

Evidence

  • Captured pre-fix failures for retryable post-admission setup/dispatch and pending-input custody.
  • Gateway method tests: 28 passed.
  • Gateway integration test file: 138 passed.
  • Full Control UI non-browser suite: 843 files / 13,769 tests passed; the local Chromium shard was blocked before execution because the host lacks libnspr4.so.
  • pnpm check:changed: passed after rebasing onto current origin/main.
  • pnpm lint:core: passed with zero warnings/errors.
  • Repository autoreview found one P1 ambiguity boundary; fixed by making model-start/side-effect reconciliation take precedence for every error type, with regression coverage. The final autoreview is scoped-clean at P1.
  • ClawSweeper's current-head fixes preserve direct-local cron creator authority across all retry attempts and remove local Pebbles state from the PR; the recovered-authority path has integration coverage.
  • Production delta: +131/-14 lines (net +117) across three files. Test delta: +284/-2 lines (net +282) across four files.

View the OpenClaw team session

Crabbox E2E assessment

Crabbox 0.48.1 is now installed at ~/.local/bin/crabbox from the official Linux amd64 release, with the release asset verified against both GitHub's published digest and checksums.txt. The repository wrapper now passes its binary/provider metadata probes for run and actions hydrate.

A cloud workload was not started. Read-only provider checks show that blacksmith-testbox is blocked because the Blacksmith CLI is not installed, while the AWS provider is not ready on this host. Installing Crabbox therefore removes the binary blocker but does not create provider authorization or capacity.

A deterministic black-box reproduction would also need to hold one exact session transcript projection in the rebuilding state after admission and before model execution. The public Gateway surface does not expose that state transition. Racing a naturally triggered long-transcript rewrite would be timing-dependent, while direct SQLite mutation would no longer be a real black-box E2E. The focused Gateway coverage therefore injects the typed projection-unavailable boundary deterministically and proves same-run retry, pending-input custody, exact-once model start, bounded exhaustion, and reconciliation-only handling.

Post-sync validation on September 3, 2026:

  • Focused Gateway suite: 4 files, 166 tests passed.
  • Feature-path oxfmt --check: passed.
  • Feature-path oxlint: passed.
  • git diff --check: passed.
  • Repository autoreview could not send its review pack because its TruffleHog prerequisite did not complete; the previously reviewed feature diff is byte-for-byte unchanged by the main-branch sync.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 3, 2026
@jalehman
jalehman marked this pull request as ready for review September 3, 2026 11:21
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@jalehman

jalehman commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 5:05 PM ET / 21:05 UTC.

ClawSweeper review

What this changes

The PR keeps an accepted Gateway chat turn and its pending input alive while a transcript-projection rebuild briefly prevents dispatch before agent execution starts.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep open. Current main still converts this typed pre-execution projection condition into a terminal dispatch error; the proposed owner-boundary repair is coherent, but its bounded same-id retry contract needs explicit Gateway-owner acceptance before merge.

Priority: P1
Reviewed head: 771904d60b046ef4fc39584a81d5d1af6a18f87e
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, coherent Gateway repair with useful boundary coverage; merge readiness is held only on an explicit compatibility decision.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository State identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; its focused Gateway tests are supplemental evidence for the typed custody path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; its focused Gateway tests are supplemental evidence for the typed custody path.
Evidence reviewed 6 items Current-main behavior: Current main calls inbound dispatch once; a post-ACK dispatch rejection then enters the terminal error lifecycle, so the reported retry behavior is not already implemented.
Typed failure producer: The transcript projection owner schedules reconciliation before throwing the typed unavailable error, giving the Gateway a concrete readiness boundary to await.
Proposed dispatch boundary: The branch retries only the typed, pre-execution disposition and waits on the failed session's projection using the admitted abort signal.
Findings None None.
Security None None.

How this fits together

Gateway chat.send admits a Control UI message, acknowledges it, then dispatches it to the agent while retaining pending-input custody. This change adds a typed retry decision between transcript projection availability and that dispatch, preserving reconnect/idempotency behavior.

flowchart LR
A[Control UI chat send] --> B[Gateway admission and ACK]
B --> C[Pending-input custody]
C --> D[Inbound dispatch]
D --> E{Projection available before execution?}
E -- Rebuilding --> F[Wait for transcript reconciliation]
F --> D
E -- Started or side effects --> G[Reconcile or terminal result]
Loading

Decision needed

Question Recommendation
Should Gateway explicitly accept bounded same-id retry for an already acknowledged chat.send when only the typed transcript-projection rebuild blocks pre-execution dispatch? Accept the bounded retry contract: Approve the typed pre-execution retry behavior and retain terminal/reconciliation handling once execution or side effects may have begun.

Why: This deliberately changes observable post-ACK error timing and idempotency recovery for existing Gateway clients; source and tests establish the mechanism, but maintainer product compatibility intent is required.

Before merge

  • Resolve merge risk (P1) - Existing Gateway clients will observe an in-flight accepted turn and bounded same-ID retry instead of an immediate terminal projection error; that compatibility contract is not yet explicitly accepted by a Gateway owner.
  • Resolve merge risk (P1) - This bug fix adds 117 net production lines; the split is defensible because classification is shared by setup and detached-dispatch cleanup, but the owner should confirm that this is the canonical custody boundary rather than a temporary retry layer.
  • Complete next step (P2) - Obtain explicit Gateway-owner acceptance of bounded same-ID retry for the typed post-ACK projection failure before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +117, Tests +282. Total +399 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 3 131 14 +117
Tests 4 284 2 +282
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 415 16 +399

Review metrics

Metric Value Why it matters
Production versus regression coverage production +117/-14 (net +103); tests +284/-2 (net +282) The production growth introduces a shared typed classification and retry boundary across setup and detached dispatch, so its ownership and compatibility contract merit explicit acceptance.

Merge-risk options

Maintainer options:

  1. Accept typed retry semantics (recommended)
    A Gateway owner accepts the bounded same-ID retry contract for the typed pre-execution projection condition.
  2. Pause for a different contract
    Keep current terminal behavior until Gateway ownership defines a different compatible recovery model.

Technical review

Best possible solution:

Accept one canonical Gateway contract: retry only the typed projection-unavailable failure before execution under the original admitted identity, and terminalize or reconcile every ambiguous post-start path.

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

Yes. The typed projection owner schedules reconciliation then throws, while current main performs a single dispatch and terminal error projection; the focused Gateway tests encode that deterministic boundary, though this read-only review did not execute them.

Is this the best way to solve the issue?

Yes technically: the Gateway owns the acknowledged turn, pending-input custody, and terminal projection, while the existing transcript owner remains responsible for reconciliation. Explicit acceptance is still needed for the changed client compatibility contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8b5b1cba1f9d.

Labels

Label justifications:

  • P1: A transient Gateway projection rebuild can turn an accepted user chat turn into an erroneous terminal outcome before any model execution.
  • merge-risk: 🚨 compatibility: The branch changes post-ACK client-visible error timing and same-idempotency recovery behavior for existing Gateway clients.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository State identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; its focused Gateway tests are supplemental evidence for the typed custody path.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vito Cappello: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain explicit Gateway-owner acceptance of bounded same-ID retry for the typed post-ACK projection failure.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-03T11:30:15.634Z sha ac1d502 :: blocked before merge. :: [P2] Keep cron creator authority live across the retry loop | [P2] Remove the checked-in Pebbles workspace state
  • reviewed 2026-09-03T12:02:15.059Z sha 388b341 :: blocked before merge. :: none
  • reviewed 2026-09-03T12:24:56.217Z sha dfd1ba0 :: blocked before merge. :: none
  • reviewed 2026-09-03T12:38:23.972Z sha a8e597b :: blocked before merge. :: none
  • reviewed 2026-09-03T12:47:55.135Z sha a8e597b :: blocked before merge. :: none
  • reviewed 2026-09-03T20:18:19.098Z sha 771904d :: blocked before merge. :: none

@jalehman

jalehman commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 3, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Sep 3, 2026
@jalehman

jalehman commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review exact head a8e597b55499754aa2943b9104649ae224aac377 after the latest clean main-branch sync. The accepted-send feature paths are unchanged from the previously reviewed head.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@jalehman

jalehman commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review exact head 771904d60b046ef4fc39584a81d5d1af6a18f87e after the conflict-free current-main sync. The seven accepted-send feature files are unchanged from the previously reviewed head; the PR body now documents the crabbox E2E assessment and synchronized-head validation.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@jalehman
jalehman merged commit 2010e37 into main Sep 3, 2026
190 checks passed
@jalehman
jalehman deleted the openclaw/accepted-send-retry-custody-v2 branch September 3, 2026 21:19
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…penclaw#137267)

* pebbles: sync

* pebbles: sync

* chore: initialize pebbles tracking

* test: capture accepted-send retry custody regressions

* pebbles: sync

* test: cover setup retry and reconnect custody

* fix: retain accepted chat sends across projection retries

* pebbles: sync

* fix: reconcile ambiguous accepted-send failures

* pebbles: sync

* fix: preserve local authority across chat retries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant