Skip to content

Fix/telegram humandelay - #69879

Closed
Eruditi wants to merge 32 commits into
openclaw:mainfrom
Eruditi:fix/telegram-humandelay
Closed

Eruditi wants to merge 32 commits into
openclaw:mainfrom
Eruditi:fix/telegram-humandelay

Conversation

@Eruditi

@Eruditi Eruditi commented Apr 22, 2026

Copy link
Copy Markdown

Summary

Describe the problem and fix in 2–5 bullets:

If this PR fixes a plugin beta-release blocker, title it fix(<plugin-id>): beta blocker - <summary> and link the matching Beta blocker: <plugin-name> - <summary> issue labeled beta-blocker. Contributors cannot label PRs, so the title is the PR-side signal for maintainers and automation.

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause:
  • Missing detection / guardrail:
  • Contributing context (if known):

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
  • Scenario the test should lock in:
  • Why this is the smallest reliable guardrail:
  • Existing test that already covers this (if any):
  • If no new test is added, why not:

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Diagram (if applicable)

For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write N/A.

Before:
[user action] -> [old state]

After:
[user action] -> [new state] -> [result]

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: XS labels Apr 22, 2026
@greptile-apps

greptile-apps Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR wires the humanDelay configuration into the Telegram message dispatcher by importing resolveHumanDelayConfig from openclaw/plugin-sdk/agent-runtime and passing its result into dispatcherOptions when calling dispatchReplyWithBufferedBlockDispatcher. A focused unit test is added to verify the config is resolved and forwarded correctly.

Confidence Score: 5/5

Safe to merge — minimal, well-tested change with no logic or security concerns.

The change is a one-line addition in production code and a corresponding mock + assertion in tests. No edge-case risks, no security surface changes, and the new test correctly validates both the resolver call signature and the downstream option propagation.

No files require special attention.

