fix: conditional podman reset + container build lock#393
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eece379e00
ℹ️ 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 already_exists { | ||
| println!("✓ {} already built (by another process)", image_name); | ||
| drop(lock_file); | ||
| return Ok(()); |
There was a problem hiding this comment.
Do not skip build when image tag already exists
The already_exists fast-path returns before copying updated artifacts and running podman build, so ensure_nested_container can reuse a stale image from a previous run even after fcvm/fc-agent/firecracker binaries changed. In practice, localhost/nested-test will silently run old binaries whenever the tag is present, which invalidates nested test coverage and can hide regressions; the lock should serialize rebuilds, not skip them based only on tag existence.
Useful? React with 👍 / 👎.
🔍 Claude ReviewSEVERITY: none Findings
SummaryClean PR. The removal of Review by Claude | Run |
eece379 to
22ee08b
Compare
22ee08b to
e51012b
Compare
🔍 Claude ReviewSEVERITY: none FindingsNo issues found. The [LOW] doc comment issue from previous review has been addressed — the SummaryClean PR. The conditional Review by Claude | Run |
The reset_podman_state() call fixes "database graph driver does not
match" errors caused by health monitor running `podman inspect` before
storage setup completes.
Previously it ran unconditionally as root, destroying the user's btrfs
storage directory at /var/lib/containers/storage/user-{uid}. Now it
only runs for root podman (empty cmd_prefix). User-mode podman already
resets in create_vm_user().
Also adds file locking to ensure_nested_container() to prevent the
concurrent `podman build` race condition on x64 where multiple nextest
processes race on overlay unmount and corrupt the build cache.
e51012b to
b471846
Compare
🔍 Claude ReviewSEVERITY: medium Findings
SummaryThe code changes themselves are correct — the conditional Review by Claude | Run |
🔧 Auto-Fix CreatedI found issues and created a fix PR: #394 Fixes the doc comment mismatch on The PR description inconsistency (item #2 claiming changes to |
…vior The doc said "Skips the build if another process already built the image" but the code always runs podman build (relying on layer caching). Updated to accurately describe the behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🔍 Claude ReviewSEVERITY: medium Findings
The doc comment issue from that same review has been fixed (PR #394 merged as commit 93fc4e9). SummaryCode is clean — the conditional Review by Claude | Run |
fix: conditional podman reset + container build lock
fix: conditional podman reset + container build lock
Summary
Fix two issues from the
reset_podman_state()change in 5b9d7d1:Make the root podman reset conditional — only run when
cmd_prefixis empty (root mode). For user mode,create_vm_user()already does a user-level reset, and a root reset destroys/var/lib/containers/storage/user-{uid}.Add targeted resets in
mount_overlay_image()and the root-btrfs path ofsetup_btrfs_storage_if_available()— these handle stale db.sql from rootfs build (apt post-install creates it with empty driver).Add file locking to
ensure_nested_container()— prevents concurrentpodman buildrace on x64 where multiple nextest processes race on overlay unmount.What changed
fc-agent/src/agent.rs: Guard
reset_podman_state()withif cmd_prefix.is_empty()fc-agent/src/container.rs: Add reset after writing storage.conf in overlay and root-btrfs paths; update docstring
tests/common/mod.rs: Add exclusive file lock around
podman buildRoot cause
The original
reset_podman_state()(5b9d7d1) ranpodman system reset --forceas root unconditionally. For user mode, this destroyed/var/lib/containers/storage/user-1000, causing "mkdir permission denied" inpodman load. The fix makes it root-only and adds targeted resets in the specific setup functions.Test plan