Skip to content

Fix S3 rate limit retry and simplify SSH auth - #66

Merged
neuromechanist merged 3 commits into
devfrom
fix/s3-rate-limit-retry
Jan 22, 2026
Merged

neuromechanist merged 3 commits into
devfrom
fix/s3-rate-limit-retry

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Jan 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add retry with backoff (4s, 10s, 20s, 30s) for S3 503 SlowDown errors during presigned URL uploads
  • Reduce default parallel upload jobs from 8 to 4 to avoid triggering rate limits
  • Print explicit message when rate limiting is hit so users know what's happening
  • Simplify SSH auth: use standard [email protected] instead of custom nemar-{user}-github hostname
  • Fall back to HTTPS with gh CLI token if SSH is not available

Details

S3 rate limiting (#64): Previously only 403 AccessDenied errors (IAM propagation delays) were retried. When S3 returned 503 SlowDown on larger datasets (230+ files), uploads failed immediately on the last few files.

SSH simplification (#65): The custom SSH hostname pattern (nemar-{username}-github) required manual ~/.ssh/config setup and consistently failed for users. Multi-account support is no longer pursued, so we now use standard github.com SSH directly.

Closes #64
Closes #65

Test plan

  • Build passes
  • All 121 tests pass
  • Test with large dataset upload to confirm retry behavior
  • Verify SSH works without custom config on a fresh machine

Add retry with backoff (4s, 10s, 20s, 30s) for S3 503 SlowDown
errors and reduce default parallel jobs from 8 to 4. Previously
only 403 errors were retried, causing uploads to fail on larger
datasets when S3 throttled requests.

Closes #64
Remove custom SSH hostname (nemar-{user}-github) which was designed
for multi-account support that is no longer pursued. Use standard
[email protected] SSH with HTTPS fallback via gh CLI token.

Closes #65
@neuromechanist neuromechanist changed the title Fix S3 rate limit (503 SlowDown) handling in uploads Fix S3 rate limit retry and simplify SSH auth Jan 22, 2026
- Restore SSH diagnostic logging in testGitHubSsh for debuggability
- Add user feedback for IAM retry (matching rate-limit pattern)
- Replace fixed delay array with exponential backoff formula
- Simplify configureGitHubRemote by removing redundant regex nesting
- Update JSDoc to mention both 403 and 503 retry scenarios
- Fix biome formatting
@neuromechanist

Copy link
Copy Markdown
Contributor Author

PR Review Findings (Addressed in b72d2b0)

Issues Found and Fixed

Critical:

  • testGitHubSsh had all diagnostic logging removed, creating a debugging black hole when SSH fails. Restored console.warn with exit code and stderr for failed attempts.

Important:

  1. IAM retry had no user feedback - rate-limit retries logged a message but IAM 403 retries were completely silent (up to 70s of apparent hanging). Added matching console.warn.
  2. rateLimitDelays array was fragile - fixed-length array with ?? 30000 fallback masked out-of-bounds access. Replaced with exponential backoff formula: Math.min(4000 * 2^attempt, 30000).
  3. Redundant regex nesting in configureGitHubRemote - if (match) guard was always true after startsWith check. Simplified with String.replace().

Suggestions Applied:

  • Updated JSDoc on uploadFileWithPresignedUrl to document both 403 and 503 retry scenarios.
  • Fixed biome formatting (2-arg function call on single line).

Remaining Notes

  • Multi-account SSH regression: since multi-account support is dropped, this is intentional. The gh CLI HTTPS fallback covers the use case. Worth verifying on test machines (mcm/mba).

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.

Use standard github.com SSH instead of custom SSH hostname Still fails on larger dataset

1 participant