Skip to content

fix(infra): guard channel ingress queue parseJson against corrupted JSON - #98402

Closed
Pick-cat wants to merge 8 commits into
openclaw:mainfrom
Pick-cat:fix/ingress-queue-parsejson-guard
Closed

Pick-cat wants to merge 8 commits into
openclaw:mainfrom
Pick-cat:fix/ingress-queue-parsejson-guard

Conversation

@Pick-cat

@Pick-cat Pick-cat commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where a single corrupted payload_json, metadata_json, or completed_metadata_json row in the SQLite channel ingress queue crashes the entire queue operation. The parseJson() helper calls JSON.parse(value) without a try-catch. A corrupt row throws an uncaught SyntaxError that propagates through baseRecord() (called by listPending, listClaims, claimNext, enqueue) and completedRecord() (called by enqueue duplicate detection). One bad row in listPending() or listClaims() kills all entries in that listing. This affects every channel that uses the durable ingress queue for inbound message processing.

Additionally, claimNext and claim would UPDATE a pending row to claimed status before validating the payload could be decoded — so a corrupt payload could become an invisible claimed row, hidden from listPending/listClaims/recoverStaleClaims, permanently blocking queue recovery.

Why This Change Was Made

  1. Tagged parse result: parseJson() now returns { ok: true, value } | { ok: false } instead of the ambiguous unknown | null. JSON.parse("null") is valid and returns null, which the old sentinel conflated with parse failure. The tagged result cleanly separates "valid JSON value" from "corrupt input".

  2. Guard parseJson at the chokepoint: baseRecord() returns null when payload_json is corrupt (unrecoverable). Corrupt metadata_json/completed_metadata_json is non-fatal — the record is kept with metadata omitted. All callers (listPending, listClaims, enqueue, claimNext, claim) handle null/omitted results.

  3. Validate before claiming: claimNext calls baseRecord() inside rows.find() to skip corrupt rows before they are selected, and claim pre-reads the pending row and validates baseRecord() before issuing the UPDATE. No corrupt row can ever be promoted to claimed status.

  4. Tombstone corrupt rows on duplicate enqueue: When enqueue() finds a duplicate event whose existing row has a corrupt payload_json, it now tombstones the corrupt row as failed with reason "corrupt_payload" instead of throwing. The caller receives { kind: "failed", duplicate: true }.

  5. Recover corrupt claimed rows during stale recovery: recoverStaleClaims() now scans raw claimed rows directly (bypassing listClaims() which filters out corrupt rows). Corrupt claimed rows are tombstoned as failed instead of being left permanently invisible to recovery.

User Impact

No user-visible impact under normal operation. When a channel ingress queue row is somehow corrupted:

  • listPending / listClaims skip the bad entry instead of crashing
  • claimNext / claim skip corrupt rows and claim the next valid one
  • enqueue duplicate detection tombstones corrupt rows and returns a proper result
  • recoverStaleClaims tombstones corrupt claimed rows so they don't block the queue
  • Valid JSON null payload is correctly preserved (not treated as corrupt)

Real behavior proof

  • Real environment: Linux, Node v22.22.0, driving real createChannelIngressQueue against a real on-disk SQLite database.
  • Exact PR head: 93572a00b0.
  • Evidence after fix (25 tests, all pass):
$ node scripts/run-vitest.mjs src/channels/message/ingress-queue.test.ts --run
 Test Files  1 passed (1)
      Tests  25 passed (25)

New tests cover: pending row with corrupt payload_json → skipped, corrupt metadata_json → metadata omitted, corrupt claimed row → skipped in listClaims, corrupt completed_metadata_json → duplicate detection works, claimNext skips corrupt pending → claims next valid, claim rejects corrupt pending, valid JSON null → preserved, duplicate enqueue of corrupt row → tombstoned as failed, stale recovery of corrupt claimed row → tombstoned as failed.

  • Negative control (pre-fix — 4 SyntaxError crashes):
$ git show origin/main:src/channels/message/ingress-queue.ts > /tmp/iq-old.ts   && cp /tmp/iq-old.ts src/channels/message/ingress-queue.ts   && node scripts/run-vitest.mjs src/channels/message/ingress-queue.test.ts --run

 FAIL  skips a pending row with corrupt payload_json in listPending
       SyntaxError: Expected property name or '}' in JSON at position 1
       ❯ parseJson (src/channels/message/ingress-queue.ts:222)

 FAIL  skips corrupt metadata_json in listPending
       SyntaxError at parseJson (line 222)

 FAIL  skips a claimed row with corrupt payload_json in listClaims
       SyntaxError at parseJson (line 222)

 FAIL  skips corrupt completed_metadata_json during duplicate detection
       SyntaxError at parseJson (line 222)

 Test Files  1 failed (1)  —  4 failed | 16 passed (20)
