Skip to content

fix(gateway): use already-aborted signal in stopChannel fallback - #62722

Closed
pruthvishetty wants to merge 1 commit into
openclaw:mainfrom
pruthvishetty:fix/gateway-channel-stop-orphaned-signal
Closed

pruthvishetty wants to merge 1 commit into
openclaw:mainfrom
pruthvishetty:fix/gateway-channel-stop-orphaned-signal

Conversation

@pruthvishetty

Copy link
Copy Markdown

Summary

  • In stopChannel, when no AbortController exists for an account (i.e. no running task), the fallback new AbortController().signal creates a signal from an anonymous controller that can never be aborted
  • stopAccount implementations may use this signal for cleanup coordination (checking signal.aborted, passing to fetch, using with sleepWithAbort, etc.)
  • A never-aborting signal can cause stopAccount to hang or timeout during graceful shutdown instead of completing immediately

Fix

Replace new AbortController().signal with AbortSignal.abort(), which returns an already-aborted signal. This correctly communicates "this account is being stopped" to the plugin's stopAccount implementation.

Context

On line 485, abort?.abort() is called — so if abort exists, its signal is already aborted. The fallback only fires when abort is undefined (no active task for this account). In both cases the intent is the same: tell stopAccount to shut down. AbortSignal.abort() makes the fallback consistent with the primary path.

Test plan

  • All 14 tests in server-channels.test.ts pass
  • One-line change, minimal risk
  • AbortSignal.abort() is available since Node 15.12.0; project requires Node 22+

[AI-assisted]

🤖 Generated with Claude Code

…oller exists

When stopChannel is called for an account without an active
AbortController, the fallback `new AbortController().signal` creates a
signal from an anonymous, unreferenced controller that can never be
aborted. If stopAccount implementations use the signal for cleanup
coordination, the never-aborting signal can cause hangs during graceful
shutdown.

Replace with `AbortSignal.abort()` which returns an already-aborted
signal, correctly communicating that the account is being stopped.
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Apr 7, 2026
@greptile-apps

greptile-apps Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Replaces new AbortController().signal with AbortSignal.abort() in the stopChannel fallback path so that stopAccount always receives an already-aborted signal, consistent with the primary path where abort?.abort() is called on line 485. The previous fallback produced a never-abortable signal, which could cause stopAccount implementations to hang during graceful shutdown.

Confidence Score: 5/5

Safe to merge — a correct one-line fix with no side effects.

Minimal, well-justified change that fixes a real behavioral inconsistency. AbortSignal.abort() is available in Node 15.12+ and the project requires Node 22+. No P0/P1 issues found.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(gateway): use already-aborted signal..." | Re-trigger Greptile

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity triage: refactor-only Candidate: refactor/cleanup-only PR without maintainer context. and removed stale Marked as stale due to inactivity labels May 1, 2026
@clawsweeper

clawsweeper Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This PR still needs the requested real-behavior proof, and the branch has been idle since that ask.

Close as stalled and unproven: the patch proposes a plausible gateway lifecycle correction, but the external branch has been idle since April 7, 2026, is currently dirty against main, and has not supplied the requested after-fix real-behavior proof despite the proof request expiring on June 28, 2026.

So I’m closing this for now to keep the review queue honest. Please reopen or open a fresh PR with real-behavior proof (a live run, logs, or a reproducible validation transcript) and it will be reviewed again.

Review details

Best possible solution:

If the no-controller stop path is still needed, submit a fresh, rebased PR with focused tests for both controller-present and controller-absent calls plus redacted after-fix gateway shutdown evidence.

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

Yes, from source: create a channel account with no active controller, invoke stopChannel, and observe the signal supplied to stopAccount; this review did not execute that path on current main.

Is this the best way to solve the issue?

Unclear: an already-aborted fallback is a plausible symmetry fix, but a plugin stop handler may rely on a usable signal for cleanup, so a focused contract test and real shutdown proof are needed before accepting it as the best fix.

Security review:

Security review cleared: The one-line runtime-signal change adds no dependency, secret, permission, supply-chain, or code-execution surface.

AGENTS.md: found and applied where relevant.

What I checked:

  • Current main behavior: Current main still passes a fresh controller signal when no per-account controller exists, so the proposed behavior is not already implemented. (src/gateway/server-channels.ts:2956, e04ea7916c5b)
  • Adjacent lifecycle coverage: The gateway channel tests exercise stop lifecycle behavior, but the reviewed PR adds no regression case establishing the no-controller stopAccount signal contract. (src/gateway/server-channels.test.ts:784, e04ea7916c5b)
  • Feature provenance: Current-file blame attributes the surrounding fallback path to the plugin-architecture migration commit, while the earlier multi-account lifecycle work introduced the manager shape that owns this stop path. (src/gateway/server-channels.ts:2956, 7acd26a2fc54)
  • Expired proof window: The PR was created and last committed on April 7, 2026; status: 📣 needs proof was applied on June 14, 2026, but the provided discussion contains no after-fix runtime trace, recording, screenshot, or redacted logs. The current head is also reported as dirty against main. (db23c0c993cf)

Likely related people:

  • steipete: The current-file history connects the account/channel manager lifecycle to the earlier multi-account and plugin-architecture changes; this is the strongest available routing signal for the fallback contract. (role: historical gateway lifecycle contributor; confidence: medium; commits: 05b0ef18e5cb, 7acd26a2fc54; files: src/gateway/server-channels.ts)

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

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels May 20, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 5, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 5, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 6, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 14, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 18, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. triage: refactor-only Candidate: refactor/cleanup-only PR without maintainer context.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant