perf(server): stop decoding unrelated events during startup - #12846
juliusmarminge merged 2 commits into
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — The PR substantially reduces startup event decoding and adds focused coverage, but it also changes the production attachment-cleanup replay and retry-cursor path. A nontrivial SQL predicate now controls filesystem cleanup work, so the behavioral risk merits human review. You can add or adjust custom eligibility rules. Learn more. |
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe projection pipeline now loads bootstrap attachment cleanup state through a typed SQL replay query. It derives pending cleanup and the last event from the returned rows, maps query failures, and applies attachment side effects using only event sequence and type. ChangesAttachment cleanup replay
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Refactor Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant ProjectionPipeline
participant listAttachmentCleanupReplayRows
participant SQLDatabase
participant applyAttachmentSideEffects
ProjectionPipeline->>listAttachmentCleanupReplayRows: load rows after cleanup cursor
listAttachmentCleanupReplayRows->>SQLDatabase: execute cleanup replay query
SQLDatabase-->>listAttachmentCleanupReplayRows: return decoded rows
listAttachmentCleanupReplayRows-->>ProjectionPipeline: return replay rows
ProjectionPipeline->>applyAttachmentSideEffects: apply cleanup side effects
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
juliusmarminge
left a comment
There was a problem hiding this comment.
Retarget against v2 pls
b142e7d to
94dce0e
Compare
Dismissing prior approval to re-evaluate 94dce0e
|
Macroscope has since reviewed this pull request. An earlier review was skipped by a cost limit; a review has now completed, so that notice no longer applies. |
94dce0e to
12a5406
Compare
Guards the narrowed replay query: the cleanup cursor lands on the latest event even when it is not a revert or delete, repeated reverts for one thread collapse into one prune, and a failed cleanup leaves the cursor behind so the next bootstrap retries it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
12a5406 to
b027642
Compare
|
Rebased onto One follow-up commit on top (
The test also passes against the v2 baseline, so it pins behavior rather than the implementation. Verified in Nothing else changed; the production diff is as you wrote it. Rebased and touched up by a maintainer's agent; a human will re-review. |
df6e170
into
pingdotgg:t3code/codex-turn-mapping
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Attachment cleanup replay read and decoded every event after its retry cursor during bootstrap, even though it only needs thread revert/delete metadata and the newest sequence. On a 1.25 GB snapshot of a real T3 database, that path decoded 4,954 events and 23.8 MB of JSON after an ordinary restart.
Query those cleanup rows directly, plus the newest event needed to advance the cursor. Cleanup ordering, deduplication, and retry behavior stay the same without making restart cost grow with unrelated event payloads.
Across three fresh copies of the same snapshot, the database-dependent phase from migrations complete through projection bootstrap fell from a 971 ms median to 512 ms (47.3%). The full launch remained noisy because provider startup runs in the same window, so this measurement isolates the repeated database work changed here.
Validation: all 34 legacy projection pipeline tests passed before retargeting. On the Orchestrator v2 base, server typecheck passes and targeted lint and formatting pass.
Model: GPT-5.6 Sol. Harness: Codex in T3 Code.