Skip to content

feat(feishu): let agents resend received stickers - #130374

Merged
steipete merged 3 commits into
mainfrom
codex/fix-114578-feishu-stickers
Aug 26, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/fix-114578-feishu-stickers

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Implements the received-sticker sending portion of #114578. Keyword-based sticker search remains unimplemented; keep the issue open for that remaining request.

What Problem This Solves

Feishu agents can react to messages but cannot resend a sticker. Received sticker keys are discarded, and the inbound path attempts a resource download that Feishu does not support.

Why This Change Was Made

Add the existing shared sticker action behind channels.feishu.actions.sticker: true, also configurable per account. Send a received file_key through fileId or the first stickerId, using the same bot account that received it. Discovery and model guidance respect the selected account's opt-in.

The Feishu plugin remains the owner: sticker delivery reuses the existing keyed-media sender, reply/fallback policy, and delivery receipts. This removes the duplicated direct file/audio/video send branch. Inbound and merged-forward content preserve a bounded, escaped sticker key without downloading resource bytes. No sticker-store search, upload, new dependency, cache, database, or core action/schema field is introduced.

Independent review also exposed an existing topic-routing defect: sending from a topic session to another chat could still address the source topic's message ID. The shared text/card/media/sticker anchor now inherits context only for the same conversation/provider/account, honors top-level opt-outs, and uses the existing outbound reply/thread selector for explicit routing.

Production LOC: +126/-90 (net +36) | Tests: +357/-11. The growth adds the new opt-in action and its routing boundary; generated metadata, the shrink-only assertion baseline, and documentation are counted separately.

User Impact

After enabling the action and sending a sticker to the bot, users can ask it to resend that sticker. Existing accounts remain opted out. An account-level actions object retains the existing replacement semantics, so include any other desired action gates when overriding it. Text, media, and sticker actions no longer inherit an unrelated source topic when their destination or account changes.

The official Lark message content reference documents msg_type: "sticker", JSON file_key, and the received-by-this-bot restriction. The pinned SDK 1.73.0 source and types independently match that request shape and explicitly exclude sticker resource downloads. See Feishu sticker replies for enablement.

Evidence

  • Before implementation, focused tests reproduced rejected configuration, missing action discovery/dispatch, discarded inbound keys, and attempted unsupported downloads. Separate regressions reproduced source-topic leakage for cross-chat sends, top-level opt-outs, and differing source accounts.
  • After the fix: 814 tests passed across 15 Feishu suites, covering channel/config, inbound content, media, direct/thread/retry/fallback/concurrent sends, receipts, durable outbound delivery, and reply dispatch. Prepared implicit replies retain topic routing; explicit replies retain normal-reply precedence. On current head 437416a95137, a fresh independent account/config/channel run passed 304 tests and the lead's inbound/SDK-transport/outbound-delivery rerun passed 164 tests: 468 tests across seven suites rerun on the final head.
  • Fresh/upgrade configuration proof: both independent review and the lead exercised the real account resolver and action gate without mocks. Existing channel reactions: false is inherited when an account has no action override; account {sticker: true} retains the existing replacement semantics and restores reactions' default; the documented {reactions: false, sticker: true} example preserves the reaction gate while opting into stickers. No configuration migration or persisted-state change is required.
  • The real Lark SDK and Axios transport complete a local HTTP authentication exchange, create a sticker, reply in a thread, reject fallback from a withdrawn thread, and perform no sticker-resource download. This is deterministic local transport proof, not live Feishu delivery.
  • Changed-file formatting, direct lint, git diff --check, generated channel metadata, and all 1,203 validated documentation configuration examples passed. The local changed gate passed its guards, doctor tests, boundary/dependency checks, and dead-export scans, then stopped at unrelated stale dependency type errors (Google SDK, markdown-it, and TUI declarations) in the shared worktree. A delegated Testbox attempt timed out during source sync before running checks and was stopped.
  • Fresh-install CI run 33010108759 validates code head fbbe8e0fe017ebe34d51ad87465b59cff8fe485e: build, production types, test types, JavaScript test lanes, configuration checks, and macOS Swift passed. The first lint attempt received a runner shutdown signal and exited 143 without a lint finding. After canceling the unrelated unfinished iOS lane, the targeted lint retry ended with the same shutdown signal and exit 143. Hosted lint remains incomplete; canceled iOS jobs are not passes, and this is not a green overall-CI claim.
  • Current head 437416a95137e734a3c245397a76efcfdb97d88c adds only the account-action replacement warning and example requested by review. It changes no production code or tests; the documentation configuration check and docs-only autoreview passed. Normal exact-head PR CI run 33015456132 is green, including lint, build, types, and the selected plugin/configuration compatibility tests. This current-head run supersedes the incomplete older manual proof above.
  • Fresh structured Codex pre-land autoreview of the complete branch: both review passes completed with zero accepted/actionable findings. Independent integration review's topic-routing finding was repaired and covered before publication; a fresh independent config/routing review also found no defect.

