Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis 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: 5c5e0de849
ℹ️ 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".
| #[cfg(unix)] | ||
| fn process_alive(pid: i32) -> bool { | ||
| // SAFETY: signal 0 only checks that the process exists. | ||
| let r = unsafe { libc::kill(pid, 0) }; | ||
| r == 0 || std::io::Error::last_os_error().raw_os_error() != Some(libc::ESRCH) |
There was a problem hiding this comment.
Provide the required exact-head macOS validation
When Actions is unavailable, AGENTS.md requires local validation on macOS, Linux x86_64, and Linux arm64 and explicitly instructs reviewers to request missing results. This commit's validation notes instead declare macOS unnecessary and reference functional results from an earlier head. Please provide the required test results for the reviewed head on all three platforms; the new Unix-specific implementation does not exempt this change from that review gate.
AGENTS.md reference: AGENTS.md:L70-L77
Useful? React with 👍 / 👎.
| let dir = base.join(format!("{DIR_PREFIX}{}", std::process::id())); | ||
| if std::fs::symlink_metadata(&dir).is_ok_and(|m| m.is_dir()) { | ||
| // left by this process id before (a reused id after a restart): start empty | ||
| let _ = std::fs::remove_dir_all(&dir); | ||
| } | ||
| std::fs::create_dir_all(&dir).ok()?; |
There was a problem hiding this comment.
Reject symlinks when creating the article-store directory
If TempDir is shared and writable by another local user, that user can precreate rustyget-donor-articles-<pid> as a symlink to a directory they control. The preceding symlink_metadata check leaves that symlink intact, and create_dir_all follows it successfully. Article files are then written into the attacker's directory, where they can be read or modified; read_bounded accepts same-length modifications and callers return them as successful articles without repeating the network decoder's CRC validation. Create a private directory exclusively and reject existing symlinks rather than accepting this predictable path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 932113a68f
ℹ️ 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".
| if pid <= 0 || pid as u32 == std::process::id() || process_alive(pid) { | ||
| continue; |
There was a problem hiding this comment.
Clean up stale stores when the daemon reuses its PID
When the daemon restarts with the same PID and a persistent TempDir—for example, when it runs as PID 1 in a container—this condition permanently skips the previous process's store directories. The new process creates another nonce directory, but neither shutdown nor startup removes the old one, so repeated restarts can accumulate up to 512 MB per restart outside the current store's size cap and eventually exhaust the download disk. Distinguish the current store from stale directories with the same PID rather than treating every matching PID as a live store.
Useful? React with 👍 / 👎.
…es in a job store Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
…p by key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
… fetch Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
…ge-id, cleanup outside the lock; altfetchonce requires the store to serve Review findings: a store directory is created new (mode 0700, never an existing or planted one), each file starts with its message-id and is served only under it, a failed read drops its id from the eviction order, stale stores are removed once outside the store's lock, and the scenario fails unless two runs happened and one was served from the store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
…s id; test a file of another article Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
18958d0 to
9ff4f6a
Compare
… still repairs it direct_unpack_forget_holds_keep_borrows hands the download to post-processing, whose stream repair maps the donor again: the store is forgotten only when the download is done with its borrows (direct_unpack_forget_holds), deleted, or returned from history to start over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7097b0234
ℹ️ 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".
| if let Some(hit) = recent_single(msg_id) { | ||
| return Some((hit, false)); | ||
| } | ||
| let stored = crate::donorstore::get(owner, msg_id)?; |
There was a problem hiding this comment.
Register store ownership when serving a memory-cache hit
When two downloads use the same donor, a memory-cache hit returns before the second download is registered as an owner of the stored article. If the first download finishes, donorstore::forget deletes that article even though the second download still needs it. Once subsequent mapping or borrowing activity evicts the memory copy, the second download fetches it from the network again, defeating the cross-run retention this change introduces. Register the requesting owner on memory hits too, retaining the cached bytes in the store if its entry has already disappeared.
Useful? React with 👍 / 👎.
#738) Each repair run of a download maps its alt again (ContentMapper::build_map_with_tls reads every donor volume's first and last article), and the 64-article memo and nntp-rs's 64 MB body cache held less than one walk of a large alt: on the 4 GiB alt failover audit run, two runs (one per hole: part13 dead, part26 two articles missing) each fetched all 170 edge articles of the 85-volume alt, 88-276 MB again. rust/src/donorstore.rs keeps donor articles fetched to map or sample a donor copy on disk (<TempDir>/rustyget-donor-articles-<pid>-<nonce>/, a new 0700 directory; each file carries its message-id and is served only under it), owned by the downloads they were fetched for and dropped when one leaves the queue, capped at 512 MB / 4096 articles. Stream repair's single fetches and volume-edge batch articles, TwinCheck samples and fleet-intake fetches go through it; the fetch cost line counts what it served. Harness scenario altfetchonce (90 MB set, one dead volume plus a later two-article hole, a 90-volume alt): no donor message-id fetched twice, donor bytes within the lost range plus one first and last article per donor volume plus the batch margin; it fails on main (146 ids asked twice) and passes here. Mapping only the donor volumes covering a hole on a first map stays open: a RAR volume's piece offset is the sum of every earlier piece, known only by reading their headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM
Alt borrowing fetches each donor article once
Audit finding 6 (4 GiB alt failover run, 2026-11-26): borrowing for a dead 97.7 MB volume from an
85-volume alt took two fetch passes (186.9 MB and 87.8 MB). Each pass fetched the first and last
article of all 85 donor volumes, so 172 message-ids were requested twice (88–276 MB fetched again).
Why there were two passes
Nothing failed or timed out and restarted. The download had two holes: part13 was dead, and part26
had 2 missing articles. Each hole got its own stream-repair run, and each run has its own
Fetch costline (the second one shows1 batch of 3 articles). Every run builds the donor'spayload map again through
ContentMapper::build_map_with_tls, which reads each volume's firstarticle and, for the end-of-archive block, its last one.
Two caches should have saved the second walk, and both were too small:
RECENT_SINGLESholds 64 articles / 48 MB, but one walk of AltB is 170 articles / 88 MB.FIFO eviction had emptied it before the next run started.
pushed the edge articles out of it.
A second run for a second hole is correct. The bug was that it went back to the network.
Change
rust/src/donorstore.rs, a store of fetched donor articles on disk, keyed by message-id(angle brackets normalised). Only the index is held in memory.
<TempDir>/rustyget-donor-articles-<pid>-<nonce>/, a new directory created withmode 0700. It never reuses an existing path and never follows a symlink.
size is exact.
forget(nzb_id)drops them whenthe download leaves the queue or starts over (
postproc::forget_dead_volume_verdicts).message-id.
kept.
streamrepair_coord.rs):are a volume's first or last article.
plans, so the borrow itself too.
N from the fetched-article store.twin.rs) and fleet intake / probe fetches (dupesearch_coord.rs) readfrom and write to the same store, so a header that was sampled is never fetched again by the
map or the borrow.
Twins and alts rules: no container bytes are compared, the one payload map is unchanged, and
re-RAR header handling is untouched. The store only replaces network fetches: a message-id names
the same article bytes on every server, and offset and file size are kept with the bytes.
OPEN ITEM, not done: mapping only the donor volumes that cover the hole
On a first map with no earlier one, every volume is still walked once. A RAR volume records only
its own piece size (
packed_size), not where that piece sits in the payload. The offset ofvolume k's piece is the sum of every earlier piece, so getting it means reading every earlier
header. Inferring it from equal posted volume sizes would be an assumption, and the rules forbid
that. Once a donor has been walked (by the fleet intake, TwinCheck or a repair run), every later
walk and borrow costs no network.
Tests
donorstore.rsunit tests:altfetchonce:alt (1 MB volumes, 90 of them) waits in history.
per donor volume, plus the batch margin around each hole.
The second run fetched 4.7 MB in 177 single fetches.
single fetches; the rest came from memory (64) and the store (116).
Validation: merged squash 7bef261 (GitHub Actions unavailable; local runs replace it)
7bef261 is a signed squash with sole parent main 4b3f599. Its tree matches branch head d7097b0. That head is 18958d0 rebased onto the new main, plus one fix: the store is now forgotten only when a download is finished with its borrows, is deleted, or goes back from history to the queue. It is no longer forgotten on the path that keeps borrows for post-processing.
Linux, rg-farm
farm-val-7bef261b-1795746942ir2j:macOS on 7bef261 (m5air): still running when this was merged; I will add the result when it lands. The coordinator does not treat macOS as a gate here, because the change has no platform-specific code.
Earlier head 18958d0:
Review: the twin-alt-reviewer gave a clean-room G2G, followed by delta G2Gs on 18958d0 and 683c11fe, and on 7bef261 (the final squash, tree and parent checked).
Deployment
6790 runs 9a2323f3. That build is deploy-6790 eac9eba6, plus the rar-limit fix d6a39194 that 6790
was already running, plus this branch at 18958d0.
4caad4d80addea89c7c8dbe4e8001fcf6167b6bb84f07885efd8fa7f2f06942e/var/backups/rustyget-altfetch-20261127T021334Z; it comparesidentical after the install, and the Server* block is kept.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LG44gYUGuwLMB2hw7HQGbM