Repository navigation
fix: keep message updates inside Slack reply threads - #151069
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49e57344e4
ℹ️ 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".
| import { | ||
| resolveAndApplyOutboundReplyToId, | ||
| resolveAndApplyOutboundThreadId, | ||
| } from "../../../src/infra/outbound/message-action-threading.js"; |
There was a problem hiding this comment.
Keep the Slack regression test within the plugin boundary
This relative import escapes the Slack package and reaches a private core module. It also lets the test manually stitch core helpers to the Slack adapter instead of exercising the real message-tool entry point, so the test can remain green if production wiring stops propagating the reply source. Move the cross-boundary regression to the core owner-boundary suite or use an existing public SDK seam.
AGENTS.md reference: extensions/AGENTS.md:L29-L31
Useful? React with 👍 / 👎.
…151086) Preserve the composed Slack reply-thread regression from #151069 at the core outbound owner after #151080 removed the plugin-local test to repair the import boundary. Load Slack through its existing public channel artifact and inject only the existing transport sender. The regression verifies that an inherited child reply is sent to the original thread root through the real Slack adapter. No production behavior, SDK surface, dependency, or checker policy changes. Validation: exact-head CI run 35264465511 passed for 285b686; the native watcher reported GREEN with zero pending checks. The author recorded passing focused suites and a negative control that reproduced the original child-thread defect. Independent review and exact-head ClawSweeper review found no actionable findings. Related: #151069, #151080. Co-authored-by: pash-openai <[email protected]>
Move the reply-thread regression from #151069 into the core outbound test owner. Load the registered Slack plugin through the existing public-facade test loader and preserve reply, thread, and transport assertions without expanding the SDK.
…penclaw#151086) Preserve the composed Slack reply-thread regression from openclaw#151069 at the core outbound owner after openclaw#151080 removed the plugin-local test to repair the import boundary. Load Slack through its existing public channel artifact and inject only the existing transport sender. The regression verifies that an inherited child reply is sent to the original thread root through the real Slack adapter. No production behavior, SDK surface, dependency, or checker policy changes. Validation: exact-head CI run 35264465511 passed for 285b686; the native watcher reported GREEN with zero pending checks. The author recorded passing focused suites and a negative control that reproduced the original child-thread defect. Independent review and exact-head ClawSweeper review found no actionable findings. Related: openclaw#151069, openclaw#151080. Co-authored-by: pash-openai <[email protected]>
…51090) Move the reply-thread regression from openclaw#151069 into the core outbound test owner. Load the registered Slack plugin through the existing public-facade test loader and preserve reply, thread, and transport assertions without expanding the SDK.
…lures (#168738) ## What Problem This Solves Fixes Telegram final answers being replaced by a delivery warning after an ambiguous network failure, even though the completed answer is already saved. ## User Impact Telegram automatically re-delivers a saved ordinary text or rich-text final once, without running the model or completed tools again. A rare duplicate answer is possible when Telegram accepted the original send but its response was lost. Media, interactive or side-effect payloads, tool-initiated sends, known accepted chunks, identityless results, and untyped failures retain the existing no-blind-replay behavior. Other channels remain default-off. There is no new user setting or database schema. ## Why This Change Was Made **Maintainer decision:** reverse the automatic-resend exclusion in #155906 only for ordinary Telegram text finals, accepting the duplicate tradeoff. Preserve its accepted-content, partial-delivery, and visible-failure invariants. The proven-pre-connect recovery from #101024 remains unchanged. Telegram explicitly opts into the shared durable-delivery contract. The existing queue owns the saved prepared payload, exact send-attempt claim, two-attempt budget, backoff, recovery, and completion. The original caller waits for that recovery before reporting failure. Transcript-correlation metadata remains eligible without admitting controls; retries retain live authority checks and the last attempt's partial-delivery evidence. Transport diagnostics retain only bounded cause codes/syscalls, not request data. After exhaustion, the notice is `I couldn't deliver my reply because of a network problem. Please ask again.` when a typed network cause exists; otherwise it is `I couldn't deliver my reply. Please ask again.` Slack owner changes #151069 and #132928 do not overlap this diff. Follow-ups for Discord, Slack, and other channels must assess each transport's reconciliation and duplicate-prevention contract before opting in; this PR does not enable them. ## Evidence ### Real Telegram Test Server, live model All cases use the same isolated Gateway configuration: streaming off, rich messages enabled, a leased real-user observer, and a proxy that changes only the selected Bot API response. Each case records 90 seconds. Each candidate case made **one primary model request**; two auxiliary model requests and three embedding requests were tracked separately. No tools were requested or rerun. | Case | Userbot sent message | Observed replies | Result | | --- | --- | --- | --- | | Main before-forward drop | `83211845632` | `83212894208`: `I couldn't confirm the reply reached Telegram. Check OpenClaw chat history for the answer before retrying the task.` | No answer; only the old notice. | | Candidate before-forward drop | `83219185664` | `83220234240`: `SAVED_FINAL_repaired-before` | Saved answer automatically delivered; no failure notice. | | Candidate forward-then-drop | `83221282816` | `83222331392` and `83223379968`: both `SAVED_FINAL_repaired-duplicate` | First send was accepted upstream (HTTP 200, `ok:true`), then its response was lost; exactly one duplicate appeared, no third reply or notice. | | Candidate without fault | `83224428544` | `83225477120`: `SAVED_FINAL_repaired-plain` | One ordinary reply, no retry or notice. | The sent text in each row was `Reply with exactly <marker> and nothing else. Do not use tools.`, using the matching `SAVED_FINAL_<case>` marker. Baseline marker: `SAVED_FINAL_baseline-proof`. The before-forward proxy consumed the complete final-send request without forwarding it; the duplicate case forwarded it and discarded the accepted response. Baseline source: `f0a64d10805d2e7e21b4fa45235d8074a95e033d`. Candidate runtime: one immutable build of `2e2238f953bcd3c824e22384132d8e16c5977da3`, reused for all three cases. The final head adds a type-safe guard around transport diagnostic inspection, removes two invalid test-fixture variants, fixes a redundant type argument and a shadowed local name, and rebases onto green main; those changes do not alter the exercised reply path. No `dist/` copy or model stub was used. ### Regression and compatibility proof - The main-branch real final-delivery negative control fails because its caller settles before saved-text recovery. - **136 core/SQLite tests passed**, including waiting for recovery, two-attempt exhaustion, second-attempt partial acceptance, stale live authority during backoff/preparation, restart, and refusal cases. **31 existing Telegram lifecycle/HTTP tests passed.** - The final affected Telegram recovery and logging suites passed **9 tests across 2 files** (143.18 seconds including worker setup). They exercise matching transcript metadata, one model execution, saved-text retry, control refusal, and safe diagnostics. - **Stored-data compatibility:** existing storage/recovery fixtures without the new optional flags still load and retain their original behavior. Tests cover old-style unknown sends remaining non-replayable, exact same-millisecond claim fencing, ordinary stored options, and recovery after database reopen. No schema version changes or migrations are introduced. Only newly admitted Telegram finals gain explicit replay permission; the optional adapter classifier is absent for existing adapters. - Fresh independent adversarial review: **LAND**, no findings, on final head `a95b738575c6c10ee9922c25af2982d4548f20e4`. - Final exact-head hosted CI is running. The selected package/declaration boundary passed on the previous, behavior-identical head. Local package preparation timed out; hosted package validation is authoritative. Earlier TypeScript and lint failures were corrected; old-base SDK budget failures are no longer used as an exception after rebasing onto green main. ### Bounded cost The automatic policy is limited to **two total send attempts** for one saved ordinary final. It reuses existing backoff and persisted queue/claim fields; it adds no model/tool round trip, polling service, or schema. Refused payload classes do not gain a retry. The full owner/sibling run observed 136 core passes and 31 unchanged Telegram lifecycle passes; final affected suites took 143.18 seconds including worker setup. Hosted timing is available on the exact-head CI run. Simplification removed a redundant notice alias and unrelated success/suppression logging coverage. Remaining growth carries opt-in and typed ambiguity through the existing queue owner and protects the real transcript, restart, authority, and partial-delivery seams. Against the PR base: production **+454/-40**, tests **+449/-25**, docs **+19/-0**, across 31 files. Merge risk: reverting disables future automatic re-delivery, but cannot recall messages already delivered twice. The enabled user-facing blast radius is ordinary Telegram final text; shared queue claim changes retain exact attempt-ID/time fencing.
…lures (openclaw#168738) ## What Problem This Solves Fixes Telegram final answers being replaced by a delivery warning after an ambiguous network failure, even though the completed answer is already saved. ## User Impact Telegram automatically re-delivers a saved ordinary text or rich-text final once, without running the model or completed tools again. A rare duplicate answer is possible when Telegram accepted the original send but its response was lost. Media, interactive or side-effect payloads, tool-initiated sends, known accepted chunks, identityless results, and untyped failures retain the existing no-blind-replay behavior. Other channels remain default-off. There is no new user setting or database schema. ## Why This Change Was Made **Maintainer decision:** reverse the automatic-resend exclusion in openclaw#155906 only for ordinary Telegram text finals, accepting the duplicate tradeoff. Preserve its accepted-content, partial-delivery, and visible-failure invariants. The proven-pre-connect recovery from openclaw#101024 remains unchanged. Telegram explicitly opts into the shared durable-delivery contract. The existing queue owns the saved prepared payload, exact send-attempt claim, two-attempt budget, backoff, recovery, and completion. The original caller waits for that recovery before reporting failure. Transcript-correlation metadata remains eligible without admitting controls; retries retain live authority checks and the last attempt's partial-delivery evidence. Transport diagnostics retain only bounded cause codes/syscalls, not request data. After exhaustion, the notice is `I couldn't deliver my reply because of a network problem. Please ask again.` when a typed network cause exists; otherwise it is `I couldn't deliver my reply. Please ask again.` Slack owner changes openclaw#151069 and openclaw#132928 do not overlap this diff. Follow-ups for Discord, Slack, and other channels must assess each transport's reconciliation and duplicate-prevention contract before opting in; this PR does not enable them. ## Evidence ### Real Telegram Test Server, live model All cases use the same isolated Gateway configuration: streaming off, rich messages enabled, a leased real-user observer, and a proxy that changes only the selected Bot API response. Each case records 90 seconds. Each candidate case made **one primary model request**; two auxiliary model requests and three embedding requests were tracked separately. No tools were requested or rerun. | Case | Userbot sent message | Observed replies | Result | | --- | --- | --- | --- | | Main before-forward drop | `83211845632` | `83212894208`: `I couldn't confirm the reply reached Telegram. Check OpenClaw chat history for the answer before retrying the task.` | No answer; only the old notice. | | Candidate before-forward drop | `83219185664` | `83220234240`: `SAVED_FINAL_repaired-before` | Saved answer automatically delivered; no failure notice. | | Candidate forward-then-drop | `83221282816` | `83222331392` and `83223379968`: both `SAVED_FINAL_repaired-duplicate` | First send was accepted upstream (HTTP 200, `ok:true`), then its response was lost; exactly one duplicate appeared, no third reply or notice. | | Candidate without fault | `83224428544` | `83225477120`: `SAVED_FINAL_repaired-plain` | One ordinary reply, no retry or notice. | The sent text in each row was `Reply with exactly <marker> and nothing else. Do not use tools.`, using the matching `SAVED_FINAL_<case>` marker. Baseline marker: `SAVED_FINAL_baseline-proof`. The before-forward proxy consumed the complete final-send request without forwarding it; the duplicate case forwarded it and discarded the accepted response. Baseline source: `6df3d92c3994b1974cd7b342d163f41df4855950`. Candidate runtime: one immutable build of `2e2238f953bcd3c824e22384132d8e16c5977da3`, reused for all three cases. The final head adds a type-safe guard around transport diagnostic inspection, removes two invalid test-fixture variants, fixes a redundant type argument and a shadowed local name, and rebases onto green main; those changes do not alter the exercised reply path. No `dist/` copy or model stub was used. ### Regression and compatibility proof - The main-branch real final-delivery negative control fails because its caller settles before saved-text recovery. - **136 core/SQLite tests passed**, including waiting for recovery, two-attempt exhaustion, second-attempt partial acceptance, stale live authority during backoff/preparation, restart, and refusal cases. **31 existing Telegram lifecycle/HTTP tests passed.** - The final affected Telegram recovery and logging suites passed **9 tests across 2 files** (143.18 seconds including worker setup). They exercise matching transcript metadata, one model execution, saved-text retry, control refusal, and safe diagnostics. - **Stored-data compatibility:** existing storage/recovery fixtures without the new optional flags still load and retain their original behavior. Tests cover old-style unknown sends remaining non-replayable, exact same-millisecond claim fencing, ordinary stored options, and recovery after database reopen. No schema version changes or migrations are introduced. Only newly admitted Telegram finals gain explicit replay permission; the optional adapter classifier is absent for existing adapters. - Fresh independent adversarial review: **LAND**, no findings, on final head `a95b738575c6c10ee9922c25af2982d4548f20e4`. - Final exact-head hosted CI is running. The selected package/declaration boundary passed on the previous, behavior-identical head. Local package preparation timed out; hosted package validation is authoritative. Earlier TypeScript and lint failures were corrected; old-base SDK budget failures are no longer used as an exception after rebasing onto green main. ### Bounded cost The automatic policy is limited to **two total send attempts** for one saved ordinary final. It reuses existing backoff and persisted queue/claim fields; it adds no model/tool round trip, polling service, or schema. Refused payload classes do not gain a retry. The full owner/sibling run observed 136 core passes and 31 unchanged Telegram lifecycle passes; final affected suites took 143.18 seconds including worker setup. Hosted timing is available on the exact-head CI run. Simplification removed a redundant notice alias and unrelated success/suppression logging coverage. Remaining growth carries opt-in and typed ambiguity through the existing queue owner and protects the real transcript, restart, authority, and partial-delivery seams. Against the PR base: production **+454/-40**, tests **+449/-25**, docs **+19/-0**, across 31 files. Merge risk: reverting disables future automatic re-delivery, but cannot recall messages already delivered twice. The enabled user-facing blast radius is ordinary Telegram final text; shared queue claim changes retain exact attempt-ID/time fencing.
An ordinary message-tool update can escape a Slack thread when the user follows up inside an existing conversation. The tool inherits that new message’s timestamp, mistakes it for an explicitly selected destination, and skips the known thread root. Slack then receives a child timestamp where it requires the root.
Preserve the distinction between inherited and explicit reply targets during automatic thread resolution. Progress updates stay with their conversation; explicit destinations and intentional top-level sends retain their existing behavior. The regression covers the inherited reply path through Slack’s registered adapter.