exit=1

Restoring the fix returns to 25/25 green. The negative control is load-bearing: same tests, same corrupt rows, same disk boundary.

  • What was not tested: a live gateway with real channels end-to-end. The proof drives the same exported queue APIs against a real SQLite database, which exercises the shared chokepoint.

Evidence

Existing tests — no regressions:

$ node scripts/run-vitest.mjs src/channels/message/ingress-queue.test.ts src/channels/message/durable-receive.test.ts --run
 Test Files  2 passed (2)
      Tests  32 passed (32)

Additional validation:

$ node scripts/run-vitest.mjs src/gateway/server-cron-notifications.test.ts --run
 Test Files  2 passed (2)
      Tests  8 passed (8)

$ git diff --check
# passes

Lint: oxlint clean on both changed files.

Rebased onto latest origin/main, fixed the check-test-types failure from typed empty mock call tuple access in gateway cron tests, and reran local autoreview with no accepted/actionable findings.

AI-assisted.

@harjothkhara

Copy link
Copy Markdown
Contributor

I found one source-level gap that looks worth fixing before this closes the corrupted-row recovery issue.

The new baseRecord()/claimedRecord() null behavior is applied when listing rows, but claimNext() still picks from raw pending rows before proving the payload can be decoded. In the common path with no stored lane_key and no deriveLaneKey, a row with corrupt payload_json has no derived lane key, passes the rows.find(...) predicate, gets updated to status = "claimed", and then the final claimedRecord(row) returns null. That means the caller sees no claim, while the corrupt row is now hidden from both listPending() and listClaims(); because recoverStaleClaims() is built on listClaims(), the row will not be recovered either.

The same edge exists for direct claim(id): it updates the row to claimed before the post-update decode can fail. I think the fix should validate baseRecord() before updating a pending row in both claimNext() and claim(), or otherwise move corrupt pending rows into an explicit failed/tombstoned state. A regression test that inserts a corrupt pending row, calls claimNext() and claim("bad-id"), and then asserts the valid sibling is still claimable and the bad row was not left as an invisible claimed row would cover the missing path.

I did not run the PR branch locally; this is from reading the current diff plus src/channels/message/ingress-queue.ts claim/list/recovery flow.

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 5, 2026, 8:44 AM ET / 12:44 UTC.

Summary
The PR changes the shared channel ingress queue to tolerate corrupt persisted JSON rows by skipping invalid payload records, omitting corrupt metadata, and tombstoning unrecoverable duplicate or stale claimed rows.

PR surface: Source +117, Tests +305. Total +422 across 3 files.

Reproducibility: yes. Source inspection shows current main and v2026.6.11 both call bare JSON.parse while materializing persisted channel ingress rows, and the PR body includes a negative-control terminal run showing SyntaxError failures against the old code.

Review metrics: 1 noteworthy metric.

  • Persistent JSON recovery surface: 3 parsed columns changed. payload_json, metadata_json, and completed_metadata_json now have distinct corrupt-data behavior in persisted channel ingress rows.

Stored data model
Persistent data-model change detected: serialized state: src/channels/message/ingress-queue.ts, vector/embedding metadata: src/channels/message/ingress-queue.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] The queue is shared through plugin runtime state and used by channel ingress paths, so a regression in claim, skip, duplicate, or tombstone semantics could delay or suppress inbound messages.
  • [P1] The PR intentionally fails unrecoverable corrupt payload rows; maintainers should accept that recovery policy for corrupt persisted queue state before merge.

Maintainer options:

  1. Land after queue review (recommended)
    Merge once maintainers accept the corrupt-row recovery semantics and required checks for the exact head have settled.
  2. Ask for live channel smoke
    Request an additional Telegram or WhatsApp smoke only if maintainers want transport-level confidence beyond the shared queue proof.
  3. Pause for recovery policy
    Hold the PR if maintainers want a different product policy for preserving corrupt pending rows instead of failing unrecoverable payloads.

Next step before merge

  • No ClawSweeper repair task is needed; the branch has no blocking findings and needs ordinary maintainer merge review for the shared queue risk.

Security
Cleared: The diff changes local SQLite queue parsing and tests only; it adds no dependency, workflow, secret, permission, package, or network execution surface.

