Skip to content

fix: making typing start fire-and-forget allows cleanup/idle to run before a persistent typin...#75403

Open
clawsweeper[bot] wants to merge 4 commits into
mainfrom
clawsweeper/clawsweeper-commit-openclaw-openclaw-45b86450795d
Open

fix: making typing start fire-and-forget allows cleanup/idle to run before a persistent typin...#75403
clawsweeper[bot] wants to merge 4 commits into
mainfrom
clawsweeper/clawsweeper-commit-openclaw-openclaw-45b86450795d

Conversation

@clawsweeper

@clawsweeper clawsweeper Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Found one concrete regression: making typing start fire-and-forget allows cleanup/idle to run before a persistent typing indicator has finished starting, so the stop path can no-op and leave the indicator behind.

What ClawSweeper Is Fixing

  • Medium: Pending typing start can outlive cleanup and leave persistent indicators stuck (regression)
    • File: src/channels/typing.ts:79
    • Evidence: onReplyStart now starts fireStart() in the background and returns after one microtask at src/channels/typing.ts:79-87, while fireStop immediately marks the callbacks closed and calls stop at src/channels/typing.ts:90-98. For Feishu, start assigns typingState only after await addTypingIndicator(...) at extensions/feishu/src/reply-dispatcher.ts:176; stop returns without doing anything if typingState is still unset at extensions/feishu/src/reply-dispatcher.ts:183-185. A fast cleanup while addTypingIndicator is still in flight therefore calls stop too early, then the delayed start completes and records a persistent reaction with no later removal.
    • Impact: Feishu typing reactions are explicitly persistent until removed. A quick reply, NO_REPLY, empty-message cleanup, cancellation, or send-policy path can leave a visible typing reaction/indicator on the parent message after the run is already finished.
    • Suggested fix: keep typing start off the reply critical path, but serialize cleanup against the pending start. For example, track the current start promise and, if stop/cleanup happens while it is pending, run stop again after the promise settles when a start actually completed. Alternatively make persistent-indicator channels expose an abortable/pending-aware start helper.
    • Confidence: high

Expected Repair Surface

  • src/channels/typing.ts
  • src/auto-reply/reply/typing.ts
  • src/channels/typing.test.ts

Source And Review Context

  • ClawSweeper report: https://github.com/openclaw/clawsweeper/blob/main/records/openclaw-openclaw/commits/45b86450795d8bd3d1e548c8815cd97d6583199d.md

  • Commit under review: 45b8645

  • Latest main at intake: 8093ae6

  • Original commit author: Ayaan Zaidi

  • GitHub author: @obviyus

  • Highest severity: medium

  • Review confidence: high

  • Diff: 40b0b1bfe051072f47d0160eb078afa3b17cef48..45b86450795d8bd3d1e548c8815cd97d6583199d

  • Changed files: src/auto-reply/reply/typing.ts, src/channels/typing.ts, src/channels/typing.test.ts

  • Code read: changed files in full; src/channels/typing-lifecycle.ts; src/channels/typing-start-guard.ts; src/auto-reply/reply/reply-dispatcher.ts; src/auto-reply/reply/get-reply.ts; src/auto-reply/reply/get-reply-run.ts; src/auto-reply/reply/agent-runner.ts; relevant channel typing call sites, including Feishu, Matrix, Telegram, Discord, Signal, Mattermost, MSTeams, Zalo, and heartbeat typing.

  • Dependencies/web: no dependency files changed; no web lookup needed.

Expected validation

  • pnpm check:changed

ClawSweeper already ran:

  • pnpm install was needed because vitest/package.json was missing.
  • pnpm test src/channels/typing.test.ts src/auto-reply/reply/typing-persistence.test.ts src/auto-reply/reply/reply-utils.test.ts passed.
  • pnpm test extensions/feishu/src/reply-dispatcher.test.ts passed.
  • Focused pnpm exec tsx -e ... race probe reproduced the stale persistent-state ordering.

