fix(sync): bootstrap cursorless channels in latest-only mode - #182
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 10:43 AM ET / 14:43 UTC. ClawSweeper reviewWhat this changesThe PR makes latest-only Discord archive sync fetch one newest page for a newly discovered channel or thread without a cursor, then retain cursor state for a later full backfill. Merge readinessKeep open: current main still skips cursorless channels in latest-only mode, while this PR adds the bounded bootstrap and has corrected the previously missed guide. No source-level correctness blocker was found; wait for the in-progress test check before merge. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherDiscord sync discovers accessible channels and threads, then writes messages and per-channel cursors to the local SQLite archive. Latest-only runs update the newest available data, while full runs continue from the stored backfill boundary. flowchart LR
A[Discord channels and threads] --> B[Sync mode selection]
B --> C[Stored cursor check]
C --> D[One-page latest bootstrap]
C --> E[Incremental or full backfill]
D --> F[SQLite messages and cursors]
E --> F
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Merge the bounded bootstrap after required checks complete so newly discovered active surfaces receive a current message page and a later full sync can finish their history. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible with high confidence: current main returns immediately for latest-only channels without a stored cursor, and the PR regression exercises the resulting forum-thread path. Is this the best way to solve the issue? Yes. Reusing the established backfill paginator with a one-page cap preserves cursor semantics and avoids a separate thread-specific synchronization path. AGENTS.md: found, but no applicable review policy affected this item. Codex review notes: model internal, reasoning high; reviewed against 679ed223ab13. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
|
@clawsweeper automerge |
|
🦞👀 Command router queued. I will update this comment with the next step. |
Problem
Routine and scheduled
--latest-onlysyncs discover new active channels and threads, but skip their messages forever because those surfaces do not yet have alatest_message_idcursor. Channel metadata is published while the message archive remains empty.Fix
--fullrun resumes from that boundary.Real Discord transport proof
Ran this branch with a real Discord bot against a brand-new disposable config and SQLite archive. Guild/channel IDs and credentials are redacted; no message content was inspected or retained.
This proves the production Discord client fetched one bounded head page for a cursorless channel, persisted both cursor boundaries, resumed older history from that boundary, and completed the archive on a later full pass. The disposable archive was deleted afterward.
Automated proof
GOWORK=off go test ./...make lintmake test-racemake test-coverage(85.1%)make smoke