GeezerVison is showing github.com — fix(mcpx): hold the artifact name claim across the delivery write (#4253) by dezren39 · Pull Request #4257 · developing-today/code
Conversation
dezren39
commented
Nov 2, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes the never-overwrite race triaged in #4253 (task 6125, confirmed on main; fix = task 6127).
The bug: uniquePath created its O_EXCL claim file, deleted it, and returned the bare path. Store.Export (via copyInto), the exec streaming path, and fetchArtifacts (via writeNew) then finished with an overwriting os.Rename onto that path — a destination appearing in the window was silently replaced, and two concurrent same-name deliveries could both be handed the same path.
The fix: ClaimPath (replacing the racy UniquePath API) returns the destination already created, with the O_EXCL claim held open. Every delivery path writes into the claim and closes it; on failure the claimed name is removed, so nothing partial looks delivered. Writing into the claim is a copy, per the #1660 settlement — no link semantics introduced.
Tests (failing-first, class-wide per internal/AGENTS.md):
TestClaimPathHoldsTheNameUntilTheWriteIsDone — the exact interleaving: a second claim while the first write is in flight gets the suffixed name.
TestExportConcurrentSameNameDeliveriesAllSurvive — 8 concurrent same-name exports, distinct paths, own bytes.
TestExportKeepsAForeignFileThatHoldsTheName / TestFetchArtifactsKeepsAForeignFileThatHoldsTheName — foreign bytes preserved, delivery suffixes, recorded Path matches the file written.
TestDeliveryPathsHoldTheirClaims — source guard: no UniquePath references remain; the CLI delivery file must not rename onto a destination again.
CI-first: targeted package tests were not run locally (laptop under extreme load); CI results on this PR are the verification. Parked in the queue awaiting CI + Codex review.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
)
uniquePath created its O_EXCL claim, deleted it, and returned the bare
path; Store.Export (copyInto), the exec streaming path, and
fetchArtifacts (writeNew) then finished with an overwriting os.Rename.
A destination appearing in the window was silently replaced, and two
concurrent same-name deliveries could be handed the same path.
ClaimPath now returns the destination already created, with the claim
held open; every delivery path writes into the claim and closes it, and
a failure removes the claimed name so nothing partial looks delivered.
The racy UniquePath API is removed.
Tests: claim-held interleaving, concurrent same-name exports (class
width), foreign-file preservation for Export and fetchArtifacts, and a
source guard keeping the resolve-then-rename shape from returning.
coderabbitai
Bot
commented
Nov 2, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You'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 49 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
cebb2a00-03cc-484f-97fc-152e5630437c
Commits
-
Reviewing files that changed from the base of the PR and between bf0420f and e3d1e13.
Files selected for processing: 5
-
pkgs/mcpx/internal/artifacts/artifacts.go
pkgs/mcpx/internal/artifacts/delivery_race_test.go
pkgs/mcpx/internal/artifacts/name.go
pkgs/mcpx/internal/cli/exec.go
pkgs/mcpx/internal/cli/exec_artifacts_test.go
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-02T07:51:06.905988Z |
e3d1e13 |
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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: a75465a4f9
ℹ️ 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".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
return err
|
|
|
}
|
|
|
if err := os.Rename(w.Name(), dest); err != nil {
|
|
|
if _, err := w.Seek(0, io.SeekStart); err != nil {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the staged artifact open until the copy finishes
When a streamed artifact has received a data frame, FrameArtifactEnd closes w at line 309 before this new seek, so w.Seek always returns file already closed. Consequently, execRemoteStream aborts on the first such artifact instead of delivering it or processing the remaining frames. Keep the staged file open through the seek and copy, then close and remove it afterward. The existing TestApplyFrameSameNamedArtifactsNeverOverwrite exercises this path, although local execution was blocked by the installed Go 1.25.1 being older than the required Go 1.27.2.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in e3d1e13: applyFrame keeps the staged temp file open through Seek and io.Copy, then closes it and removes the staging path. The streaming regression, full artifacts/CLI package suite, and delivery tests under -race -shuffle=on -count=5 all pass.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@codex review Please re-review head e3d1e13, especially the previously reported P1 on closing the streamed artifact staging file before seeking/copying.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Codex Review: Didn't find any major issues. You're on a roll.
Reviewed commit: e3d1e1301e
ℹ️ 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".
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
agent-note:v1 — salvage note from task 13544 (lane code-k) closing duplicate PR #7242. File-by-file diff of PR #7242 head e3d1e13 vs current main: name.go and exec_artifacts_test.go identical; delivery_race_test.go on main differs only by a later lint cleanup; artifacts.go and cli/exec.go diffs are main-side advances (RandSource, idleTTL naming, dryRun/depsOptions/imports flags) that PR #7242 would revert. PR #7242 first commit landed via this PR #4257 (merged); its unique commit e3d1e13 (keep streamed artifact staging file open) is present on main in evolved form (exec.go stagedPath line ~309, claim.Close ~335-349). Verdict: nothing unique to salvage from PR #7242.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|