Skip to content

fix(reply): queue visible turns behind active replies - #87044

Merged
steipete merged 1 commit into
openclaw:mainfrom
keshavbotagent:fix/reply-visible-turn-queue
May 27, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
keshavbotagent:fix/reply-visible-turn-queue

Conversation

@keshavbotagent

@keshavbotagent keshavbotagent commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Remove the hidden 15s default from the low-level reply-run idle wait so visible user turns no longer inherit cleanup-settle behavior.
  • Keep the 15s timeout explicit for cleanup/retry paths: queued follow-up admission and interrupt/reset active-run settling.
  • Add core reply-admission regressions that prove visible turns wait past 15s while queued follow-ups still defer/retry after the cleanup settle timeout.

Verification

  • pnpm -s exec oxfmt src/auto-reply/reply/reply-run-registry.ts src/auto-reply/reply/reply-turn-admission.ts src/auto-reply/reply/reply-turn-admission.test.ts src/auto-reply/reply/get-reply-run.ts src/agents/tools/sessions-send-tool.ts
  • pnpm -s exec oxlint src/auto-reply/reply/reply-run-registry.ts src/auto-reply/reply/reply-turn-admission.ts src/auto-reply/reply/reply-turn-admission.test.ts src/auto-reply/reply/get-reply-run.ts src/agents/tools/sessions-send-tool.ts
  • git diff --check
  • pnpm -s tsgo:core:test
  • pnpm -s tsgo:core
  • pnpm lint --threads=8
  • fnm exec --using v24.15.0 -- pnpm -s exec tsx -e '...'
  • .agents/skills/autoreview/scripts/autoreview --mode local
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main

Real Behavior Proof

Behavior addressed: Visible user turns arriving while a same-session reply operation is active should wait for that operation to clear instead of being skipped by the reply-run registry's cleanup-settle timeout.

Real environment tested: Local OpenClaw source checkout on Node 24.15.0, against PR head cba103871a493fc1db922bce519d7824400d967c.

Exact steps or command run after this patch: Ran a terminal probe with Node 24.15.0 against the patched OpenClaw source checkout. The probe created an active reply operation, admitted a visible turn for the same session key, confirmed no 15_000 timer was scheduled and the turn stayed pending, completed the active operation, then confirmed the visible turn was admitted with the active session id. The same terminal probe admitted a queued follow-up and confirmed it still schedules the explicit 15_000 retry/defer timeout.

Evidence after fix: Terminal output from the OpenClaw source checkout:

$ fnm exec --using v24.15.0 -- pnpm -s exec tsx -e '...'
visible waits without 15s; queued followup keeps 15s retry timeout

Observed result after fix: The visible reply admission remained pending while the active reply operation was running, scheduled no 15_000 cleanup timer, then became owned after the active operation completed. The queued follow-up path still scheduled the 15_000 retry timeout and returned skipped active-run, so a stuck active run does not wedge the follow-up drain.

What was not tested: I did not force a deployed Telegram message to wait behind a deliberately held active operation. The changed core admission behavior was exercised directly in a local OpenClaw source checkout.

@openclaw-barnacle openclaw-barnacle Bot added size: S 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. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed May 27, 2026, 1:48 AM ET / 05:48 UTC.

Summary
The PR changes reply-run idle waiting so visible turns no longer inherit the 15s cleanup timeout while queued follow-ups and cleanup paths keep explicit 15s waits, with focused regression tests.

PR surface: Source +6, Tests +68. Total +74 across 4 files.

Reproducibility: yes. source inspection gives a high-confidence reproduction path: current main’s visible admission can call the low-level idle waiter without a timeout, and that waiter supplies the 15s default. I did not run the timer repro because this was a read-only review.

Review metrics: 1 noteworthy metric.

  • Reply admission timeout paths: 1 implicit default removed; 2 explicit 15s waits retained. This is the core behavior change maintainers need to notice before merge: visible turns become unbounded while cleanup and follow-up paths stay bounded.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Add redacted Telegram or Discord live proof showing a second visible turn waits past 15s and then posts after the active reply completes.
  • Put the proof artifact, logs, or copied live output in the PR body; if ClawSweeper does not re-review automatically, ask a maintainer to comment @clawsweeper re-review.

Proof guidance:
Needs stronger real behavior proof before merge: The PR body has copied local tsx probe output, but no real Telegram or Discord channel proof; add redacted terminal/log/video/artifact evidence showing the visible turn waits and delivers, then update the PR body for re-review.

Mantis proof suggestion
A Telegram Desktop recording would directly show whether a visible topic turn waits behind the active reply and posts afterward. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

telegram desktop proof: verify a visible topic reply sent while the same-session reply is active waits past 15s and posts after the active reply finishes.

Risk before merge

  • The PR body’s copied local runtime probe does not prove a real Telegram or Discord channel turn waits behind an active reply and is delivered after the active reply clears.
  • Visible turns now wait without the 15s fallback; if an active reply operation wedges without abort or cleanup, a later user-visible turn can remain pending until some external cleanup happens.

Maintainer options:

  1. Require live channel proof (recommended)
    Ask for redacted Telegram or Discord proof showing a second visible turn waits past 15s and posts after the active reply completes.
  2. Accept maintainer-owned tradeoff
    A maintainer can merge after personally verifying the live path and accepting that visible admission may now wait until active-run cleanup.
  3. Add a visible-run watchdog
    If unbounded visible waits are not acceptable, change the patch to use an explicit visible-turn timeout or stuck-run recovery path before merge.

