fix(security-agent): isolate dismiss and bound owner sync - #5449
Merged
Conversation
Move dismiss commands off security-sync-jobs onto a dedicated queue. Stop a scheduled owner sync at an 8-minute budget and continue from persisted repository progress so Cloudflare does not kill the job.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit 69cbc8b)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 69cbc8b)Status: 1 Issue Found | Recommendation: Address before merge Fix these issues in Kilo Cloud Executive SummaryPersisted Overview
Issue Details (click to expand)WARNING
Files Reviewed (2 files)
Previous review (commit 1efad47)Status: 2 Issues Found | Recommendation: Address before merge Fix these issues in Kilo Cloud Overview
Issue Details (click to expand)WARNING
Files Reviewed (8 files)
Reviewed by grok-4.6 · Input: 46.2K · Output: 7.1K · Cached: 324.2K Review guidance: REVIEW.md from base branch |
Write sync_run with jsonb_set so a concurrent owner job cannot drop last_synced_at. Count a thrown repository attempt toward the 8-minute budget and leave that repository incomplete for the next chunk.
eshurakov
approved these changes
Aug 24, 2026
A thrown syncRepo attempt is incomplete and can retry. Do not add it to sync_run.errors, or a later success still blocks last_synced_at.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Manual Security Agent sync and dismiss timeouts are not tRPC admission overload. Scheduled owner sync occupies
security-sync-jobsuntil Cloudflare’s 15-minute queue-consumer limit. Dismiss shares that queue and is markedCOMMAND_STALLEDbefore first delivery.This PR applies the two implementation items from the verified handoff:
security-dismiss-jobsso cheap dismissals do not wait on owner sync.runtime_state.sync_run, and enqueue a continuation. Owner freshness and pruning run only after every selected repository finishes.Analysis stays unchanged. The callback
triggeredByUserIdfailures need a separate workstream.Deploy
Create these queues before the first production deploy:
The sync consumer still accepts leftover dismiss messages during drain.
Verification
ok20,757,unknown3,977, stalled dismiss 30, stalled manual sync 98).pnpm --filter cloudflare-security-sync testpnpm --filter cloudflare-security-sync typecheckpnpm --filter cloudflare-security-sync lintTest plan
cloudflare-security-sync.security-dismiss-jobsand reaches a non-stalled terminal result under scheduled-sync load.Outcome=unknownkills.runtime_state.last_synced_atadvances only after every selected repository in the run is complete.