Known review limits:

  • I did not run a live Feishu API test; the finding is based on the current callback ordering and Feishu’s local persistent-reaction state contract.

ClawSweeper Guardrails

  • Re-check the finding against latest main before changing code.
  • Keep the patch to the narrowest behavior change and matching regression coverage.
  • Do not merge automatically; this PR stays for maintainer review.

ClawSweeper 🐠 replacement reef notes:

  • Cluster: clawsweeper-commit-openclaw-openclaw-45b86450795d
  • Source PRs: none
  • Credit: Detected by ClawSweeper commit review for 45b8645.; Original commit author: Ayaan Zaidi.
  • Validation: pnpm check:changed

fish notes: model gpt-5.5, reasoning medium; reviewed against f903926.

@clawsweeper clawsweeper Bot added clawsweeper Tracked by ClawSweeper automation clawsweeper:commit-finding PR created from a ClawSweeper commit finding labels May 1, 2026
@clawsweeper

clawsweeper Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Codex review: needs maintainer review before merge. Reviewed May 31, 2026, 1:33 AM ET / 05:33 UTC.

Summary
The PR updates shared channel typing callbacks to track pending starts, send a final stop after cleanup races a successful pending start, and adds regression coverage for the race.

PR surface: Source +59, Tests +90. Total +149 across 2 files.

Reproducibility: yes. Current main clearly allows cleanup to run before Feishu records typingState, so the first stop can no-op and the later successful start can leave persistent typing behind.

Review metrics: 1 noteworthy metric.

  • Typing cleanup contract: 1 shared behavior changed. createTypingCallbacks can now send a second stop after a pending start settles, which affects bundled channels and plugin SDK consumers.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

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

Rank-up moves:

  • [P2] Record maintainer acceptance of the duplicate-stop cleanup semantics before merge.
  • Let exact-head CI finish for the refreshed head SHA.

Risk before merge

  • [P1] createTypingCallbacks is exported through plugin SDK channel subpaths; after this PR, stop callbacks may be invoked a second time when cleanup raced a successful pending start, so maintainers should accept that idempotent cleanup contract before merge.
  • [P1] No live Feishu API proof is attached; the review confidence comes from source-level ordering, regression tests, and the PR body's reported race probe.

Maintainer options:

  1. Accept duplicate-stop cleanup contract (recommended)
    Land after exact-head checks if maintainers accept that typing stop callbacks must tolerate one final duplicate call after a successful pending start races cleanup.
  2. Require stronger sibling-channel proof
    Ask for focused proof or tests around any sibling channel whose stop callback is not safely idempotent before merging the shared behavior change.
  3. Move persistence handling out of the shared helper
    If duplicate-stop semantics are not acceptable for the plugin SDK helper, replace this with a channel-owned pending-aware cleanup path for persistent indicators.

Next step before merge

  • [P2] The patch has no concrete automation-repair blocker, but the shared plugin-SDK-exported duplicate-stop behavior needs maintainer compatibility acceptance.

Security
Cleared: The diff only changes TypeScript source and tests for typing lifecycle behavior; it does not touch dependencies, workflows, secrets, auth, install scripts, or package metadata.

Review details

Best possible solution:

Land the focused shared-helper fix after exact-head validation if maintainers accept one final duplicate stop as the cleanup contract for pending persistent starts.

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

Yes. Current main clearly allows cleanup to run before Feishu records typingState, so the first stop can no-op and the later successful start can leave persistent typing behind.

Is this the best way to solve the issue?

Yes, with maintainer acceptance of the compatibility risk. Serializing cleanup in the shared helper is narrower than a Feishu-only patch and keeps typing start off the reply critical path while adding regression coverage.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: The PR addresses a normal-priority user-visible channel cleanup regression with limited blast radius.
  • merge-risk: 🚨 compatibility: The shared plugin-SDK-exported typing helper now permits a duplicate stop call in the pending-start cleanup race.
  • 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: This is a ClawSweeper bot repair PR, so the external-contributor real behavior proof gate does not apply; the PR body reports focused tests and a source-level race probe.
