openclaw/extensions/feishu
Lin Z a0b9dc0078
fix(feishu): use message create_time for inbound timestamps (#52809)
* fix(feishu): use message create_time instead of Date.now() for Timestamp field

When a message is sent offline and later retried by the Feishu client
upon reconnection, Date.now() captures the *delivery* time rather than
the *authoring* time.  This causes downstream consumers to see a
timestamp that can be minutes or hours after the user actually composed
the message, leading to incorrect temporal semantics — for example, a
"delete this" command may target the wrong resource because the agent
believes the instruction was issued much later than it actually was.

Replace every Date.now() used for message timestamps with the original
create_time from the Feishu event payload (millisecond-epoch string),
falling back to Date.now() only when the field is absent.  The
definition is also hoisted to the top of handleFeishuMessage so that
both the pending-history path and the main inbound-payload path share
the same authoritative value.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test(feishu): verify Timestamp uses message create_time

Add two test cases:
1. When create_time is present, Timestamp must equal the parsed value
2. When create_time is absent, Timestamp falls back to Date.now()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: revert unrelated formatting change to lifecycle.test.ts

This file was inadvertently formatted in a prior commit. Reverting to
match main and keep the PR scoped to the Feishu timestamp fix only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(feishu): use message create_time for inbound timestamps (#52809) (thanks @schumilin)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: George Zhang <georgezhangtj97@gmail.com>
2026-03-25 08:36:12 -07:00
..
skills feat(feishu): support Docx table create/write + image/file upload actions in feishu_doc (#20304) 2026-02-27 18:00:56 -06:00
src fix(feishu): use message create_time for inbound timestamps (#52809) 2026-03-25 08:36:12 -07:00
api.ts refactor: clean extension api boundaries 2026-03-17 09:38:21 -07:00
index.ts Plugins: fix pnpm check regressions 2026-03-17 23:25:40 +00:00
openclaw.plugin.json feat(feishu): replace built-in SDK with community plugin 2026-02-06 09:32:10 +09:00
package.json build: bump version to 2026.3.22 2026-03-22 11:58:33 -07:00
runtime-api.ts fix(plugin-sdk): remove relative extension boundary escapes (#51939) 2026-03-21 20:03:18 -05:00
setup-api.ts Feishu: break plugin-sdk setup cycle 2026-03-18 01:02:16 -07:00
setup-entry.ts refactor: dedupe channel entrypoints and test bridges 2026-03-16 23:52:23 -07:00