Skip to content

fix: await upload session registration - #50

Merged
danny-avila merged 2 commits into
mainfrom
danny-avila/fix-upload-session-race
Aug 14, 2026
Merged

fix: await upload session registration#50
danny-avila merged 2 commits into
mainfrom
danny-avila/fix-upload-session-race

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

I fixed the upload authorization race that could register files under unusable upload:null... keys by making Redis session registration a strict prerequisite for file-server forwarding.

  • Awaited the session-key SET before every /upload PUT.
  • Shared one request-scoped registration promise across /upload/batch so every file waits for the same completed write.
  • Drained upload streams and returned HTTP 500 when batch session registration fails.
  • Added deterministic regression coverage for ordering, shared batch registration, and registration failure.

Fixes #40

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • Ran cd service && bun run build.
  • Ran cd service && bun run test: 523 tests passed.
  • Ran cd service && bun test src/service/upload-session.test.ts --rerun-each 20: 60 repeated tests passed.

Test Configuration:

  • Bun 1.3.13
  • macOS

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

@danny-avila
danny-avila marked this pull request as ready for review August 14, 2026 14:36

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: a8a32604f7

ℹ️ 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 service/src/service/router.ts

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: ed3e94e41f

ℹ️ 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".

@danny-avila
danny-avila merged commit 3f8f571 into main Aug 14, 2026
6 checks passed
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.

Race condition in /upload and /upload/batch causes silent, permanent 403 on uploaded files (upload_missing)

2 participants