Evidence reviewed

PR surface:

Source +59, Tests +90. Total +149 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 69 10 +59
Tests 1 90 0 +90
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 159 10 +149

What I checked:

Likely related people:

  • obviyus: Commit 45b8645 made typing starts fire-and-forget in the shared and auto-reply typing paths that this PR is repairing. (role: introduced behavior under review; confidence: high; commits: 45b86450795d; files: src/channels/typing.ts, src/auto-reply/reply/typing.ts, src/channels/typing.test.ts)
  • Peter Steinberger: Recent current-main history and blame show normalization/refactor work touching the same typing helper and Feishu typing paths. (role: recent area contributor; confidence: medium; commits: 00d8d7ead059, 340247731416; files: src/channels/typing.ts, src/auto-reply/reply/typing.ts, extensions/feishu/src/reply-dispatcher.ts)
  • zhuisDEV: Related merged Discord reply typing lifecycle work provides sibling-channel context for typing cleanup behavior. (role: adjacent typing lifecycle contributor; confidence: medium; commits: 6f20f29688d7; files: extensions/discord/src/monitor/reply-typing-feedback.ts, extensions/discord/src/monitor/message-handler.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.

@clawsweeper

clawsweeper Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

🦞🔧
ClawSweeper picked up the repair feedback.

Source: clawsweeper[bot]
Feedback: structured ClawSweeper needs-human verdict with repairable P-severity findings (sha=a5f5ddb7830f31e58996be05cf855c8ba21c9c93)
Action: repair worker queued. Run: https://github.com/openclaw/clawsweeper/actions/runs/26704023373
Model: gpt-5.5

I will update this PR branch, or open a safe credited replacement, if the repair worker finds a narrow fix.

Automerge progress:

  • 2026-05-31 05:03:00 UTC review requested repair a5f5ddb7830f (structured ClawSweeper needs-human verdict with repairable P-severity findings...)

@clawsweeper clawsweeper Bot force-pushed the clawsweeper/clawsweeper-commit-openclaw-openclaw-45b86450795d branch from f903926 to a5f5ddb Compare May 1, 2026 04:46
@barnacle-openclaw

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@barnacle-openclaw barnacle-openclaw Bot added the stale Marked as stale due to inactivity label May 30, 2026
@clawsweeper clawsweeper Bot added the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label May 30, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 31, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels May 31, 2026
@clawsweeper clawsweeper Bot force-pushed the clawsweeper/clawsweeper-commit-openclaw-openclaw-45b86450795d branch from a5f5ddb to 73cb4c5 Compare May 31, 2026 05:25
@clawsweeper clawsweeper Bot force-pushed the clawsweeper/clawsweeper-commit-openclaw-openclaw-45b86450795d branch from 73cb4c5 to 1372565 Compare May 31, 2026 05:28
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: needs maintainer proof decision A ClawSweeper-authored PR needs a maintainer proof capture or override decision. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels May 31, 2026
@clawsweeper

clawsweeper Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

ClawSweeper status: this ClawSweeper-authored replacement PR is blocked on real behavior proof.

Reviewed head: 13725651dca881de7d288f8ebab6a930b9c79c0f
Proof status: not_applicable
Updated: 2026-06-11T11:32:37.217Z

Maintainer decision needed:

  • capture real behavior proof for this head
  • apply proof: override if the proof requirement should be waived
  • pause or close the replacement if proof should not be pursued

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:commit-finding PR created from a ClawSweeper commit finding clawsweeper Tracked by ClawSweeper automation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: needs maintainer proof decision A ClawSweeper-authored PR needs a maintainer proof capture or override decision.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants