Fix Telegram spooled claim refresh#96962
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 26, 2026, 2:30 AM ET / 06:30 UTC. Summary PR surface: Source +171, Tests +356. Total +527 across 6 files. Reproducibility: yes. at source level. Current main can decide stale recovery from an old claimedAt snapshot, while the PR body reports a live Telegram slow-turn proof where the active claim timestamp refreshed instead of aging into recovery. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the bounded token-guarded refresh and stale-release guard after maintainer review accepts the SDK surface and the persisted Telegram queue semantics. Do we have a high-confidence way to reproduce the issue? Yes at source level. Current main can decide stale recovery from an old claimedAt snapshot, while the PR body reports a live Telegram slow-turn proof where the active claim timestamp refreshed instead of aging into recovery. Is this the best way to solve the issue? Yes, with maintainer acceptance of the small API addition. Refreshing the exact active claim token and rechecking token plus claimed_at before stale release is the narrowest maintainable fix for this active-processing race; broader crash/startup recovery remains tracked separately. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4fc504d321b6. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +171, Tests +356. Total +527 across 6 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
What Problem This Solves
Telegram polling can spool inbound updates into the shared ingress queue before dispatching them to the runtime. A long-running Telegram turn could hold a claimed ingress event past the stale-claim recovery window. Without refreshing the active claim, another poll loop can treat that still-active row as stale, reclaim it, and re-deliver or wedge the message while the first turn is still processing.
The maintainer screenshots described Telegram message delivery getting stuck. The live reproduction on
mainshowed the same failure class: an active Telegram spooled ingress claim could age into stale recovery while its model turn was still running.Why This Change Was Made
This PR makes the active Telegram spooled claim renewable while the message is being processed, and it hardens stale recovery so a worker only releases the exact stale claim it originally observed.
Key changes:
src/channels/message/ingress-queue.ts.extensions/telegram/src/telegram-ingress-spool.ts.extensions/telegram/src/polling-session.tswhile the runtime is processing the update.User Impact
Telegram users with working configurations should see the same normal delivery path for fast turns. Long-running turns should no longer be eligible for duplicate stale recovery while still active, which prevents the stuck/redispatch class seen in the screenshots.
The fix is bounded to claimed spooled Telegram ingress events and uses the existing queue database. It does not add new user configuration, change Telegram credentials, or alter non-spooled channel delivery behavior.
Evidence
Code and automated checks:
88f37bcafef(Fix Telegram spooled claim refresh).src/channels/message/ingress-queue.test.tsextensions/telegram/src/telegram-ingress-spool.test.tsextensions/telegram/src/polling-session.test.tspnpm buildpassed.pnpm check:changedpassed on Testbox runtbx_01kw16av103z2f395vvtggxzfs.$autoreviewpassed with no accepted/actionable findings.Live Telegram HITL proof with 1Password-injected Telegram credentials:
/statusdelivered through a live Telegram bot.OPENCLAW_E2E_OK_1; confirmed visible by HITL.OPENCLAW_E2E_OK_SLOW; confirmed visible by HITL.claimedand its claim timestamp refreshed from1782453619721to1782453919724instead of aging into stale recovery.channel_ingress_events:0delivery_queue_entries:0telegram-final:agent:main:main:7676134290:337:0.Local proof artifacts:
.artifacts/qa-e2e/telegram-hitl/spooled-claim-refresh/gateway.log.artifacts/qa-e2e/telegram-hitl/spooled-claim-refresh/slow-mock-openai-requests.ndjson.artifacts/qa-e2e/telegram-hitl/spooled-claim-refresh/run/state/state/openclaw.sqlite