Next step before merge
The remaining blocker is real channel proof and maintainer acceptance of the message-delivery/availability tradeoff, not a narrow automated code repair.

Security
Cleared: The diff stays within reply admission runtime/tests and does not change dependencies, workflows, secrets, permissions, or other supply-chain surfaces.

Review details

Best possible solution:

Land the caller-scoped timeout split after real channel proof shows visible turns are delivered after an active reply while cleanup and follow-up paths remain bounded; if owners do not want unbounded visible waits, add an explicit visible watchdog instead.

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

Yes, source inspection gives a high-confidence reproduction path: current main’s visible admission can call the low-level idle waiter without a timeout, and that waiter supplies the 15s default. I did not run the timer repro because this was a read-only review.

Is this the best way to solve the issue?

Yes, the code direction is the narrow maintainable fix: make the timeout explicit at callers that need cleanup/retry behavior and leave visible admission to wait for active reply completion. The remaining question is proof and owner acceptance of the unbounded visible-wait tradeoff.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority reply admission bugfix with meaningful but bounded impact on visible channel replies.
  • merge-risk: 🚨 message-delivery: The diff changes active-reply admission for user-visible turns, which can affect whether channel messages are delayed, skipped, or delivered in order.
  • merge-risk: 🚨 availability: Removing the implicit timeout for visible turns can leave a visible reply pending behind a stuck active operation until abort or cleanup occurs.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body has copied local tsx probe output, but no real Telegram or Discord channel proof; add redacted terminal/log/video/artifact evidence showing the visible turn waits and delivers, then update the PR body for re-review.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The generic reply admission change affects visible Telegram topic reply delivery and is suitable for a short Telegram Desktop proof.
Evidence reviewed

PR surface:

Source +6, Tests +68. Total +74 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 12 6 +6
Tests 1 69 1 +68
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 81 7 +74

What I checked:

Likely related people:

  • steipete: Peter Steinberger has the dominant recent touch history on these reply files and authored the current PR head commit plus nearby reply/session maintenance commits. (role: recent area contributor and current PR committer; confidence: high; commits: dca5fbac1502, a374c3a5bfd5, 9f09001014f8; files: src/auto-reply/reply/reply-run-registry.ts, src/auto-reply/reply/reply-turn-admission.ts, src/auto-reply/reply/get-reply-run.ts)
  • dutifulbob: The reply-run registry and original bounded waitForIdle implementation were introduced in the reply lifecycle unification commit credited to Bob. (role: introduced behavior; confidence: high; commits: 3f6840230b86; files: src/auto-reply/reply/reply-run-registry.ts, src/auto-reply/reply/get-reply-run.ts)
  • Takhoffman: Recent history around get-reply-run and reply startup/session behavior includes Tak Hoffman commits, making this a plausible adjacent review route. (role: adjacent reply workflow contributor; confidence: medium; commits: 62703d84308a, 847739d82c60; files: src/auto-reply/reply/get-reply-run.ts, src/auto-reply/reply/agent-runner.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels May 26, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@keshavbotagent
keshavbotagent force-pushed the fix/reply-visible-turn-queue branch 7 times, most recently from 22e201f to a47837f Compare May 27, 2026 01:54
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed proof: supplied External PR includes structured after-fix real behavior proof. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 27, 2026
@steipete
steipete force-pushed the fix/reply-visible-turn-queue branch from a47837f to dca5fba Compare May 27, 2026 05:39
@openclaw-barnacle openclaw-barnacle Bot added triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. and removed proof: supplied External PR includes structured after-fix real behavior proof. labels May 27, 2026
@steipete
steipete force-pushed the fix/reply-visible-turn-queue branch from dca5fba to cba1038 Compare May 27, 2026 05:56
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels May 27, 2026
@steipete
steipete merged commit 455d5e8 into openclaw:main May 27, 2026
122 of 128 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Landed via squash onto main.

  • PR head: cba103871a493fc1db922bce519d7824400d967c
  • Merge commit: 455d5e807cc5a4e3c558a0290f937864fe33becb
  • CI: full PR check set green, including check-lint, check-test-types, check-prod-types, Real behavior proof, and CodeQL/Critical Quality shards
  • Local proof: pnpm lint --threads=8, pnpm -s tsgo:core, pnpm -s tsgo:core:test, runtime admission probe, and autoreview branch pass clean

Thanks @keshavbotagent!

@keshavbotagent
keshavbotagent deleted the fix/reply-visible-turn-queue branch May 27, 2026 06:45
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 28, 2026
Remove the hidden 15s default from reply-run idle waits so visible user turns do not inherit cleanup-settle behavior while waiting behind an active same-session reply operation.

Keep the 15s timeout explicit for queued follow-up retry/defer paths and interrupt/reset cleanup waits, and add reply-admission regressions for both visible and queued follow-up behavior. Also preserve the original cause on a nearby sessions-send fallback error to keep current lint green after rebasing onto main.

Thanks @keshavbotagent.

Co-authored-by: Keshav's Bot <[email protected]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Remove the hidden 15s default from reply-run idle waits so visible user turns do not inherit cleanup-settle behavior while waiting behind an active same-session reply operation.

Keep the 15s timeout explicit for queued follow-up retry/defer paths and interrupt/reset cleanup waits, and add reply-admission regressions for both visible and queued follow-up behavior. Also preserve the original cause on a nearby sessions-send fallback error to keep current lint green after rebasing onto main.

Thanks @keshavbotagent.

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

Labels

agents Agent runtime and tooling mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants