Skip to content

fix: ask_user stops accepting answers when prompt delivery fails - #124148

Merged
obviyus merged 1 commit into
mainfrom
t3code/132323cc
Aug 15, 2026
Merged

obviyus merged 1 commit into
mainfrom
t3code/132323cc

Conversation

@obviyus

@obviyus obviyus commented Aug 15, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #123915

What Problem This Solves

Fixes an issue where an ask_user prompt could be marked answerable even though its channel delivery was cancelled or failed before transport. The next unrelated inbound message could then be consumed as the missing answer.

Why This Change Was Made

The tool callback treated dispatcher idleness as delivery success and discarded the existing per-payload settlement outcome. The queued-delivery owner now requires the exact outcome for tracked dispatchers and rejects only outcomes proven invisible; routed delivery applies the same invariant at its result owner. Ambiguous failures after transport begins remain accepted because the prompt may already be visible.

No provider-specific path, retry, compatibility shim, or fallback was added. Production delta: +25 lines; regression/test delta: +105 lines. The production growth is the generic exact-settlement and abort contract shared by the owner boundary; the call site is net negative.

User Impact

Invisible questions no longer remain armed to capture a later message. Visible and possibly partially delivered questions keep their existing answer flow.

Evidence

  • Pre-fix owner-boundary reproduction: the real reply dispatcher resolved both cancelled and failed-before-deliver cases; 2 table cases failed because rejection was expected.
  • Regression table covers cancelled, failed-before-deliver, delivered, and ambiguous failed-deliver; routed non-delivery and queue-admission rejection have sibling coverage.
  • git diff --check
  • Oxfmt check on all 5 touched files
  • Oxlint with config/tsconfig/oxlint.core.json on all 5 touched files
  • pnpm tsgo:core
  • pnpm check:test-types
  • Focused grouped Vitest run: 9 files, 453 tests passed
  • $distill: zero findings
  • $greybeard: zero findings
  • Exact-head CI gate: passed
  • Exact-head Telegram real-user DM (ba7edcdbdcc16c12b037f61bdc55f189a80e0956):
    • Normal delivery showed the release-channel question; the delayed user reply Stable resolved as status: answered, then Telegram received ASK_USER_E2E_FINISHED.
    • A live reply_payload_sending hook cancelled only the ask_user payload. Telegram recorded no question event; the bridge received ask_user prompt delivery failed | queued reply delivery failed; the model resumed and Telegram received the single visible final message ASK_USER_E2E_FINISHED.
    • Side effects: normal run recorded typing plus final-message/progress edits; cancelled run recorded one SUT message, no edit, deletion, reaction, or stray question.
  • Exact-head ClawSweeper rerun after live evidence: passed with a correct patch, 0 findings, 0 security concerns, no maintainer decision, and 0 Rank-up moves.

@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 15, 2026
@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 6:46 AM ET / 10:46 UTC.

ClawSweeper review

What this changes

The PR makes ask_user fail its pending prompt when queued or routed delivery is proven not to have reached transport, preventing a later unrelated reply from being consumed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

No blocking correctness finding: this is a focused P1 repair for a current-main delivery-state gap. It needs member-owner approval and an exact-current-main proof refresh before merge because the branch is behind main.

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

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong exact-head channel proof and focused owner-boundary coverage support a clean repair, pending current-main refresh.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The PR body records an exact-head real Telegram DM run for normal delivery and a payload-specific cancellation, with the cancelled case showing no question event and one visible completion message.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR body records an exact-head real Telegram DM run for normal delivery and a payload-specific cancellation, with the cancelled case showing no question event and one visible completion message.
Evidence reviewed 6 items Current-main gap: Current main waits for the dispatcher to become idle after admitting an ask_user payload, which cannot distinguish cancellation or a pre-transport failure from successful delivery.
Owner-boundary repair: The PR captures the payload-specific settlement at the turn ledger, rejects only cancelled and failed-before-deliver outcomes, and keeps ambiguous post-transport failures answerable.
Prompt-state consumer: The embedded agent subscriber turns a rejected delivery callback into prompt-failed, and the ask_user owner cancels the pending Gateway question instead of accepting a later answer.
Findings None None.
Security None None.

How this fits together

The auto-reply dispatcher delivers agent tool output to the active or originating channel. ask_user uses that delivery callback to decide whether its pending question can safely accept an inbound answer.

flowchart LR
  A[Agent invokes ask_user] --> B[Pending question]
  B --> C[Auto-reply dispatcher]
  C --> D[Queued or routed delivery]
  D --> E[Delivery settlement]
  E --> F[Answerable or prompt failed]
  F --> G[Inbound user reply]
Loading

Decision needed

Question Recommendation
Does the auto-reply owner approve merging this delivery-settlement change after its proof is refreshed on current main? Refresh and approve: Rebase or otherwise validate the clean merge result on current main, then rerun the focused delivery suite and the Telegram cancellation trace.

Why: This member-authored, maintainer-labeled PR changes whether a channel prompt remains eligible to consume a later inbound answer.

Before merge

  • Resolve merge risk (P1) - The branch is behind current main, so its exact-head CI and live Telegram trace must be refreshed against the eventual merge head.
  • Resolve merge risk (P1) - The repair changes message-delivery semantics for pending prompts; custom dispatchers without payload settlement intentionally retain their existing admission-plus-idle contract.
  • Complete next step (P2) - An auto-reply owner should refresh current-main proof and approve this protected member PR; no mechanical repair is identified.
Agent review details

Security

None.

PR surface

Source +130. Total +130 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 5 148 18 +130
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 148 18 +130

Review metrics

Metric Value Why it matters
Production versus regression coverage production +25, tests +105 The production growth adds the shared payload-settlement owner boundary; the regression table and sibling cases cover its four delivery outcomes.

Merge-risk options

Maintainer options:

  1. Refresh delivery proof on current main (recommended)
    Validate the clean merge result with the focused settlement regressions and the real Telegram cancellation flow before merge.

Technical review

Best possible solution:

Keep the exact-settlement rule at the turn-ledger and routed-delivery owners, preserve ambiguous post-transport failures as potentially visible, and merge only after current-main validation confirms the same behavior.

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

Yes—current main shows the idle-only path, and the PR’s focused real-dispatcher table directly varies the missing settlement outcomes; this read-only review did not execute the suite.

Is this the best way to solve the issue?

Yes—the exact delivery result is available at the queued and routed delivery owners, while an idle barrier alone cannot establish that a prompt reached transport.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7e0941270d0d.

Labels

Label changes:

  • add merge-risk: 🚨 message-delivery: The patch changes when an ask_user prompt is treated as delivered versus failed, directly affecting whether later channel input is consumed.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body records an exact-head real Telegram DM run for normal delivery and a payload-specific cancellation, with the cancelled case showing no question event and one visible completion message.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: An invisible ask_user prompt can otherwise capture an unrelated later inbound message in an active channel workflow.
  • merge-risk: 🚨 message-delivery: The patch changes when an ask_user prompt is treated as delivered versus failed, directly affecting whether later channel input is consumed.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR body records an exact-head real Telegram DM run for normal delivery and a payload-specific cancellation, with the cancelled case showing no question event and one visible completion message.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records an exact-head real Telegram DM run for normal delivery and a payload-specific cancellation, with the cancelled case showing no question event and one visible completion message.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The change alters visible Telegram question delivery and can be demonstrated in a short Telegram Desktop flow.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the relevant queue-admission and route-delivery behavior to the current auto-reply snapshot commit. (role: recent current-main contributor; confidence: medium; commits: d1f8c339b141; files: src/auto-reply/reply/dispatch-from-config.execute.ts, src/auto-reply/reply/dispatch-from-config.prepare-delivery.ts, src/auto-reply/reply/reply-dispatcher.ts)

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 (1 earlier review cycle)
  • reviewed 2026-08-15T10:31:14.358Z sha ba7edcd :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 15, 2026
@obviyus obviyus self-assigned this Aug 15, 2026
@obviyus

obviyus commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer landing decision: approved.

ClawSweeper before-merge items:

  • Current-main refresh: skip rebase/rerun. Fast-lane policy merges BEHIND when conflict-free and rebases only CONFLICTING. Against current main f916e690c00fdd28e0f4c4a87b06fdb57052cd4c, the merge tree is clean (f7bd3730b8433e1f41da13c2133e56fe6f1a1b32), the effective patch is byte-equivalent by stable patch ID (0e740ab44ea333fdb450a63f3015bd4433f9262b), and none of the five owner files changed since the branch base. Exact-head CI, focused tests, local ClawSweeper, and Telegram proof remain applicable under the ≤24h patch-identical rule.
  • Custom dispatchers: accepted intentional contract. They expose no per-payload settlement, so they retain admission plus idle; tracked core dispatchers use the exact delivery outcome.
  • Owner decision: approved by the Telegram/core maintainer after the exact-head cancellation and successful-answer traces.

Local ClawSweeper result on ba7edcdbdcc16c12b037f61bdc55f189a80e0956: 0 findings, 0 security concerns, no maintainer decision, 0 Rank-up moves.

@obviyus
obviyus merged commit f7b8099 into main Aug 15, 2026
210 checks passed
@obviyus
obviyus deleted the t3code/132323cc branch August 15, 2026 11:18
@obviyus

obviyus commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as f7b809933d6910838039bbf372fb9074a047245e from source ba7edcdbdcc16c12b037f61bdc55f189a80e0956.

Exact-head CI, focused owner tests, local ClawSweeper, and Telegram cancellation/answer proof passed before merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
Do not leave invisible ask_user prompts armed to consume later messages.

Reject only delivery outcomes proven invisible; preserve ambiguous post-transport failures and untracked dispatcher behavior.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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.

[Bug]: ask_user in a Telegram group deletes its preview and delivers nothing to the chat

1 participant