Repository navigation
feat(uploads): delete removed uploads from the host even across dropped connections - #382
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
Code Review Roast 🔥Verdict: No Issues Found | Recommendation: Merge Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. 📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are. This is a one-method fix with its own regression test, and both sides check out. The incremental diff's production change is Files Reviewed (3 files)
Previous Review Summaries (3 snapshots, latest commit ed8b649)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit ed8b649)Verdict: No Issues Found | Recommendation: Merge Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. 📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are. The four prior adversarial findings (retained-worker abort replay on Retry, in-flight host abort re-parking, SSE retry not notifying the worker, and outstanding HTTP deletions clobbering a newer attempt) are all marked fixed by the author on This diff's only production change is Files Reviewed (6 files)
Previous review (commit c06b24f)Verdict: No Issues Found | Recommendation: Merge Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. 📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are. Files Reviewed (7 files)
Previous review (commit b03db90)Verdict: No Issues Found | Recommendation: Merge Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. 📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are. Files Reviewed (3 files)
Reviewed by free · Input: 79.3K · Output: 18.8K · Cached: 186.4K |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b03db90208
ℹ️ 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".
b03db90 to
c06b24f
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c06b24f854
ℹ️ 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".
Removing an upload chip, or discarding a finished upload, now deletes the host's staged copy once the browser, server and host can reach each other again: - the worker keeps each abort until the server has it (link line until acked and resent on a resync; in SSE mode a DELETE retried with back-off and on wake); - main keeps an uploadAbort its host could not take and resends it on that host's next hello, and aborts ids it no longer registers on the host the browser names; - the daemon sweeps expired staged files every hour, not only at start and on uploadStart.
…ng abort, cover the new paths Review: a hanging DELETE blocked every retry (40 s deadline now; 408/429 retry); a parked uploadAbort replayed on a host's next hello could delete a Retry of the same id (a new uploadStart drops it); the route, browser-link host pass-through, the per-host cap and the unknown-host guard had no tests. Also drops a redundant resend loop and fixes an AGENTS.md mis-splice.
… layer Codex review: a cancel still pending in the worker was resent after a resync and deleted a completed Retry of the same id; on main, an uploadAbort still in flight when the Retry started was parked again when it timed out and replayed on the next hello. The worker now drops its pending cancel when the id is uploaded again, and main does not park an abort whose id was registered again meanwhile.
… upload id Codex review: the only uploads that are both cancelled and retried are the ones a bfcache pagehide made the worker cancel (410). Retrying them under the same id raced that cancel on every path: an SSE Retry bypasses the worker, and an HTTP DELETE already in flight could land after the Retry finished. Their host copy is deleted anyway, so the chip now takes a new id on that failure and its Retry starts over; the old id's cancel can no longer reach it.
b8a9a0b to
ed8b649
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed8b649236
ℹ️ 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".
…he host Codex review: StagedUploads.sweep() rejected when an idle upload's files could not be removed (a .part replaced by a directory, EPERM). From the new hourly timer that is an unhandled rejection that exits the daemon; before uploadStart it failed every new upload. The sweep now logs that failure and goes on.
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Follow-up to #372. When you remove an upload chip, or discard a finished upload, the host now deletes its staged copy even if the connection was down at the time. Before, the cancel was lost whenever the browser was disconnected, the host was offline, or the server no longer knew the upload, and the partial file (up to 2 GiB) stayed on the host until a later upload or a daemon restart swept it after a day.
What changes
Browser (tab and worker)
{op: "up_abort", id, host}. Only a tab without a worker sends aDELETEitself.up_abortline. If the link is down, the worker dials for it. The line is kept until the server acks it and is sent again after a resync.DELETE /api/uploads/<id>?host=<host>, with a 40 s deadline. A 2xx, or a 4xx other than 408 and 429, settles it. Anything else is retried after 5 s, 15 s, then every 60 s, and at once when the network comes back or the tab becomes visible.Server
uploadAbortthe host could not take (503host_offline, 504host_timeout) is kept for that host, at most 1000 per host, and sent again on its next hello.uploadStartof that id drops its pending abort, so a Retry can't be deleted by the abort its own failure left behind.Daemon
uploadStart. This is the backstop for the cases above that are kept in memory only.Verification
npm run typecheck,npm run lint(0 errors),npm test(2492 pass, 0 fail) andnpm run buildpass.DELETE ?host=on an upload the server forgot;up_abort {host}sent through the browser link.DELETE; 408 and 429 retried; the host fallback when a tab closes.Known limit
Pending cancels live in memory. A cancel is lost if the browser closes before delivering it, or if the server restarts while holding one for an offline host. The hourly sweep then deletes the file once it is 24 h old.
Not tested: Windows, and a real remote host.