Skip to content

fix(start): make retry-loop containers self-removing - #243

Merged
Kubuxu merged 2 commits into
FilOzone:mainfrom
OzzyHelper:koan/retry-safe-container-names
Nov 20, 2026
Merged

Kubuxu merged 2 commits into
FilOzone:mainfrom
OzzyHelper:koan/retry-safe-container-names

Conversation

@OzzyHelper

@OzzyHelper OzzyHelper commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Make the read-only Docker containers used inside startup retry loops remove
themselves on exit, and scope the remaining fixed endorsement container names
by run id.

Why

retry_with_fixed_delay closures reused a fixed docker run --name without
--rm. As soon as an attempt failed, its stopped container survived and every
subsequent retry failed instantly with container name is already in use —
turning a transient RPC hiccup into a permanent failure. The MockUSDFC
verification, PDP registry queries, and endorsement receipt/provider-list
checks were all affected. Two endorsement names (foc-verify-endorse-<id>,
foc-get-provider-ids) did not include the run id at all, so a container left
behind by an interrupted run could block the next network start.

How

  • Added docker::shell::ephemeral_run_args(name, user) — the common
    run --rm --name <n> -u <u> --network host prefix — so the retry-safe
    invariant lives in one place instead of being re-derived per call site.
  • Used it for the 6 affected read-only invocations.
  • Receipt/provider-list container names now embed run_id.

Transaction containers (registration, endorsement send) intentionally keep
their containers for post-mortem log inspection and are unchanged.

Testing

  • cargo clippy --lib -- -D warnings — clean.
  • cargo test --lib — 52 passed; 2 failures are the pre-existing
    Docker-dependent status tests (test_print_running_status,
    test_print_uptime) that fail in this sandbox without a Docker CLI.
  • New unit test test_ephemeral_run_args_remove_container_on_exit pins the
    --rm/--name/--network host contract.

Quality Report

Changes: 6 files changed, 79 insertions(+), 70 deletions(-)

Code scan: clean

Tests: skipped

Branch hygiene: 1 issue(s)

  • Branch is not pushed to remote

Verification helpers run inside retry_with_fixed_delay closures that reuse a
fixed docker --name. Without --rm the first failed attempt leaves a stopped
container and every retry fails immediately with 'container name is already
in use'.

Add ephemeral_run_args() (run --rm --name <n> -u <u> --network host) and use
it for the MockUSDFC, PDP registry verification, and endorsement read-only
checks. Endorsement receipt/provider-list container names now include the run
id so a leftover container from an interrupted run cannot block a new one.
@FilOzzy FilOzzy added this to FOC Nov 19, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Nov 19, 2026
@Kubuxu

Kubuxu commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

@OzzyHelper rebase, fix the lint

@OzzyHelper

Copy link
Copy Markdown
Contributor Author

❌ Permission denied. Only users with write access can trigger bot commands.

@Kubuxu

Kubuxu commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

github-mgmt run has failed, so it didn't add OzzyHelper to the repo

@BigLep

BigLep commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

I'll take a quick look @Kubuxu

@BigLep

BigLep commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@Kubuxu : with quick agent help, we couldn't figure out why FilOzone/github-mgmt#75 didn't apply. I manually added for now...

@Kubuxu

Kubuxu commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

@OzzyHelper rebase, fix the lint

@OzzyHelper

Copy link
Copy Markdown
Contributor Author

Rebase with requested adjustments

Branch koan/retry-safe-container-names was rebased onto main and review feedback was applied.

Changes applied

  • Formatted src/docker/shell.rs test assertions with cargo fmt (CI lint.sh fmt check failed there).
  • Verified rebase state: branch already based on main, no rebase needed.
  • Notes: cargo fmt --check passes. cargo clippy could not run here — sandbox lacks cc/glibc dev libs. No review comments to process.

Stats

6 files changed, 83 insertions(+), 70 deletions(-)
Actions performed
  • Already-solved check: negative (confidence=high, reasoning=Main still lacks ephemeral_run_args and --rm; endpoint verification containers still use fixed un-sc)
  • Rebased koan/retry-safe-container-names onto origin/main
  • Applied review feedback
  • Pre-push CI check: previous run #44567098966 failed
  • Pre-push CI fix: no changes needed or Claude found nothing to fix
  • Force-pushed koan/retry-safe-container-names to fork
  • Private review gate skipped: disabled by config
  • Force-push guard: all original PR content verified preserved
  • CI check enqueued in ## CI (async)

CI status

CI will be checked asynchronously.


Automated by Kōan

@FilOzzy FilOzzy moved this from 📌 Triage to ⌨️ In Progress in FOC Nov 19, 2026
@Kubuxu
Kubuxu marked this pull request as ready for review November 20, 2026 13:52
@Kubuxu
Kubuxu requested a review from beck-8 as a code owner November 20, 2026 13:52
Copilot AI balanced review requested due to automatic review settings November 20, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the read-only container cleanup and run-scoped endorsement naming changes.

No open issues 🎉

What changed in this PR

This PR prevents stopped read-only Docker containers from blocking startup retries in foc-devnet and makes endorsement check container names unique per run.

Changes:

  • Adds a shared Docker argument helper with automatic removal and a unit test for its contract.
  • Applies the helper to six read-only startup checks, leaving transaction containers available for log inspection.
  • Passes the run ID into endorsement receipt and provider-list checks.
File Description
src/​docker/​shell.rs Adds ephemeral_run_args and tests automatic removal, naming, and host networking.
src/​docker/​mod.rs Re-exports the new helper.
src/​commands/​start/​usdfc_deploy/​verification.rs Makes MockUSDFC verification containers self-removing.
src/​commands/​start/​pdp_service_provider/​registration.rs Makes provider count, ID, and approval query containers self-removing.
src/​commands/​start/​endorsement/​operations.rs Adds automatic removal and run-scoped names to receipt and provider-list checks.
src/​commands/​start/​endorsement/​endorsement_step.rs Supplies the current run ID to the provider-list query.

Review effort: Balanced

@Kubuxu
Kubuxu merged commit 8eaf449 into FilOzone:main Nov 20, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from ⌨️ In Progress to 🎉 Done in FOC Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

4 participants