Reviews (1): Last reviewed commit: "Merge branch 'openclaw:main' into fix/te..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 81fb47e37f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +125 to +127
vi.mock("openclaw/plugin-sdk/agent-runtime", () => ({
resolveHumanDelayConfig,
}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve other agent-runtime exports in test mock

Replace this full-module mock with a partial mock (importOriginal) or a local seam, because returning only resolveHumanDelayConfig removes other exports from openclaw/plugin-sdk/agent-runtime that bot-message-dispatch uses transitively (for example extensions/telegram/src/reasoning-lane-coordinator.ts imports formatReasoningMessage). In reasoning-tag scenarios (e.g. existing <think>... dispatch paths), Vitest will hit a missing export and fail the suite, so this change can make unrelated Telegram dispatch tests fail.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a31efc48c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +125 to +127
vi.mock("openclaw/plugin-sdk/agent-runtime", () => ({
resolveHumanDelayConfig,
}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve all agent-runtime exports in this module mock

This replaces the entire openclaw/plugin-sdk/agent-runtime module with only resolveHumanDelayConfig, which drops other named exports that Telegram dispatch dependencies still import and can cause runtime failures in this test file. Fresh evidence in the current tree: extensions/telegram/src/reasoning-lane-coordinator.ts still imports formatReasoningMessage from openclaw/plugin-sdk/agent-runtime and calls it in reasoning-tag paths, so those scenarios can throw when this mock is active. Prefer a partial mock or local seam so non-target exports remain intact.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd19f2a59d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


await dispatchWithContext({ context: createContext() });

expect(resolveHumanDelayConfig).toHaveBeenCalledWith(expect.any(Object), "test-agent");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Match humanDelay assertion to the context agent id

createContext() defaults route.agentId to "default", but this new assertion expects resolveHumanDelayConfig to be called with "test-agent"; that mismatch makes the new test fail even when the implementation is correct, which blocks CI and hides the real behavior under test. Either override the context route in this test or assert the default agent id value that is actually passed.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d6677025c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +125 to +127
vi.mock("openclaw/plugin-sdk/agent-runtime", () => ({
resolveHumanDelayConfig,
}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use partial mock for agent-runtime exports

This full-module mock replaces openclaw/plugin-sdk/agent-runtime with only resolveHumanDelayConfig, which strips other exports that this same test file's import graph still uses (notably reasoning paths that call formatReasoningMessage via reasoning-lane-coordinator.ts), causing runtime failures when those scenarios execute. Fresh evidence in this commit is the newly added full mock at this location while existing reasoning-stream tests in this file remain active.

Useful? React with 👍 / 👎.


await dispatchWithContext({ context: createContext() });

expect(resolveHumanDelayConfig).toHaveBeenCalledWith(expect.any(Object), "test-agent");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Assert the actual route agent ID in this new test

The new expectation hard-codes "test-agent", but this test calls createContext() without overrides, and that helper defaults route.agentId to "default", so the assertion fails even when behavior is correct. Fresh evidence in this commit is the new assertion here combined with the unchanged createContext default route in the same file.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90f02e5f51

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +125 to +127
vi.mock("openclaw/plugin-sdk/agent-runtime", () => ({
resolveHumanDelayConfig,
}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve non-target exports in agent-runtime mock

Replace this full-module mock with a partial mock, because returning only resolveHumanDelayConfig removes other openclaw/plugin-sdk/agent-runtime exports needed by this test file’s import graph; fresh evidence is that extensions/telegram/src/reasoning-lane-coordinator.ts still imports formatReasoningMessage from that module and is exercised by reasoning-lane dispatch scenarios in bot-message-dispatch.test.ts. When those scenarios run under this mock, Vitest can hit missing exports and fail unrelated Telegram dispatch tests.

Useful? React with 👍 / 👎.


await dispatchWithContext({ context: createContext() });

expect(resolveHumanDelayConfig).toHaveBeenCalledWith(expect.any(Object), "test-agent");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Assert the actual agent id passed by createContext

This expectation hard-codes "test-agent", but the same test calls createContext() without overrides and that helper defaults route.agentId to "default" (createContext base route), so the new test fails even if dispatchTelegramMessage is correct. Use the default id or override route.agentId in the test setup so the assertion matches the real input.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf814d93c8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +125 to +127
vi.mock("openclaw/plugin-sdk/agent-runtime", () => ({
resolveHumanDelayConfig,
}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep agent-runtime mock exports intact

Replace this full-module mock with a partial mock or local seam, because returning only resolveHumanDelayConfig removes other exports from openclaw/plugin-sdk/agent-runtime that the same import graph still uses. In this commit, bot-message-dispatch.ts continues to import ./reasoning-lane-coordinator.js, and reasoning-lane-coordinator.ts statically imports formatReasoningMessage; with the current mock, those paths can throw missing-export errors and fail unrelated dispatch tests.

Useful? React with 👍 / 👎.


await dispatchWithContext({ context: createContext() });

expect(resolveHumanDelayConfig).toHaveBeenCalledWith(expect.any(Object), "test-agent");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Assert the agent id actually passed by createContext

This assertion hard-codes "test-agent", but this test calls createContext() with no route override, and the helper defaults route.agentId to "default" (same file), so the new test fails even when dispatchTelegramMessage is correct. Either override context.route.agentId in this test or assert the default value that is actually passed.

Useful? React with 👍 / 👎.

@prtags

prtags Bot commented Apr 23, 2026 •

Copy link
Copy Markdown

Related work from PRtags group relieved-martin-3rs3

Title: Open PR duplicate: Telegram block-stream humanDelay

Number Title
#69022 Fix: apply humanDelay between Telegram streamed block replies (Resolves #68945)
#69879* Fix/telegram humandelay
#69888 Fix/chat bubble copy padding

* This PR

@prtags prtags Bot mentioned this pull request Apr 23, 2026
6 of 25 tasks
@clawsweeper

clawsweeper Bot commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

Closing this as duplicate or superseded after Codex automated review.

PR #69879 is a duplicate/superseded Telegram humanDelay fix. Current main still lacks the Telegram wiring, but the same remaining bug is already tracked by the earlier open PR #69022, which directly resolves #68945, uses the local Telegram runtime seam, has a focused test, and has maintainer triage calling it the better humanDelay PR. #69879 also has unresolved review findings around its whole-module test mock and hard-coded agent id assertion.

Best possible solution:

Close #69879 as duplicate/superseded and keep #69022 as the canonical implementation path for #68945. Maintainers should land #69022, or an equivalent local-runtime-barrel fix, once review state is acceptable; #68945 should remain open until that fix ships.

What I checked:

So I’m closing this here and keeping the remaining discussion on the canonical linked item.

Codex Review notes: model gpt-5.5, reasoning high; reviewed against 8bbb143ab87e.

@clawsweeper clawsweeper Bot closed this Apr 26, 2026
@Eruditi
Eruditi deleted the fix/telegram-humandelay branch April 27, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant