Skip to content

fix(line): keep startAccount pending until abort signal to prevent restart loop#26528

Merged
steipete merged 2 commits intoopenclaw:mainfrom
Sid-Qin:fix/line-provider-premature-exit
Feb 26, 2026
Merged

fix(line): keep startAccount pending until abort signal to prevent restart loop#26528
steipete merged 2 commits intoopenclaw:mainfrom
Sid-Qin:fix/line-provider-premature-exit

Conversation

@Sid-Qin
Copy link
Contributor

@Sid-Qin Sid-Qin commented Feb 25, 2026

Summary

  • Problem: LINE plugin's startAccount resolves immediately after monitorLineProvider returns, causing the channel supervisor to treat the provider as "exited" and triggering an auto-restart loop (up to 10 attempts).
  • Why it matters: LINE webhook providers go into a restart storm, flooding logs and potentially missing messages.
  • What changed:
    • extensions/line/src/channel.ts — after monitorLineProvider returns, await a Promise that resolves when ctx.abortSignal fires, keeping startAccount pending for the full lifecycle.
    • extensions/line/src/channel.startup.test.ts — updated existing test to handle abort lifecycle; added "stays pending until abort signal fires" and "resolves immediately when abortSignal is already aborted" tests.
  • What did NOT change: Webhook registration; LINE message handling; other channel plugins.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • 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

User-visible / Behavior Changes

  • LINE webhook provider no longer exits immediately after startup; stays alive until explicitly stopped.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: Any
  • Runtime: Node.js
  • Integration/channel: LINE

Steps

  1. Configure LINE webhook channel
  2. Start OpenClaw
  3. Observe provider lifecycle

Expected

  • Provider stays running after webhook registration.

Actual

  • Before fix: Provider exits immediately, supervisor restarts it up to 10 times.
  • After fix: Provider stays pending until abort signal.

Evidence

3 tests pass in channel.startup.test.ts including 2 new lifecycle tests.

Human Verification (required)

  • Verified scenarios: Normal startup with abort; pre-aborted signal; pending until abort.
  • Edge cases checked: Already-aborted signal resolves immediately.
  • What I did not verify: Live LINE webhook with actual LINE API.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Failure Recovery (if this breaks)

  • How to disable/revert: Revert the commit.
  • Files/config to restore: extensions/line/src/channel.ts
  • Known bad symptoms: If the abort signal never fires, the provider would hang indefinitely (but abort is always fired on shutdown).

Risks and Mitigations

None — the abort signal is managed by the channel supervisor and always fires on clean shutdown.

Greptile Summary

Fixed LINE webhook provider restart loop by keeping startAccount pending until abort signal fires. Previously, startAccount resolved immediately after monitorLineProvider returned, causing the channel supervisor to treat it as exited and trigger up to 10 auto-restart attempts.

  • Changed monitorLineProvider call from direct return to awaited assignment, then added Promise that waits for ctx.abortSignal
  • Properly handles already-aborted signal edge case
  • Added comprehensive tests covering normal lifecycle, pending-until-abort behavior, and pre-aborted signal handling

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix directly addresses a documented restart loop issue with a simple, well-tested solution. The implementation correctly handles the abort signal lifecycle including edge cases, matches the expected pattern from the channel supervisor code, and includes comprehensive test coverage. The change is isolated to the LINE plugin and cannot affect other channels.
  • No files require special attention

Last reviewed commit: 57b3c7c

steipete added a commit to Sid-Qin/openclaw that referenced this pull request Feb 26, 2026
@steipete steipete force-pushed the fix/line-provider-premature-exit branch from 57b3c7c to 71c03f7 Compare February 26, 2026 03:16
SidQin-cyber and others added 2 commits February 26, 2026 04:16
…start loop

monitorLineProvider() registers the webhook HTTP route and returns
immediately.  Because startAccount() directly returned that resolved
promise, the channel supervisor interpreted it as "provider exited"
and triggered auto-restart up to 10 times.

Await a promise gated on ctx.abortSignal so startAccount stays alive
for the full provider lifecycle, matching the contract expected by the
channel supervisor.

Closes openclaw#26478

Co-authored-by: Cursor <cursoragent@cursor.com>
@steipete steipete force-pushed the fix/line-provider-premature-exit branch from 71c03f7 to 1c14f14 Compare February 26, 2026 03:17
@steipete steipete merged commit 9b81a53 into openclaw:main Feb 26, 2026
21 of 25 checks passed
@steipete
Copy link
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm lint PASS, pnpm build PASS, pnpm test hit existing Vitest worker-fork timeout in src/telegram/monitor.test.ts.
  • Land commit: 1c14f14
  • Merge commit: 9b81a53

Thanks @Sid-Qin!

execute008 pushed a commit to execute008/openclaw that referenced this pull request Feb 27, 2026
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
vincentkoc pushed a commit to Sid-Qin/openclaw that referenced this pull request Feb 28, 2026
vincentkoc pushed a commit to rylena/rylen-openclaw that referenced this pull request Feb 28, 2026
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
steipete added a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
thebenjaminlee pushed a commit to escape-velocity-ventures/openclaw that referenced this pull request Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: line Channel integration: line size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: LINE plugin: provider exits immediately after startup (auto-restart loop)

2 participants