Repository navigation
fix(slack): reconcile ambiguous sends before replay - #97480
Conversation
|
Codex review: needs changes before merge. Reviewed July 5, 2026, 4:42 AM ET / 08:42 UTC. Summary PR surface: Source +688, Tests +1008. Total +1696 across 24 files. Reproducibility: yes. Source-level reproduction is high-confidence: a mocked Slack history or replies response with has_more true, returned messages, and no next_cursor still exits the scan before the older page, and the bundled Slack setup lacks the metadata-read scope needed for marker visibility. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Fix the Slack pagination and metadata-scope/setup gaps, then have maintainers explicitly accept the additive durable-send SDK surface as the Slack text slice of the broader durable delivery contract. Do we have a high-confidence way to reproduce the issue? Yes. Source-level reproduction is high-confidence: a mocked Slack history or replies response with has_more true, returned messages, and no next_cursor still exits the scan before the older page, and the bundled Slack setup lacks the metadata-read scope needed for marker visibility. Is this the best way to solve the issue? No, not yet. Authenticated metadata plus dispatch persistence is the right layer for exact Slack reconciliation, but the scanner and Slack setup contract need repair before this is the best fix. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 53bd4dde6c00. Label changesLabel justifications:
Evidence reviewedPR surface: Source +688, Tests +1008. Total +1696 across 24 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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
Review history (4 earlier review cycles)
|
|
Land-ready rewrite pushed at What changed:
Verification:
Known proof gap: the live smoke directly exercised post + reconciliation but did not inject a network failure after Slack commit and before HTTP response. Unit coverage exercises that recovered unknown-state path and rejects missing, incomplete, copied, or conflicting markers. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3505216acb
ℹ️ 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".
| channel: params.channelId, | ||
| oldest: params.oldest, | ||
| latest: params.latest, | ||
| include_all_metadata: true, |
There was a problem hiding this comment.
Add Slack metadata read scope for reconciliation
When Slack is installed from the bundled manifest, the bot scopes in extensions/slack/src/setup-shared.ts include the *:history scopes but not metadata.message:read; Slack documents that scope as the permission that lets an app read message metadata. This new reconciliation path depends on include_all_metadata returning the openclaw_delivery_* marker, so after a crash an existing/default Slack install can read history without the marker, classify the send as unresolved, and eventually fail the queued delivery even though the message was already posted. Update the Slack manifest/setup scope checks (and upgrade guidance) with metadata.message:read before advertising metadata-backed durable reconciliation.
Useful? React with 👍 / 👎.
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d7845d61d
ℹ️ 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".
| "./internal/*": { | ||
| "types": "./dist/internal/*.d.mts", | ||
| "import": "./dist/internal/*.mjs", | ||
| "default": "./dist/internal/*.mjs" | ||
| } |
There was a problem hiding this comment.
Restrict internal export pattern to built files
When @openclaw/ai is installed from npm, this wildcard makes Node treat every packages/ai/src/internal/*.ts file as an exported subpath, but tsdown.ai.config.ts only builds internal/anthropic, internal/openai, internal/runtime, and internal/shared. The source tree also contains internal/default-runtime.ts, so import "@openclaw/ai/internal/default-runtime" is advertised by this export map but resolves to dist/internal/default-runtime.mjs, which is never emitted. Either add a build entry for each exported internal file or replace the wildcard with explicit built subpaths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7861c2aa1
ℹ️ 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".
| const nextCursor = normalizeOptionalString(response.response_metadata?.next_cursor); | ||
| if (!nextCursor) { | ||
| if (response.has_more === true) { | ||
| break; |
There was a problem hiding this comment.
Continue Slack time pagination when cursors are absent
When the recovered send lands outside the first history page in a busy channel/thread, Slack's documented time pagination uses has_more plus the final returned message timestamp as the next latest boundary (see conversations.history/conversations.replies docs); this branch stops as soon as Slack omits response_metadata.next_cursor. In that case reconciliation never scans the older page containing the delivery marker, so an already-posted durable send is classified as unresolved and can be moved to failed after retries.
Useful? React with 👍 / 👎.
Co-authored-by: Joey Frasier (Boothe) <[email protected]>
|
Merged via squash.
|
What Problem This Solves
Slack can commit a final message while the local sender loses the response. Recovery previously had no exact provider-side proof for that ambiguous outcome, so replay could duplicate the final answer or conservative recovery could strand the queue entry.
Why This Change Was Made
chat.postMessage.User Impact
Ambiguous Slack final text sends can now be proven from Slack history and acknowledged without posting a duplicate. Thread replies, user-targeted DMs, message chunking, multiple Slack token views, hook-adjusted reply targets, and recovery restarts retain the exact route needed for reconciliation.
Evidence
tbx_01kwrgzyhjs49jghs77at7gg96;pnpm check:changedpassed core and extension typechecks, exhaustive lint, import-cycle checks, database-first storage guards, and related changed-surface checks. Actions run: https://github.com/openclaw/openclaw/actions/runs/28732610689CHANGELOG.mdfor release generation.