Review follow-through: the account-action documentation finding is addressed beside the opt-in example. No persistent data model changed: the generated metadata diff adds only the channel/account actions.sticker booleans, and the JSON in inbound tests is a message fixture, not stored state. The maintainer explicitly accepted best-effort validation because no authorized Feishu/Lark bot or received sticker key is available. Authenticated delivery remains unverified; the SDK fixture is not described as live proof.

Proof boundary and landing prerequisites

An authenticated live Feishu/Lark send has not been performed. No authorized bot credentials and received sticker key are available. The maintainer explicitly directed proceeding with best-effort proof: failing/passing owner-boundary regressions, independent review, inspected vendor SDK/source contracts, and real SDK/Axios requests against a local HTTP fixture. This does not establish authenticated Feishu acceptance. A future live check should receive and resend a sticker into a direct chat and a topic using the same authorized bot account. Required exact-head CI and native landing validation remain prerequisites.

Thanks @zw-xysk for the feature request in #114578.

Add opt-in agent sticker sending using received file keys, preserve inbound keys, and stop unsupported sticker resource downloads. Reuse keyed-media delivery and canonical reply selection; inherit source topics only within the same destination and account. Related: #114578.
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: feishu Channel integration: feishu size: L maintainer Maintainer-authored PR labels Aug 26, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 5:35 PM ET / 21:35 UTC.

ClawSweeper review

What this changes

The PR adds an opt-in Feishu sticker action that resends a sticker already received by the same bot and fixes topic reply anchoring when a send target or account changes.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

This protected maintainer PR appears coherent and has no concrete patch defect from source review, but it should stay open for human landing review until the queued exact-head checks complete.

Priority: P3
Reviewed head: 437416a95137e734a3c245397a76efcfdb97d88c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has focused owner-boundary coverage and no supported correctness finding; exact-head CI and the accepted live-delivery boundary remain landing gates.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer PR documents an authenticated Feishu-delivery limitation and has a maintainer-accepted local real-SDK/Axios transport proof; no external-contributor proof action is required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer PR documents an authenticated Feishu-delivery limitation and has a maintainer-accepted local real-SDK/Axios transport proof; no external-contributor proof action is required.
Evidence reviewed 6 items Action owner boundary: The Feishu plugin advertises the sticker action only for enabled configured accounts, validates its key, applies the canonical reply anchor, and delegates delivery through its runtime facade.
Inbound and outbound behavior: Sticker content preserves a bounded external key without resource download, while the sender uses the existing account-selected target and reply/fallback helper.
Focused behavioral coverage: The local SDK/Axios loopback test verifies sticker create/thread request shapes and confirms sticker resource download is skipped; channel tests cover the per-account gate and topic-routing cases.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/feishu/src/message-content-loopback.test.ts

Result: PASS (completed)

[test] starting test/vitest/vitest.extension-feishu.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130374-8PjUvJ/target

stdout | extensions/feishu/src/message-content-loopback.test.ts › Feishu message content over the real Lark SDK › authenticates message reads and sticker sends
without exposing malformed content
[info]: [ 'client ready' ]

 ✓  extension-feishu  extensions/feishu/src/message-content-loopback.test.ts (1 test) 70ms

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  21:36:08
   Duration  25.00s (transform 20.66s, setup 64ms, import 24.53s, tests 70ms, environment 0ms)

[test] passed 1 Vitest shard in 31.19s
[test] starting test/vitest/vitest.extension-feishu.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130374-8PjUvJ/target

stdout | extensions/feishu/src/message-content-loopback.test.ts › Feishu message content over the real Lark SDK › authenticates message reads and sticker sends
without exposing malformed content
[info]: [ 'client ready' ]

 ✓  extension-feishu  extensions/feishu/src/message-content-loopback.test.ts (1 test) 69ms

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  21:36:40
   Duration  10.48s (transform 6.45s, setup 30ms, import 10.16s, tests 69ms, environment 0ms)

[test] passed 1 Vitest shard in 16.65s

Assertions:

  • PASS expect_output: 1 passed

How this fits together

The Feishu plugin parses inbound sticker messages, makes an account-gated action visible to the agent, and routes that action through the plugin’s existing Feishu delivery and reply helpers. The output is a direct or threaded Feishu message plus a delivery receipt.

flowchart LR
  A[Inbound Feishu sticker] --> B[Sticker key parser]
  B --> C[Agent message action]
  C --> D[Account action gate]
  D --> E[Reply and topic anchor]
  E --> F[Feishu media sender]
  F --> G[Feishu message API]
  G --> H[Delivery receipt]
Loading

