Skip to content

fix(feishu): avoid 400s on topic reaction hydration - #117685

Merged
steipete merged 2 commits into
mainfrom
codex/issue-34528-feishu-topic-reaction
Aug 1, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/issue-34528-feishu-topic-reaction

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #34528

What Problem This Solves

Fixes an issue where Feishu reactions in topic-scoped group sessions could still trigger an HTTP 400 when the reaction event did not already carry a thread_id. The topic hydration lookup was using OpenClaw's local synthetic reaction ID instead of the real Feishu message ID.

Why This Change Was Made

Reaction turns intentionally keep a unique synthetic ID for local deduplication and session routing. This change keeps that internal ID intact, while the one topic-hydration API call now consumes the explicit original reply target already carried by the reaction event; ordinary messages continue to use their own message ID.

User Impact

Feishu reaction-created and reaction-deleted events can stay in the correct topic for both group_topic and group_topic_sender session scopes without sending a :reaction:-suffixed ID to Feishu's message lookup API.

Evidence

  • Source trace: reaction normalization preserves the provider-issued message ID in reply_target_message_id while retaining the synthetic :reaction: ID only for local deduplication; getMessageFeishu forwards its argument directly to the Feishu im.message.get path parameter.
  • Focused trusted Testbox proof on the patch-identical tree later committed as 86321dc602c: node scripts/run-vitest.mjs extensions/feishu/src/bot.test.ts -t "hydrates topic threads from the real message ID" --reporter=verbose passed all four created/deleted × group_topic/group_topic_sender cases. Each case asserts the lookup receives the original reacted message ID and the resolved route uses the hydrated native topic. Targeted oxfmt --check also passed.
  • Exact-head hosted CI for 86321dc602c passed in run 30723728551, including check-prod-types, check-test-types, check-lint, check-additional-extension-package-boundary, changed Node shards, and build-artifacts.
  • Xhigh Codex autoreview and TruffleHog completed clean on the full branch diff.

@openclaw-barnacle openclaw-barnacle Bot added channel: feishu Channel integration: feishu size: S maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 7:44 PM ET / 23:44 UTC.

ClawSweeper review

What this changes

The PR changes Feishu topic-session hydration to query the original reacted-message ID instead of the synthetic local reaction ID, with regression coverage for created and deleted reactions in both topic session scopes.

Merge readiness

⛔ Blocked until real behavior proof is added - 3 items remain

The patch is a focused, source-supported repair for the linked Feishu reaction failure and has no blocking code-review finding. Current main still sends the synthetic reaction ID to topic hydration, but this protected PR needs completed redacted after-fix Feishu behavior proof before merge.

Priority: P2
Reviewed head: 86321dc602c475d675180735d10600fa99bc7a93
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation and focused regression coverage are solid, but the required after-fix real Feishu behavior evidence is absent.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR body describes a Testbox run as in progress but contains no completed redacted after-fix provider output, log, trace, screenshot, recording, or linked artifact demonstrating the repaired Feishu API path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body describes a Testbox run as in progress but contains no completed redacted after-fix provider output, log, trace, screenshot, recording, or linked artifact demonstrating the repaired Feishu API path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current-main defect: Current main hydrates a missing topic thread with ctx.messageId; for a synthetic reaction that value contains the local :reaction: suffix rather than a provider message ID.
Authoritative reaction anchor: The reaction-event owner deliberately keeps the synthetic ID only in message_id while storing the provider-issued message ID in reply_target_message_id for replies and topic routing.
Branch repair: The PR preserves the synthetic local ID and selects ctx.replyTargetMessageId ?? ctx.messageId only at the Feishu topic-hydration API boundary.
Findings None None.
Security None None.

How this fits together

Feishu reaction webhooks are converted into synthetic local turns so OpenClaw can deduplicate and route them without losing the original provider message facts. Topic-scoped group sessions may hydrate a missing native thread from Feishu before constructing the session route and sending the turn to the agent.

flowchart LR
  A[Feishu reaction webhook] --> B[Reaction event builder]
  B --> C[Synthetic local reaction turn]
  C --> D[Topic hydration decision]
  D --> E[Feishu message lookup]
  E --> F[Native topic session route]
  F --> G[Agent turn and reply]
Loading

Decision needed

Question Recommendation
Should this protected Feishu API repair merge without completed after-fix provider evidence, or should it retain the normal real-behavior proof gate? Require completed Feishu proof: Keep the PR open until it includes a redacted after-fix provider trace, log, terminal output, or recording that shows topic hydration uses the original message ID and no longer returns HTTP 400.

Why: Source and focused regression coverage support the patch, but only a completed after-fix Feishu run can establish the external API outcome required by repository policy.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body describes a Testbox run as in progress but contains no completed redacted after-fix provider output, log, trace, screenshot, recording, or linked artifact demonstrating the repaired Feishu API path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The PR body still describes Testbox proof as in progress and supplies no completed redacted after-fix Feishu trace, log, or receipt showing that topic hydration receives the real message ID and avoids the provider 400.
Agent review details

Security

None.

PR surface

Source +3, Tests +67. Total +70 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 3 +3
Tests 1 67 0 +67
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 73 3 +70

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the synthetic ID for OpenClaw-local deduplication and session routing, use the preserved reply target solely for the provider lookup, and attach completed redacted Feishu after-fix evidence before merging.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the synthetic ID for OpenClaw-local deduplication and session routing, use the preserved reply target solely for the provider lookup, and attach completed redacted Feishu after-fix evidence before merging.

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

Yes—source establishes the path: reaction events retain a synthetic messageId while preserving the real message ID as replyTargetMessageId, and current main passes the synthetic value to the Feishu lookup. The branch’s focused regression matrix encodes all four affected action/scope combinations, though this read-only review did not execute it.

Is this the best way to solve the issue?

Yes—the patch fixes the provider-boundary consumer while retaining the synthetic identifier for the local deduplication and routing contract. Globally stripping or replacing reaction IDs would risk breaking that local ownership boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2f06ed30d8b1.

Labels

Label justifications:

  • P2: This is a focused channel-routing regression that produces Feishu API errors for topic-scoped reaction turns, without evidence of broader runtime unavailability.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body describes a Testbox run as in progress but contains no completed redacted after-fix provider output, log, trace, screenshot, recording, or linked artifact demonstrating the repaired Feishu API path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current-main defect: Current main hydrates a missing topic thread with ctx.messageId; for a synthetic reaction that value contains the local :reaction: suffix rather than a provider message ID. (extensions/feishu/src/bot.ts:514, 2f06ed30d8b1)
  • Authoritative reaction anchor: The reaction-event owner deliberately keeps the synthetic ID only in message_id while storing the provider-issued message ID in reply_target_message_id for replies and topic routing. (extensions/feishu/src/monitor.account.ts:145, 2f06ed30d8b1)
  • Branch repair: The PR preserves the synthetic local ID and selects ctx.replyTargetMessageId ?? ctx.messageId only at the Feishu topic-hydration API boundary. (extensions/feishu/src/bot.ts:520, 86321dc602c4)
  • Regression matrix: The new parameterized test covers created and deleted reactions in group_topic and group_topic_sender, asserting both the provider lookup ID and the resulting native-topic session route. (extensions/feishu/src/bot.test.ts:2840, 86321dc602c4)
  • Feature provenance: Blame ties the current topic-hydration block to the same feature-history commit that also introduced the synthetic reaction message facts, so the repair stays within the owning Feishu flow. (extensions/feishu/src/bot.ts:514, 17eafa716248)
  • Current-main status: The PR head is not an ancestor of current main; current main retains the pre-fix lookup, so this work is still necessary rather than implemented or superseded. (extensions/feishu/src/bot.ts:524, 2f06ed30d8b1)

Likely related people:

  • steipete: Current blame attributes both the topic-hydration consumer and synthetic reaction metadata producer to Peter Steinberger, and this PR repairs their shared invariant. (role: feature-history contributor and current repair author; confidence: high; commits: 17eafa716248, 3a6a7de8439b, 86321dc602c4; files: extensions/feishu/src/bot.ts, extensions/feishu/src/monitor.account.ts, extensions/feishu/src/bot.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted after-fix Feishu evidence showing a topic reaction hydrates with the original om_... message ID and no longer receives HTTP 400.
  • Update the PR body with the completed receipt or artifact; that should trigger a fresh ClawSweeper review automatically, or a maintainer can comment @clawsweeper re-review if needed.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-01T23:21:00.223Z sha 3a6a7de :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T23:25:48.577Z sha 3a6a7de :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 1, 2026
@steipete steipete self-assigned this Aug 1, 2026
@steipete
steipete merged commit 6c41f37 into main Aug 1, 2026
94 checks passed
@steipete
steipete deleted the codex/issue-34528-feishu-topic-reaction branch August 1, 2026 23:49
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* fix(feishu): hydrate reaction topics with real ids

Fixes openclaw#34528

* fix(feishu): scope topic hydration id for errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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.

Feishu: reaction message_id with suffix causes 400 error on API calls

1 participant