Skip to content

fix: serialize repository refreshes and recover stale downloads - #842

Merged
tdurieux merged 2 commits into
mainfrom
fix/repository-refresh-concurrency
Sep 27, 2026
Merged

tdurieux merged 2 commits into
mainfrom
fix/repository-refresh-concurrency

Conversation

@tdurieux

@tdurieux tdurieux commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Overlapping dashboard refreshes could both start GitHub work and overwrite a removal requested while that work was running. The refresh guard also rejected stale downloads indefinitely.

Claim a five-minute MongoDB lease before refreshing, guard refresh writes against lease and lifecycle changes, and release only the request's own lease. Downloads older than five minutes can be retried only when BullMQ has no live job. Save the new commit and PREPARING status atomically; failed preparations remain retryable. Ready snapshots stay available during GitHub lookups.

Addresses the concurrency and stale-download findings from the second Codex review of #841. The reported missing polling endpoint already exists; an HTTP routing test confirms GET /api/repo/:repoId returns status through the mounted routers, including when GitHub credentials are unavailable.

Validation: 91 focused tests pass, including overlapping refreshes, lease replacement, removal/expiry/archive races, restoration, and polling. Changed files pass ESLint. TypeScript checking reports only the existing errors in unchanged files.

@tdurieux

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T06:44:33.736943Z 083544b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0002e8d1a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/routes/repository-private.ts
Comment thread src/core/Repository.ts
@tdurieux

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 083544bf68

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tdurieux
tdurieux merged commit c5fe95e into main Sep 27, 2026
2 checks passed
@tdurieux
tdurieux deleted the fix/repository-refresh-concurrency branch September 27, 2026 06:45
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.

1 participant