Skip to content

fix(line): pace block replies with the agent's humanDelay - #133443

Merged
steipete merged 1 commit into
openclaw:mainfrom
edenfunf:fix/line-human-delay
Aug 30, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
edenfunf:fix/line-human-delay

Conversation

@edenfunf

Copy link
Copy Markdown
Contributor

Fixes #133430

What Problem This Solves

agents.defaults.humanDelay — and its per-agent agents.entries.*.humanDelay
override — was accepted on LINE and silently did nothing. Block replies arrived
back-to-back no matter what pause was configured, and nothing in doctor,
startup, or the logs said the channel was ignoring it.

Only createReplyDispatcher can act on the setting: it reads
options.humanDelay and sleeps before every block after the first. options
comes from the turn's dispatcherOptions, and LINE's turn never set one, so the
value resolved to undefined on every turn.

Why This Change Was Made

This is the same defect Telegram had in #68945, fixed in #69022 by forwarding the
resolved config into that channel's dispatcherOptions. This gives LINE the same
wiring — one line at the one seam that owns it — rather than adding a second
pacing mechanism.

It resolves from turnConfig, not the monitor's captured config. Admission
already re-read the live config for this event and the delivery path runs on that
same one, so a humanDelay edited while the gateway is running takes effect on
the very next turn instead of the next restart.

User Impact

On LINE, a configured humanDelay now paces block replies: each block after the
first waits the configured interval, so a multi-message answer arrives at a human
rhythm instead of all at once. off (the default) is unchanged — no delay, no
new behavior for anyone who has not set the option.

Evidence

Live: real LINE channel, same three-block answer, both sides of the fix

An agent turn that produces three assistant blocks, with
blockStreamingDefault: "on" and humanDelay: { mode: "custom", minMs: 8000, maxMs: 8000 }. Timing runs from webhook delivery until the channel's push-quota
counter reflects all four sends:

label=BEFORE-main    quota 166 -> 170  elapsed=2.9s
label=AFTER-fix      quota 171 -> 175  elapsed=19.6s
label=AFTER-fix-run2 quota 175 -> 179  elapsed=18.4s

The quota moving by 4 shows LINE delivers each block as its own push, so the
dispatcher path that applies the delay is the one in use. The ~16s difference is
the two paced gaps the setting asks for: the first block and the final reply are
not delayed, so three blocks produce two 8s pauses.

Regression coverage

monitor.lifecycle.test.ts asserts the turn LINE hands to core carries the
resolved humanDelay, and uses a per-agent entry that differs from the defaults
so a turn reading the wrong scope fails rather than passing on a lucky match.

Reverting the change fails it with
expected undefined to deeply equal { mode: 'custom', minMs: 3000, … }.

The same test file's two existing turn-adapter cases passed an empty delivery
control, a state admission cannot produce — they now pass the live config the
real path always supplies.

Checks

$ node scripts/run-vitest.mjs extensions/line
 Test Files  47 passed (47)
      Tests  696 passed (696)

$ node scripts/check-changed.mjs
(exit 0)

Sibling surfaces

Seven other channels declare blockStreaming: true and also never forward the
setting — clickclack, googlechat, irc, nextcloud-talk, reef, zalo,
zalouser. I verified the mechanism end to end on LINE only, so they are named
in #133430 as follow-up rather than changed blind here. Worth noting for whoever
picks those up: humanDelay is the one dispatcherOptions field that is neither
channel-specific nor a callback — every channel resolves it from the same agent
config the same way, so absorbing it into resolveAssembledReplyPipeline would
fix all eight at once and delete eleven copies of this line. That is an
owner-boundary call, not one to make inside a channel fix.

@clawsweeper

clawsweeper Bot commented Aug 30, 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 channel: line Channel integration: line size: S labels Aug 30, 2026
@edenfunf
edenfunf marked this pull request as ready for review August 30, 2026 18:18
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 2:24 PM ET / 18:24 UTC.

ClawSweeper review

What this changes

The PR forwards the routed agent’s existing human-delay policy from LINE webhook admission to the shared streamed-reply dispatcher and adds a per-agent override regression test.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: the focused LINE owner-boundary handoff is correct, preserves the default-off behavior, and has credible real-channel before/after evidence. No blocking patch defect was found; exact-head CI is still running.