Review details

Best possible solution:

Land the queue-layer guard after maintainer review accepts the corrupt-row tombstone semantics and exact-head required checks remain green; no broader plugin API change is needed.

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

Yes. Source inspection shows current main and v2026.6.11 both call bare JSON.parse while materializing persisted channel ingress rows, and the PR body includes a negative-control terminal run showing SyntaxError failures against the old code.

Is this the best way to solve the issue?

Yes. The shared ingress queue materialization, duplicate, claim, and stale-recovery layer is the narrow owner boundary; plugin-specific guards would miss other users of the same queue.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority infrastructure bug fix for a shared channel queue with limited blast radius and no emergency outage evidence.
  • merge-risk: 🚨 message-delivery: The PR changes how inbound queue rows are skipped, claimed, duplicate-detected, and tombstoned, which can affect message delivery if wrong.
  • merge-risk: 🚨 availability: The change is intended to prevent corrupt rows from crashing queue operations, but it directly changes recovery behavior for stuck or corrupt queue state.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body contains exact-head terminal proof for a real on-disk SQLite ingress queue plus a negative control against the old parser behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains exact-head terminal proof for a real on-disk SQLite ingress queue plus a negative control against the old parser behavior.
Evidence reviewed

PR surface:

Source +117, Tests +305. Total +422 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 144 27 +117
Tests 2 309 4 +305
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 453 31 +422

What I checked:

  • Repository policy applied: Root AGENTS.md and scoped channel/gateway AGENTS.md were read; their shared-channel, SQLite state, review-depth, and gateway test guidance apply to this review. (AGENTS.md:30, 601b80c5f4c1)
  • Current main still has the reported bare parser: Current main has parseJson as a direct JSON.parse call and baseRecord parses payload_json and metadata_json through it, so corrupt persisted rows can still throw before this PR. (src/channels/message/ingress-queue.ts:221, 601b80c5f4c1)
  • Latest release also has the reported behavior: v2026.6.11 shows the same direct JSON.parse implementation in the channel ingress queue, so the central bug is not already shipped fixed. (src/channels/message/ingress-queue.ts:221, e085fa1a3ffd)
  • PR head guards the parse chokepoint: The PR head converts parseJson to a tagged result, returns null for corrupt payload_json, and omits corrupt metadata_json or completed_metadata_json instead of throwing. (src/channels/message/ingress-queue.ts:223, 93572a00b086)
  • PR head validates before claim and recovers corrupt claims: claimNext and claim validate materialization before mutating pending rows, and recoverStaleClaims scans raw stale claimed rows so corrupt claims can be failed rather than hidden by listClaims filtering. (src/channels/message/ingress-queue.ts:582, 93572a00b086)
  • Focused corrupt-row tests were added: The PR adds real state-DB tests for corrupt pending/list/claim behavior, corrupt completed metadata, JSON null payloads, duplicate corrupt-row tombstoning, and stale corrupt-claim recovery. (src/channels/message/ingress-queue.test.ts:555, 93572a00b086)

