Problem
When a session dies mid-processing (e.g. gateway crash, kill -HUP, unhandled rejection), the channel_ingress_events row stays in claimed state permanently. Workers that pick up new messages for the same session also fail and leave new events claimed. The queue deadlocks until manually unblocked.
Steps to reproduce
- Have a session actively running (e.g. Telegram direct session)
- Kill the gateway process mid-turn (e.g. via
kill -HUP or unhandled rejection during parallel exec calls)
- Send any new message to that session
- Observe: new message gets claimed by a worker, worker fails, claim is never released
- All subsequent messages to that session are stuck in
claimed → queue deadlocked
Root cause
channel_ingress_events has claim_token, claim_owner, claimed_at columns but no TTL enforcement or heartbeat mechanism:
- No background job to expire stale claims
- No liveness check on
claim_owner before claiming
- No heartbeat update from the session while it processes
Impact
- Telegram (and likely other channels) sessions become silently unresponsive
- Manual fix required: reset
claimed → pending via direct SQLite write + cron wake
- Happens every time a session crashes mid-turn
Expected behavior
One of:
- Worker checks if
claim_owner process is still alive before honouring a stale claim
- Sessions heartbeat
claimed_at while processing; background reaper expires claims older than N×heartbeat_interval
- On gateway startup, all
claimed events from the previous run are automatically released
Workaround
import sqlite3, time
conn = sqlite3.connect("/home/node/.openclaw/state/openclaw.sqlite")
cur = conn.cursor()
cutoff = int(time.time() * 1000) - 10 * 60 * 1000 # 10 min
cur.execute("""
UPDATE channel_ingress_events
SET status='pending', claim_token=NULL, claim_owner=NULL, claimed_at=NULL
WHERE status='claimed' AND claimed_at < ?
""", (cutoff,))
conn.commit()
print(f"Reset {cur.rowcount} stuck claims")
conn.close()
Then wake the queue processor.
Environment
- OpenClaw
2026.6.1
- Channel: Telegram
- Triggered by: parallel exec calls +
kill -HUP on gateway PID
Problem
When a session dies mid-processing (e.g. gateway crash,
kill -HUP, unhandled rejection), thechannel_ingress_eventsrow stays inclaimedstate permanently. Workers that pick up new messages for the same session also fail and leave new events claimed. The queue deadlocks until manually unblocked.Steps to reproduce
kill -HUPor unhandled rejection during parallel exec calls)claimed→ queue deadlockedRoot cause
channel_ingress_eventshasclaim_token,claim_owner,claimed_atcolumns but no TTL enforcement or heartbeat mechanism:claim_ownerbefore claimingImpact
claimed→pendingvia direct SQLite write +cron wakeExpected behavior
One of:
claim_ownerprocess is still alive before honouring a stale claimclaimed_atwhile processing; background reaper expires claims older than N×heartbeat_intervalclaimedevents from the previous run are automatically releasedWorkaround
Then wake the queue processor.
Environment
2026.6.1kill -HUPon gateway PID