Priority: P2
Reviewed head: 4721f0d80d4f6b43415242254bea373152d0d4c8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-aligned repair with direct real-channel before/after timing proof and a meaningful precedence regression test.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The changed production owner is the LINE webhook adapter, which now passes its live routed-agent configuration into the shared block dispatcher; the supplied real-LINE terminal evidence shows the configured two 8-second paced gaps after the fix, versus an unpaced current-main baseline.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed production owner is the LINE webhook adapter, which now passes its live routed-agent configuration into the shared block dispatcher; the supplied real-LINE terminal evidence shows the configured two 8-second paced gaps after the fix, versus an unpaced current-main baseline.
Evidence reviewed 7 items Introduced owner-boundary repair: The introduced LINE adapter resolves the routed agent’s existing policy from the live turn config and supplies it as dispatcher options; the pre-PR base omitted that handoff.
Dispatcher consumes the forwarded value: The shared dispatcher obtains the delay from its options immediately before serialized block delivery, so the added field reaches the behavior that needs it.
Channel lifecycle preserves adapter options: The shared channel-turn lifecycle merges adapter dispatcher options into the eventual dispatcher input; no parallel LINE pacing mechanism is added.
Findings None None.
Security None None.

How this fits together

LINE webhook events become routed agent turns, whose delivery options flow through the channel-turn lifecycle into the shared reply dispatcher. That dispatcher spaces streamed blocks after the first when the agent’s configured human delay is present.

flowchart LR
  A[LINE webhook] --> B[Inbound turn admission]
  B --> C[Route and live config]
  C --> D[LINE delivery adapter]
  D --> E[Shared reply dispatcher]
  E --> F[Paced LINE block replies]
Loading

Before merge

  • Resolve merge risk (P1) - This bug fix has a +6 production-line delta; the added public-SDK import and LINE-owned option handoff are the smallest way to carry the existing policy to the shared dispatcher, and no existing reply-pipeline field can absorb it.
  • Complete next step (P2) - No mechanical repair remains; this contribution is ready for ordinary maintainer review once the exact-head checks finish.
Agent review details

Security

None.

PR surface

Source +6, Tests +60. Total +66 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 0 +6
Tests 1 62 2 +60
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 68 2 +66

Review metrics

Metric Value Why it matters
Production versus test delta production +6, tests +60 net The production change is a minimal existing-policy handoff; the test exercises per-agent precedence at the LINE turn boundary.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #133430
Summary: This PR is the concrete candidate repair for the open LINE report; the merged Telegram PR is an analogous, channel-distinct predecessor.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the LINE-owned handoff after the exact-head checks complete; retain the shared dispatcher as the sole pacing implementation and track any broader sibling-channel consolidation separately.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the LINE-owned handoff after the exact-head checks complete; retain the shared dispatcher as the sole pacing implementation and track any broader sibling-channel consolidation separately.

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

Yes. The PR body provides a real LINE three-block baseline on main and two after-fix timing runs with fixed 8-second delays, while current source identifies the missing handoff.

Is this the best way to solve the issue?

Yes. Reusing the existing agent-policy resolver at the LINE adapter boundary feeds the already-authoritative dispatcher without a new setting or competing pacing path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: Configured LINE block streaming currently ignores a documented pacing policy, but the impact is limited to users who enable that channel behavior and setting.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the LINE webhook adapter, which now passes its live routed-agent configuration into the shared block dispatcher; the supplied real-LINE terminal evidence shows the configured two 8-second paced gaps after the fix, versus an unpaced current-main baseline.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed production owner is the LINE webhook adapter, which now passes its live routed-agent configuration into the shared block dispatcher; the supplied real-LINE terminal evidence shows the configured two 8-second paced gaps after the fix, versus an unpaced current-main baseline.

Label justifications:

  • P2: Configured LINE block streaming currently ignores a documented pacing policy, but the impact is limited to users who enable that channel behavior and setting.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed production owner is the LINE webhook adapter, which now passes its live routed-agent configuration into the shared block dispatcher; the supplied real-LINE terminal evidence shows the configured two 8-second paced gaps after the fix, versus an unpaced current-main baseline.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the LINE webhook adapter, which now passes its live routed-agent configuration into the shared block dispatcher; the supplied real-LINE terminal evidence shows the configured two 8-second paced gaps after the fix, versus an unpaced current-main baseline.

Evidence

What I checked:

  • Introduced owner-boundary repair: The introduced LINE adapter resolves the routed agent’s existing policy from the live turn config and supplies it as dispatcher options; the pre-PR base omitted that handoff. (extensions/line/src/monitor.ts:229, 4721f0d80d4f)
  • Dispatcher consumes the forwarded value: The shared dispatcher obtains the delay from its options immediately before serialized block delivery, so the added field reaches the behavior that needs it. (src/auto-reply/reply/reply-dispatcher.ts:490, d4ad866e5f9c)
  • Channel lifecycle preserves adapter options: The shared channel-turn lifecycle merges adapter dispatcher options into the eventual dispatcher input; no parallel LINE pacing mechanism is added. (src/channels/turn/lifecycle.ts:133, d4ad866e5f9c)
  • Config precedence and focused regression coverage: The resolver merges agent overrides over defaults, and the new LINE test uses distinct values for both scopes to verify the correct routed-agent result. (extensions/line/src/monitor.lifecycle.test.ts:438, 4721f0d80d4f)
  • Current-main behavior remains unfixed: The fetched current-main revision still has the prior LINE turn shape with no dispatcher options, so this PR is not redundant. (extensions/line/src/monitor.ts:227, ad00ba847d89)
  • Real behavior proof: The complete PR body records a real LINE three-block baseline completing in 2.9 seconds and two post-fix runs taking 19.6 and 18.4 seconds with two configured 8-second gaps; it also reports the focused extension suite passing. (extensions/line/src/monitor.ts:232, 4721f0d80d4f)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Mlightsnow: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Let the remaining exact-head checks complete before merge.

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.

@steipete steipete self-assigned this Aug 30, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer validation is complete for 4721f0d80d4f6b43415242254bea373152d0d4c8. No blocking findings; preparing to land. Thanks @edenfunf for the fix and real LINE reproduction.

The defect is the LINE turn adapter omitting the existing agent policy from dispatcherOptions. I traced admission's live configuration through the routed turn, lifecycle option merge, shared dispatcher and LINE delivery. This uses the existing pacing owner; it adds no second timer or configuration surface. Production is +6/-0; tests +62/-2. The six lines are the missing resolver import/handoff and its invariant comment. The existing streaming documentation describes the restored behavior.

Independent proof ran on secretless AWS Crabbox cbx_83bf7acac21b, without credential hydration or an instance role:

  • node scripts/run-vitest.mjs extensions/line/src/monitor.lifecycle.test.ts -t "paces block replies" with only monitor.ts reverted to the PR base failed as expected: missing humanDelay.
  • Restoring exact PR source, node scripts/run-vitest.mjs extensions/line src/agents/identity.human-delay.test.ts src/auto-reply/reply/reply-flow.test.ts src/channels/turn/run-channel-turn.pipeline.test.ts passed 746 tests across 50 files. Run: run_1daef9e5f21f.
  • Fresh Codex autoreview: scoped-clean at P0; no accepted/actionable findings. Manual review also checked owner boundaries and sibling handoffs.
  • Exact-head CI 33327675403 passed, including the required gate.

The PR's real LINE A/B remains the authenticated evidence: 2.9s before versus 19.6s/18.4s after two configured 8s gaps. Those runs are contributor-provided; this session independently reproduced the regression and ran the tests above.

ClawSweeper's current-head growth and pending-CI items are addressed by the ownership explanation and green run. The omission is present in stable v2026.7.1-2; its original introduction is unverified. Named follow-up: audit shared humanDelay ownership and the seven sibling-channel omissions listed in #133430, preserving explicit dispatcher overrides and proving each delivery path.

@steipete
steipete merged commit 21b2289 into openclaw:main Aug 30, 2026
173 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: line Channel integration: line P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

[Bug]: agents.defaults.humanDelay is silently ignored on LINE

2 participants