Skip to content

fix(followup): preserve queued messages across abort paths#29532

Closed
Sid-Qin wants to merge 1 commit into
openclaw:mainfrom
Sid-Qin:fix/29497-preserve-followups-on-abort
Closed

fix(followup): preserve queued messages across abort paths#29532
Sid-Qin wants to merge 1 commit into
openclaw:mainfrom
Sid-Qin:fix/29497-preserve-followups-on-abort

Conversation

@Sid-Qin

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

Copy link
Copy Markdown
Contributor

Summary

  • Problem: /stop and fast-abort cleanup cleared followup queues, which could silently drop user messages queued while a run was active.
  • Why it matters: Users can lose queued messages during timeout/abort flows with no feedback, especially in async channels.
  • What changed: Added selective queue cleanup options and updated abort paths to clear command lanes but preserve followup queues (abort.ts, commands-session.ts, queue/cleanup.ts); updated abort regression test accordingly.
  • What did NOT change: No change to command-lane clearing, no delivery transport changes, and no change to subagent explicit cleanup behavior.

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

  • Queued followup messages are preserved when abort commands stop active runs, reducing silent message loss in timeout/abort scenarios.

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: macOS (dev)
  • Runtime: Node.js + pnpm/vitest
  • Integration/channel: auto-reply followup queue / abort flow

Steps

  1. Queue a followup message while a run is active.
  2. Trigger /stop or fast-abort path.

Expected

  • Command lane is cleared, but queued followups are retained for subsequent processing.

Actual

  • Before fix: abort cleanup cleared both lane and followup queue (silent drop).
  • After fix: abort cleanup clears lane only; followup queue remains.

Evidence

  • pnpm vitest run src/auto-reply/reply/abort.test.ts src/auto-reply/reply/commands.test.ts
  • Updated test: fast-abort preserves queued followups but clears session lane.

Human Verification (required)

  • Verified scenarios: fast-abort keeps queued followups; command lane cleanup still executes.
  • Edge cases checked: existing command tests continue to pass.
  • What I did not verify: full live Discord thread timeout path end-to-end in production.

Compatibility / Migration

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

Failure Recovery (if this breaks)

  • How to disable/revert: revert this PR/commit.
  • Files/config to restore: abort handlers and queue cleanup module.
  • Known bad symptoms: abort may still clear queued followups if reverted.

Risks and Mitigations

  • Risk: preserved followups may run after an abort in cases where operators expected hard-drop semantics.
  • Mitigation: command lane is still cleared immediately; only queued followup payloads are preserved to prevent silent loss.

Avoid clearing followup queues during /stop and fast-abort cleanup so queued user messages survive abort/timeout flows instead of being silently dropped.

Closes openclaw#29497
@greptile-apps

greptile-apps Bot commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Added selective queue cleanup options to preserve queued followup messages during abort paths while continuing to clear command lanes.

Key Changes:

  • Added optional clearFollowups and clearLanes parameters to clearSessionQueues() function (both default to true for backward compatibility)
  • Updated /stop command handler and fast-abort path to pass clearFollowups: false, preserving queued messages
  • All other cleanup paths (subagent kills, explicit cleanup) continue using default behavior (clear everything)
  • Updated test expectations to verify followup preservation

Impact:
Prevents silent message loss when users queue followup messages during active runs that are then aborted via /stop or timeout paths. Command lanes are still cleared immediately to stop active work.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is clean, well-tested, and maintains backward compatibility. All existing callers work correctly with the default behavior. The changes are focused and solve the stated problem without introducing side effects. Test coverage validates the new behavior.
  • No files require special attention

Last reviewed commit: 7b41428

@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 Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Queued followup messages silently dropped on run timeout/abort

2 participants