fix(channels): recover failed progress draft starts#88749
Conversation
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(channels): recover failed progress draft starts This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 52b86b8493
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (startPromise) { | ||
| await startPromise; | ||
| return started; |
There was a problem hiding this comment.
Handle failed in-flight progress starts in noteWork
When a delayed or explicit draft start is already in flight and onStart rejects (for example a Telegram/Discord draft flush() or send/update failure while another progress event arrives), this await startPromise now rejects out of noteWork(). Before this change, concurrent noteWork() calls saw started and returned without throwing, while the timer path still swallowed the failed start and allowed retry; the new join path can abort the channel progress handler instead of reporting inactive and recovering. Please catch the joined startup failure here and return the post-failure active state so failed starts clear and subsequent work can retry consistently.
Useful? React with 👍 / 👎.
|
Land-ready verification for head Local/Testbox proof:
GitHub CI: all required PR checks green on the same head. Known proof gap: no live Discord/Telegram/Slack/Matrix/Teams network delivery run; the proof is focused shared-gate and channel caller coverage. |
Summary
Fixes #83115.
This keeps channel progress draft startup state honest when
onStartis async:hasStartednoteWork()joins active startup before reporting active/inactive stateVerification
Behavior addressed: Channel progress draft gates no longer report a failed startup as active, and progress updates arriving during startup/cancel races do not get dropped or leave stale drafts behind.
Real environment tested: Local OpenClaw checkout on branch
fix/progress-draft-start-state, rebased ontoorigin/mainat commit52b86b8493.Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/plugin-sdk/channel-streaming.test.ts extensions/telegram/src/bot-message-dispatch.test.ts extensions/discord/src/monitor/message-handler.process.test.ts extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts extensions/matrix/src/matrix/monitor/handler.test.ts extensions/msteams/src/reply-stream-controller.test.ts./node_modules/.bin/oxfmt --check src/channels/streaming.ts src/plugin-sdk/channel-streaming.test.ts extensions/discord/src/monitor/message-handler.draft-preview.ts extensions/telegram/src/bot-message-dispatch.ts extensions/slack/src/monitor/message-handler/dispatch.ts extensions/matrix/src/matrix/monitor/handler.ts extensions/msteams/src/reply-stream-controller.tsgit diff --check origin/main...HEADautoreview --mode localafter rebaseEvidence after fix:
git diff --check origin/main...HEADpassed.Observed result after fix: Rejected startup clears gate state and can retry; in-flight startup stays visible to finalization; cancel races resolve inactive; touched channel callers refresh active or just-started progress drafts.
What was not tested: Live Discord/Telegram/Slack/Matrix/Teams network delivery was not exercised; the proof is focused unit coverage of the shared gate and channel progress-draft callers.