Before merge

  • Resolve merge risk (P1) - Account-level actions objects retain replacement semantics, so operators adding a per-account sticker gate must repeat any other desired action gates; the docs now warn about this, but exact-head configuration checks are still pending.
  • Resolve merge risk (P1) - The PR body deliberately does not claim authenticated Feishu delivery; the local transport test proves request construction, not vendor acceptance.
  • Resolve merge risk (P1) - The vendor SDK source/types could not be re-inspected in this environment because dependencies and network access are unavailable.
  • Complete next step (P2) - The maintainer/protected-label PR has no narrow repair finding; exact-head CI and acceptance of the stated authenticated-delivery boundary require maintainer handling.
Agent review details

Security

None.

PR surface

Source +36, Tests +346, Docs +50, Generated 0, Other 0. Total +432 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 7 126 90 +36
Tests 6 357 11 +346
Docs 1 50 0 +50
Config 0 0 0 0
Generated 1 15 15 0
Other 1 1 1 0
Total 16 549 117 +432

Review metrics

Metric Value Why it matters
Production versus tests production +126/-90 (net +36); tests +357/-11; docs +50; generated metadata +15/-15 The positive production change adds a new opt-in channel capability and consolidates delivery routing; test growth covers account gates, media delivery, and topic anchors.
Configuration surface 1 optional action gate added at channel and account scope The new default-off setting is upgrade-sensitive because account action objects replace, rather than merge with, channel actions.

Stored data model

Persistent data-model change detected: serialized state: extensions/feishu/src/bot.helpers.test.ts, unknown-data-model-change: src/config/bundled-channel-config-metadata.generated.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #114578
Summary: This PR explicitly presents itself as the implementation candidate for the Feishu sticker feature request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Validate existing account configurations (recommended)
    Complete exact-head configuration checks confirming the documented per-account action replacement behavior before merge.

Technical review

Best possible solution:

Land only after exact-head CI is green and a maintainer accepts the documented best-effort proof boundary; retain the default-off account gate and the explicit replacement-semantics documentation.

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

Not applicable to the primary feature request; the included routing repair has source and local-test coverage, while authenticated Feishu delivery requires an authorized bot and received sticker key.

Is this the best way to solve the issue?

Yes, subject to pending contract and CI evidence: the feature stays in the owning Feishu plugin and reuses existing target, reply, and receipt paths rather than adding core or storage behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is an opt-in Feishu feature with no evidence of an urgent existing-user outage.
  • merge-risk: 🚨 compatibility: Per-account action replacement can alter an operator’s other enabled actions when adding the new sticker gate.
  • 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 maintainer PR documents an authenticated Feishu-delivery limitation and has a maintainer-accepted local real-SDK/Axios transport proof; no external-contributor proof action is required.

Evidence

What I checked:

  • Action owner boundary: The Feishu plugin advertises the sticker action only for enabled configured accounts, validates its key, applies the canonical reply anchor, and delegates delivery through its runtime facade. (extensions/feishu/src/channel.ts:1163, 437416a95137)
  • Inbound and outbound behavior: Sticker content preserves a bounded external key without resource download, while the sender uses the existing account-selected target and reply/fallback helper. (extensions/feishu/src/bot-content.ts:179, 437416a95137)
  • Focused behavioral coverage: The local SDK/Axios loopback test verifies sticker create/thread request shapes and confirms sticker resource download is skipped; channel tests cover the per-account gate and topic-routing cases. (extensions/feishu/src/message-content-loopback.test.ts:1, 437416a95137)
  • Configuration contract and docs: The strict schema adds only an optional sticker boolean, and the docs name the default-off behavior plus account action replacement semantics. (extensions/feishu/src/config-schema.ts:16, 437416a95137)
  • Dependency-contract limitation: The changed loopback test imports the Lark SDK, so the vendor request contract is relevant; this read-only checkout has no node_modules and network name resolution failed, preventing direct SDK source/type inspection. (extensions/feishu/src/message-content-loopback.test.ts:4, 437416a95137)
  • History and release limitation: The checkout is a grafted PR head with no accessible base or preceding PR commits; its head is not contained by any locally available tag, so current-main and shipped-release provenance cannot be independently established here. (437416a95137)

Likely related people:

  • steipete: The retained head’s relevant source blame and all visible PR commits attribute this Feishu work to Peter Steinberger; deeper main history is unavailable in this grafted checkout. (role: current Feishu implementation contributor; confidence: low; commits: 1691f8739037, fbbe8e0fe017, 437416a95137; files: extensions/feishu/src/channel.ts, extensions/feishu/src/media.ts, extensions/feishu/src/bot-content.ts)

