mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
fix(telegram): gate sendMayHaveLanded retention to final context only
In update context, the caller doesn't treat 'retained' as success and falls through to sendPayload. Calling markDelivered() prematurely in update context can leave delivery state inconsistent.
This commit is contained in:
@@ -382,9 +382,11 @@ export function createLaneTextDeliverer(params: CreateLaneTextDelivererParams) {
|
||||
context,
|
||||
});
|
||||
if (typeof previewTargetAfterStop.previewMessageId !== "number") {
|
||||
// Only retain when a prior preview is already visible to the user —
|
||||
// otherwise falling back is safer than silence.
|
||||
if (lane.hasStreamedMessage && lane.stream?.sendMayHaveLanded?.()) {
|
||||
// Only retain for final delivery when a prior preview is already visible
|
||||
// to the user — otherwise falling back is safer than silence. For updates,
|
||||
// always fall back so the caller can attempt sendPayload without stale
|
||||
// markDelivered() state.
|
||||
if (context === "final" && lane.hasStreamedMessage && lane.stream?.sendMayHaveLanded?.()) {
|
||||
params.log(
|
||||
`telegram: ${laneName} preview send may have landed despite missing message id; keeping to avoid duplicate`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user