fix: keep tail alive and replay timed-out messages - #126
Conversation
|
Codex review: needs changes before merge. Reviewed July 17, 2026, 3:52 AM ET / 07:52 UTC. Summary Reproducibility: no. failing current-main run is included, but the pre-fix ownership and deadline interaction is source-reproducible and the branch supplies focused protocol-real timeout fixtures for all three affected message event types. Review metrics: 3 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:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Preserve the fail-closed durable-recovery design, remove the release-owned changelog edit, land only after exact-head checks complete, and perform an authenticated hosted Discord restart/replay smoke test when a disposable guild is available. Do we have a high-confidence way to reproduce the issue? No failing current-main run is included, but the pre-fix ownership and deadline interaction is source-reproducible and the branch supplies focused protocol-real timeout fixtures for all three affected message event types. Is this the best way to solve the issue? Yes for the technical recovery approach: a single durable owner, content-free protected fallback, and event-aware exact replay form a narrow integrity-preserving design. The release-owned changelog edit should be removed, and hosted authenticated proof would further reduce integration risk. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning high; reviewed against 91aa80d2f826. Label changesLabel changes:
Label justifications:
Evidence reviewedAcceptance criteria:
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
Review history (13 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
437055c to
32c7aa6
Compare
Problem
A message create, update, or delete handler can exceed its deadline while holding Discrawl's writable SQLite connection. The outer failure recorder can then miss the same connection deadline, leaving no durable exact-message recovery identity. Delete failures also need different replay semantics from fetch-and-upsert.
Current scope
Client.Tailas the sole durable owner for message-scoped returned errors, panics, and timeouts.tail:last_eventmovement.discrawl tail --replay-failures-only [--replay-limit N]maintenance path. The earlier exact-selector CLI surface was removed as unnecessary dead weight.The original fourteen commits remain authored by @hannesrudolph. Maintainer repair commits tighten recovery, docs, tests, and Windows security without changing contributor authorship.
Exact-head evidence
Current head:
32c7aa657aaa58b2ede34549e6b0029ce429a32dFull local gate:
go test -count=1 ./... -coverprofile=/private/tmp/discrawl-pr126-cover.out— PASS; filtered coverage 85.2% (floor 85.0%).go test -count=1 -race ./...— PASS.golangci-lint run ./...,go vet ./...,staticcheck ./...,deadcode -test ./...,gofumpt -d ., andgosecwith the repository CI exclusions — PASS / no findings.go mod verify,go mod tidy -diff, and finalgit diff --check— PASS / clean.Protocol-real timeout fixtures:
GOWORK=off go test ./internal/discord -run 'TestTailContinuesAfterHandlerFailure/timeout|TestTailMessageUpdateFailureUsesRefetchedMetadata/timeout|TestTailMessageDeleteFailureRecordsExactlyOnce/cooperative_timeout' -count=1 -v— create, update, and delete timeout paths all PASS against real local WebSocket Gateway and REST servers.Restart and replay proof used two separate processes and the real built CLI:
spooled=3 process_exit_before_import=true.discrawl tail --replay-failures-only --replay-limit 25imported exactly three artifacts, recovered the delete, and safely deferred unauthenticated create/update fetches.Native Windows proof ran on Crabbox AWS Windows lease
cbx_a41aecb6e3af(violet-crayfish), runrun_4f1ff207f6f0, at the exact final source tree. The Windows test executable SHA-256 was5f8d6ebc2bac3cdebe10594d7fca2372c268b82a3e3f9a3fa094ec68c74455d8; canonical/private persistence, DACL protection, no-replace rename, and long-path tests all passed. The CLI executable SHA-256 wasd58efd1faeaf4d69b3b5522269653d308c3a12450d12ca2dd244350a0ff1ee88; native--versionreported0.11.6-0.20260717072229-32c7aa657aaa, and nativetail --helpexposed the bounded replay flags.AutoReview was run repeatedly over the repair and split review slices because the complete branch exceeds its single-bundle limit. Accepted findings were fixed; final review is clean.
Authenticated Discord boundary
The local environment has no enabled Discord bot token or designated disposable guild/channel. Therefore a successful create/update replay against Discord's hosted REST API, plus hosted Gateway delivery across a real process restart, still requires an authenticated Discord run. Local proof does not claim that hosted clause. It does exercise the actual HTTP/WebSocket protocol paths and the production SQLite/fallback/replay implementation rather than mocked store interfaces.