Rank-up moves

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

  • Wait for the exact-head CI checks to complete green.
  • When credentials and a received sticker key become available, capture a redacted direct-chat and topic resend trace.

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-26T20:27:10.286Z sha fbbe8e0 :: found issues before merge. :: [P2] Explain account action replacement semantics
  • reviewed 2026-08-26T20:55:16.687Z sha 437416a :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 21:27
@steipete steipete self-assigned this Aug 26, 2026
@steipete

steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Pre-merge verification for 437416a95137e734a3c245397a76efcfdb97d88c:

The Feishu plugin now preserves received sticker keys and exposes an opt-in resend action through its existing keyed-media delivery owner. The same repair removes unsupported sticker downloads and duplicated direct file/audio/video sending. Topic routing is resolved once at the action owner, with same-destination/account checks, top-level opt-outs, and correct explicit-versus-implicit reply precedence.

Current-head local commands:

node scripts/run-vitest.mjs extensions/feishu/src/config-schema.test.ts extensions/feishu/src/channel.test.ts extensions/feishu/src/accounts.test.ts
node scripts/run-vitest.mjs extensions/feishu/src/message-content-loopback.test.ts extensions/feishu/src/bot.helpers.test.ts extensions/feishu/src/outbound.test.ts extensions/feishu/src/outbound-delivery.test.ts
node scripts/check-docs-config-examples.mjs
git diff --check c3d95c2d8071539aa66b4adce1da96ef8e32c3b4..HEAD

Results: 304 + 164 tests passed across seven current-head suites; the earlier broader run passed 814 tests across 15 suites on code-identical fbbe8e0. All 1,203 validated documentation configuration examples passed. A separate unmocked account-resolver/action-gate probe confirmed inherited, replaced, and explicitly preserved reaction gates. Fresh full-branch Codex autoreview completed both passes with zero accepted/actionable findings.

Exact-head CI run 33015456132 is green, including lint. Earlier manual lint attempts were interrupted by runner shutdowns; no source workaround was added. Production LOC is +126/-90 (net +36) for the new opt-in capability and routing boundary; tests are +357/-11. No persistence or schema-version change is present.

ClawSweeper follow-through: account-action replacement semantics are documented and independently tested; SDK 1.73.0 source/types were directly inspected; the PR description now records changes, proof, and remaining risk. Authenticated Feishu delivery and screenshots remain unavailable because no authorized bot or received key exists. The maintainer explicitly accepted best-effort validation. The real SDK/Axios local HTTP fixture proves request shaping and reply behavior, not live vendor acceptance; that limitation is not hidden or presented as live proof.

Scope clarification: this implements the received-sticker sending portion of #114578, not keyword-based search. The issue will remain open for that unimplemented portion; the PR no longer carries an auto-closing keyword.

Proceeding through native preparation and pinned-head merge. Thanks @zw-xysk for #114578.

@steipete
steipete merged commit 1f60d9e into main Aug 26, 2026
305 checks passed
@steipete
steipete deleted the codex/fix-114578-feishu-stickers branch August 26, 2026 22:01
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 26, 2026
* origin/main: (275 commits)
  fix(ai): require explicit compatible-provider endpoints (#130453)
  test(control-ui): guard the hand-mirrored theme --bg copies (#130444)
  fix(onboard): preserve the saved skills package manager (#130438)
  improve(worker): diagnose admission-deadline failures and widen daemon revalidation budget (#130435)
  fix(plugins): align diffs external install metadata (#130362)
  refactor(models): consolidate config normalization (#130439)
  fix(browser): accept common keyboard aliases (#130401)
  fix(release): refresh IMAP plugin baselines (#130351)
  fix(tests): type sticky model agent fixtures (#130441)
  fix(qa): track current Slack progress cards (#130354)
  feat(ui): refine the mobile composer (#130308)
  fix(ui): clarify gateway disconnect status in tab title (#130364)
  test(qa): await gateway startup before network probes (#130353)
  fix(qa): run Buzz profile scenarios with pooled credentials (#130316)
  fix(crabbox): keep the setup failure reason and name its phase (#130425)
  fix: dashboard tools target the wrong Gateway after admission (#130112)
  fix(ui): distinguish inherited model defaults from session pins (#120805)
  feat(feishu): let agents resend received stickers (#130374)
  refactor(models): prepare selection policy once (#130413)
  fix(ui): make dashboard side panels enter split view (#130426)
  ...

# Conflicts:
#	test/scripts/docker-build-helper.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
* feat(feishu): resend received stickers without losing topic routing

Add opt-in agent sticker sending using received file keys, preserve inbound keys, and stop unsupported sticker resource downloads. Reuse keyed-media delivery and canonical reply selection; inherit source topics only within the same destination and account. Related: openclaw#114578.

* fix(feishu): preserve topic mode for prepared implicit replies

* docs(feishu): preserve account action gates when enabling stickers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: feishu Channel integration: feishu docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant