Skip to content

OUT-4175: tighten stuck-pending threshold and retry sweep cadence - #152

Merged
SandipBajracharya merged 3 commits into
mainfrom
OUT-4175-new
Sep 14, 2026
Merged

SandipBajracharya merged 3 commits into
mainfrom
OUT-4175-new

Conversation

@SandipBajracharya

Copy link
Copy Markdown
Collaborator

Summary

Tunes two loose values in the failed-sync resync path (OUT-4175).

  • Reduce STUCK_PENDING_THRESHOLD_MS from 12h → 2h — the grace period before a still-pending Assembly file is treated as abandoned and reclaimed (delete + re-create). Normal uploads complete in seconds–minutes, so 2h is ample headroom while reclaiming genuinely stuck files far sooner.
  • Run the retry sweep 3×/day, every 8h (0 0,8,16 * * *) instead of twice a day.

Notes

  • 2h sits below the 8h sweep on purpose: the manual UI resync exercises the same threshold at fine granularity, so a genuinely stuck file (>2h) is reclaimed on demand while in-flight uploads stay protected.
  • 3×/day shortens MAX_ATTEMPTS exhaustion from ~5 days to ~3.3 days (intended).

Testing

  • pnpm typecheck — clean
  • pnpm test (unit) — 294 passed
  • Updated the "young stuck-pending" integration test to seed under the new 2h cut-off. Integration suite (pnpm test:integration) needs a container runtime and was not run in this environment.

🤖 Generated with Claude Code

Reduce STUCK_PENDING_THRESHOLD_MS from 12h to 2h and run the retry
sweep three times a day (every 8h) instead of twice. Update the young
stuck-pending test to seed under the new 2h cut-off.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dropbox-integration Ready Ready Preview Sep 14, 2026 8:11am UTC

Request Review

@linear-code

linear-code Bot commented Sep 11, 2026

Copy link
Copy Markdown

OUT-4175

@greptile-apps

greptile-apps Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

The PR is not yet safe to merge because pending uploads between two and four hours old will not be reclaimed as required.

Findings

  1. P1 Reclamation cutoff is too late ▶

Summary

  • The schedule now runs at 00:00, 08:00, and 16:00 UTC.
  • The current revision sets the pending-upload cutoff to four hours rather than the stated two hours.
  • Integration fixtures were updated to exercise the four-hour behavior.

Reviews (3) · Last reviewed commit: "feat(OUT-4175): raise stuck-pending thre..."

Comment thread test/flows/resync-sweep.integration.test.ts Outdated
Seed the abandoned stuck-pending rows just over the new 2h cut-off
(hoursAgo(3)) so a regression back to the old 12h threshold fails
the test. Addresses Greptile review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@SandipBajracharya

Copy link
Copy Markdown
Collaborator Author

@greptileai review again

@SandipBajracharya SandipBajracharya changed the title feat(OUT-4175): tighten stuck-pending threshold and retry sweep cadence OUT-4175: tighten stuck-pending threshold and retry sweep cadence Sep 11, 2026

@priosshrsth priosshrsth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Give slow in-flight Assembly uploads more time before the sweep treats
them as abandoned and force deletes + recreates them. Move the pinned
abandoned-reclaim fixtures just past the new cut-off.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@SandipBajracharya

Copy link
Copy Markdown
Collaborator Author

@greptileai review

Comment on lines +28 to +29
// Pending uploads older than 4 hours are treated as abandoned and reclaimed.
const STUCK_PENDING_THRESHOLD_MS = 4 * 60 * 60 * 1000

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Reclamation cutoff is too late

The latest revision sets the stale-upload cutoff to 4 hours instead of the intended 2 hours. A pending Assembly upload between 2 and 4 hours old will therefore remain untouched in both scheduled and manual recovery, delaying resynchronization. The integration fixtures were also changed from 3 to 5 hours, so they now enforce the unintended 4-hour cutoff.

Suggested change
// Pending uploads older than 4 hours are treated as abandoned and reclaimed.
const STUCK_PENDING_THRESHOLD_MS = 4 * 60 * 60 * 1000
// Pending uploads older than 2 hours are treated as abandoned and reclaimed.
const STUCK_PENDING_THRESHOLD_MS = 2 * 60 * 60 * 1000

Knowledge Base Used: Failed-file resynchronization

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to 4h is intentional as there can be certain reason for slow upload of the file in Assembly (trigger.dev issue, large files, etc). This is done to be on the safe side.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. Given the possibility of slow Assembly uploads from Trigger.dev issues or large files, the 4-hour cutoff is an intentional safety margin. With that context, my concern about the 2-hour requirement does not apply, so I’m withdrawing this review comment.

@SandipBajracharya
SandipBajracharya merged commit 5660a1a into main Sep 14, 2026
11 checks passed

This branch was successfully deployed

1 active deployment
Preview — 0aea26d3 Deployed Sep 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants