Repository navigation
fix(telegram): requeue aborted ingress claims - #122864
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7dc50bd56
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await state.settleOnce(async () => { | ||
| // Ownership ended before adoption, so this is not a delivery attempt. | ||
| await releaseClaim(state.claim, "turn-abandoned", { recordAttempt: false }); | ||
| }); |
There was a problem hiding this comment.
Preserve the non-rejecting abandonment contract
When queue.release rejects, this now propagates from onAbandoned, but completeFollowupRunLifecycle deliberately invokes that callback without observing its promise, and Telegram also discards it with void. The rejection can therefore reach OpenClaw's global unhandled-rejection handler, which exits the gateway for non-transient errors, instead of containing the failed claim release as before. Restore rejection containment while retaining the new recordAttempt: false behavior.
AGENTS.md reference: src/channels/AGENTS.md:L49-L51
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed August 26, 2026, 5:37 AM ET / 09:37 UTC. ClawSweeper reviewWhat this changesThis PR requeues pre-adoption Telegram claims without consuming retries and increases managed gateway SIGTERM drain time for active embedded runs. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 6 items remain Keep open. The latest head contains the prior rejection-containment repair, but its manual systemd unit documentation still leaves operators with the old 30-second stop budget, and the PR has only mock/test evidence rather than after-fix behavior proof. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherTelegram updates flow through a durable ingress queue whose lifecycle releases, retries, or adopts each claimed update. Gateway shutdown waits for process-wide active work, while the systemd unit determines how long the operating system allows that drain to finish. flowchart LR
A[Telegram update] --> B[Durable ingress queue]
B --> C[Deferred claim lifecycle]
C --> D{Adopted or abandoned}
D -->|adopted| E[Channel dispatch]
D -->|abandoned| B
F[Managed SIGTERM] --> G[Gateway active-work drain]
G --> H[Systemd stop budget]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +26, Tests +41. Total +67 across 8 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Align both manual systemd examples with the generated 330-second stop budget, then attach redacted after-fix traces showing abandoned-claim replay and managed SIGTERM drain recovery. Do we have a high-confidence way to reproduce the issue? No: the PR supplies focused mock/test coverage, but no current-head production-boundary trace for a reclaimed Telegram claim or managed SIGTERM drain. Is this the best way to solve the issue? No: the lifecycle changes are targeted, but leaving the documented manual systemd path at 30 seconds leaves a supported deployment path with the reported shutdown limit. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 430de50d6735. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
fda9f2d to
d7d980d
Compare
|
Land-ready on
Known limitation: launchd still has its 20-second deadline, and existing systemd units and manual examples still use 30 seconds. A separate follow-up will migrate launchd, installed units, audit coverage, and docs. The maintainer accepted this cross-platform policy and directed this PR to land as-is. Proof:
Evidence remains in |
Requeue Telegram ingress claims when their owner aborts before adoption, without spending retry attempts or misclassifying late aborts as delivery failures. During managed shutdown, drain active embedded model and tool runs before exit, with a 330-second generated systemd stop budget for the 315-second cooperative gateway drain. Co-authored-by: jisubi <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
When Telegram work is reclaimed after an ingress owner timeout, a late abort from the old owner can be misclassified as delivery failure. Separately, a service-manager restart arrives as plain
SIGTERM; draining only its outer transaction can tear down an embedded Codex tool run that is still active, surfacing a misleading tool failure.Evidence
Focused coverage passes:
corepack pnpm exec vitest run src/cli/gateway-cli/run-loop.test.ts src/daemon/systemd-unit.test.ts extensions/telegram/src/telegram-ingress-drain.test.ts src/channels/message/ingress-drain.test.tsSummary
SIGTERMshutdown