Likely related people:

  • vincentkoc: git blame/log attribute the current checked-out ingress queue implementation, tests, durable receive adapter, and state schema carrying this behavior to commit 53bd4dd. (role: current-main carry-forward author; confidence: medium; commits: 53bd4dde6c00, e085fa1a3ffd; files: src/channels/message/ingress-queue.ts, src/channels/message/ingress-queue.test.ts, src/channels/message/durable-receive.ts)
  • steipete: The live PR is assigned to steipete, which is the strongest current PR-routing signal beyond the collapsed local file history. (role: assigned reviewer and likely follow-up owner; confidence: medium; files: src/channels/message/ingress-queue.ts, src/channels/message/ingress-queue.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-05T06:22:47.753Z sha 64c6f8ff8e233c928aadef0ad81faebe4dd241e8 :: needs changes before merge. :: [P2] Tombstone corrupt duplicates in enqueue | [P2] Bound corrupt-row reconciliation on claim paths
  • reviewed 2026-07-05T06:29:42.166Z sha 64c6f8ff8e233c928aadef0ad81faebe4dd241e8 :: needs changes before merge. :: [P2] Tombstone corrupt duplicates in enqueue | [P2] Bound corrupt-row reconciliation on claim paths
  • reviewed 2026-07-05T08:10:06.347Z sha 64c6f8ff8e233c928aadef0ad81faebe4dd241e8 :: needs changes before merge. :: [P2] Tombstone corrupt duplicates in enqueue | [P2] Bound corrupt-row reconciliation on claim paths
  • reviewed 2026-07-05T09:29:48.763Z sha e2b35e855a96e425b7d64f0854132deed26f36b9 :: needs changes before merge. :: [P2] Remove the non-Thenable await
  • reviewed 2026-07-05T10:07:18.800Z sha e2b35e855a96e425b7d64f0854132deed26f36b9 :: needs changes before merge. :: [P2] Remove the non-Thenable await
  • reviewed 2026-07-05T10:25:08.015Z sha 7d8e39b6122371f2ac876602de0de4483984bb58 :: needs changes before merge. :: [P2] Handle corrupt payload duplicates in enqueue | [P2] Recover corrupt claimed rows instead of hiding them
  • reviewed 2026-07-05T12:23:01.378Z sha eba795a :: needs changes before merge. :: [P2] Handle corrupt payload duplicates in enqueue | [P2] Recover corrupt claimed rows instead of hiding them
  • reviewed 2026-07-05T12:38:45.565Z sha 93572a0 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 1, 2026
@Pick-cat

Pick-cat commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@Pick-cat

Pick-cat commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 1, 2026
@Pick-cat
Pick-cat force-pushed the fix/ingress-queue-parsejson-guard branch from 11ed39d to 1c7bac6 Compare July 1, 2026 06:28
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Jul 1, 2026
@Pick-cat

Pick-cat commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@Pick-cat
Pick-cat force-pushed the fix/ingress-queue-parsejson-guard branch from 1c7bac6 to 4c37844 Compare July 1, 2026 06:42
@Pick-cat

Pick-cat commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@Pick-cat

Pick-cat commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased onto latest main, conflicts resolved.

@clawsweeper

clawsweeper Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 5, 2026
@Pick-cat
Pick-cat force-pushed the fix/ingress-queue-parsejson-guard branch from 7d8e39b to ca292d0 Compare July 5, 2026 11:50
@Pick-cat
Pick-cat force-pushed the fix/ingress-queue-parsejson-guard branch from ca292d0 to eba795a Compare July 5, 2026 12:07
Pick-cat and others added 2 commits July 5, 2026 20:24
…tale recovery

Two P1 gaps: enqueue() threw on duplicate when the existing row had corrupt
payload_json, and recoverStaleClaims() silently skipped corrupt claimed rows,
leaving them invisible to recovery. Both paths now tombstone the unrecoverable
row as failed with reason "corrupt_payload" and return a proper result.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@Pick-cat

Pick-cat commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Fixed the two P1 gaps from last review:

  • enqueue() duplicate + corrupt row now tombstones as failed instead of throwing
  • recoverStaleClaims() now scans raw claimed rows and tombstones corrupt ones as failed

All 25 tests pass (23 original + 2 new), lint clean.

@clawsweeper

clawsweeper Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 5, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer review: malformed JSON should not crash every queue read, but this head changes delivery ownership and ordering without a proven corruption producer, so I am not landing it.

  • Duplicate enqueue can unconditionally turn an existing corrupt row into failed, including a row that is actively claimed; the update does not match the observed status, claim token, or incarnation.
  • Stale recovery selects a claim, then tombstones it with only status = claimed; a renewed/reclaimed row can be failed after the observation that made it stale is no longer true.
  • claimNext skips the corrupt head and may advance a later event in the same lane, breaking the queue's ordering invariant. Listing APIs also make the bad row invisible without a durable quarantine/audit owner.

The safe repair needs a concrete producer/repro, one explicit quarantine transition that conditionally matches the exact observed row/claim, and lane-preserving behavior. Please prove Telegram and WhatsApp redelivery/claim recovery live, including a dropped ACK and concurrent renewal negative control, before changing this shared queue contract.

I am keeping this open; no branch changes or landing from this review.

@steipete

Copy link
Copy Markdown
Contributor

Landed the current-main replacement in #105259 as commit a8240781010cddd8d5496c370d6899f8a7e3c1c0.

The final fix preserves the original corruption report and contributor credit while adding durable Kysely compare-and-set tombstones, bounded claim reconciliation, stable keyset listing, active-claim protection, and owner-aware Telegram stale recovery. The replacement was necessary because the original branch's parse-and-skip path could still starve later work and could not safely recover corrupt claimed rows.

Thank you @Pick-cat for finding the durable queue failure and iterating on the original repair. For future PRs, keeping Allow edits by maintainers enabled lets us preserve the original PR branch when larger current-main fixups are needed.

@steipete steipete closed this Jul 12, 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: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants