Skip to content

fix(ci): resolve SANDBOX_DOCKER_EXACT_PATHS crate prefixes dynamically - #7394

Open
theredspoon wants to merge 2 commits into
nearai:mainfrom
theredspoon:agent/qa-sandbox-docker-exact-paths
Open

theredspoon wants to merge 2 commits into
nearai:mainfrom
theredspoon:agent/qa-sandbox-docker-exact-paths

Conversation

@theredspoon

@theredspoon theredspoon commented Aug 8, 2026 •

Copy link
Copy Markdown

SANDBOX_DOCKER_EXACT_PATHS in scripts/ci/reborn_pr_test_plan.py hardcoded the crate-root prefix (crates/app/..., crates/kernel/..., crates/lanes/...) for every entry owned by ironclaw_cli, ironclaw_composition, ironclaw_config, ironclaw_host_runtime, ironclaw_runtime_policy, and ironclaw_sandbox. If any of those crates is relocated, the literal stops matching and the planner silently stops routing that crate's listed files to the Docker sandbox lane — no error, just quietly dark coverage. This is the same bug class ironclaw_wasm has hit at least twice already (538b1f021 moved it into crates/lanes/, 8ed9d4afc moved every crate into its family directory), each time requiring a follow-up fix (48e27e0f9, 00d9679b3) to re-resolve the path dynamically.

I replaced the constant with _sandbox_docker_exact_paths(), matching the pattern already established in this file by _sandbox_docker_prefixes() and _webui_frontend_prefix():

  • SANDBOX_DOCKER_EXACT_PATH_LITERALS — the 10 entries with no owning crate (Dockerfile.sandbox-worker, root-level tests/... paths), unchanged as plain literals.
  • SANDBOX_DOCKER_EXACT_PATH_CRATE_SUFFIXES — a dict[str, tuple[str, ...]] mapping the 6 crate names to their 17 crate-relative suffixes, joined at call time with crate_directory(crate, ROOT).
  • Fails closed with RuntimeError if a crate can't be resolved, same message style as _sandbox_docker_prefixes().

I verified all 27 original entries are represented 1:1 in the new split (10 literals + 17 crate suffixes), and independently confirmed crate_directory() resolves all 6 crate names to the exact prefixes the old literals assumed.

Tests: added test_sandbox_docker_exact_paths_resolve_through_crate_inventory_when_nested (proves a relocated crate's entries follow it, old-location entries disappear) and test_sandbox_docker_exact_paths_resolution_failure_fails_closed (proves the RuntimeError fail-closed path). Updated two pre-existing tests to mock _sandbox_docker_exact_paths since it's now called unconditionally in build_plan() alongside their own crate_directory mocks — verified this guard is load-bearing by removing it and confirming both tests fail for the expected reason. Added test_sandbox_docker_exact_paths_route_relocated_crate_through_build_plan in response to CodeRabbit feedback that the first test above only pins _sandbox_docker_exact_paths()'s return value, which would stay green even if build_plan() stopped consuming the resolved set or setting run_sandbox_docker for a matched path — this test drives build_plan() itself with a relocated crate and asserts the emitted Docker-lane flag, closing that coverage gap.

test_reborn_pr_test_plan.py: 75/75 passing. test_ws12_workflow_contracts.py: 52/52 passing.

…l prefix

SANDBOX_DOCKER_EXACT_PATHS hardcoded the crate-root prefix for every
entry owned by ironclaw_cli, ironclaw_composition, ironclaw_config,
ironclaw_host_runtime, ironclaw_runtime_policy, and ironclaw_sandbox.
A future relocation of any of those crates (this repo has already
moved ironclaw_wasm twice) would silently stop matching those files,
quietly dropping them from the Docker sandbox lane with no error.

Replace the constant with _sandbox_docker_exact_paths(), which keeps
each entry's crate-relative suffix as a literal but resolves the
crate's root directory through crate_directory(), matching the
established pattern in _sandbox_docker_prefixes() and
_webui_frontend_prefix(). Fails closed with a RuntimeError if any of
the six crates can't be resolved. Non-crate-owned entries
(Dockerfile.sandbox-worker, root-level tests/...) stay plain literals.
@github-actions github-actions Bot added size: M 50-199 changed lines risk: low Changes to docs, tests, or low-risk modules contributor: new First-time contributor labels Aug 8, 2026
@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved pull request test planning for sandbox Docker changes when crate directories are relocated or nested.
    • Removed outdated paths while preserving unrelated ownership and affected paths.
    • Added safer handling so planning fails closed when crate directory resolution is unavailable.
  • Tests

    • Expanded coverage for relocated crate directories, stale path removal, unrelated owners, and resolution failures.

Walkthrough

Sandbox Docker exact-path routing now resolves crate-owned paths through crate_directory. The planner retains root-level literals, appends crate-relative suffixes, and fails closed when crate resolution fails. Tests cover relocation, plan selection, and frontend-resolution interactions.

Changes

Sandbox Docker exact-path routing

Layer / File(s) Summary
Crate-aware exact-path resolution
scripts/ci/reborn_pr_test_plan.py
Root-level literals are separated from crate-relative suffixes. _sandbox_docker_exact_paths() resolves owning crates through crate_directory and raises on failure.
Plan integration and validation
scripts/ci/reborn_pr_test_plan.py, scripts/ci/test_reborn_pr_test_plan.py
Plan construction uses resolved paths. Tests cover relocation, stale-path removal, unrelated paths, targeted plan selection, frontend resolver isolation, and resolution failures.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Planner
  participant CrateInventory
  participant TestPlan
  Planner->>CrateInventory: Resolve owning crate directories
  CrateInventory-->>Planner: Return crate paths
  Planner->>Planner: Append crate-relative suffixes
  Planner->>TestPlan: Build plan with resolved exact paths
Loading

Possibly related PRs

  • nearai/ironclaw#7063: Updates the same planner to resolve relocated crate paths through crate inventory.
  • nearai/ironclaw#7161: Replaces hardcoded planner paths with crate-inventory-based resolution.

Suggested reviewers: benkurrek

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation and tests, but it omits most required template sections, including change type, linked issue, security, database, rollback, and review follow-through. Rewrite the description using the repository template and complete all required sections, marking non-applicable sections explicitly.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title uses Conventional Commits style and clearly describes dynamic resolution of sandbox Docker crate paths, despite naming the replaced constant.

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

Comment @coderabbitai help to get the list of available commands.

@ironloopai

ironloopai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

🧭 IronLoop Run · Review

This comment updates in place as the Run moves through its stages.

🟩 Final result · Completed

🟨 Queued → 🟦 Working → 🟦 Posting results → 🟩 Completed

Automatic trigger · attempt 1 of 3 · completed in 4m 15s

IronLoop completed the review and posted it to GitHub.

🔗 Result

Open submitted review →

Run details

Run: 73c22572-6f0d-4d36-a32f-1447ccf76639
Base: main at 102e5e0
Head: agent/qa-sandbox-docker-exact-paths at b08afe6
Created: 2026-08-08 16:46 UTC
Updated: 2026-08-08 16:50 UTC

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: b08afe6a12

ℹ️ 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".

with mock.patch.object(
planner, "crate_directory", side_effect=fake_crate_directory
):
exact_paths = planner._sandbox_docker_exact_paths()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Test relocated exact paths through build_plan

This regression test calls _sandbox_docker_exact_paths() directly, so it remains green if build_plan() stops consuming the resolved set or fails to set run_sandbox_docker for a relocated path—the exact silent loss of Docker coverage this change is intended to prevent. Drive build_plan() with the relocated planner.rs/resolver.rs paths and assert the emitted Docker-lane flag instead of only inspecting the helper result.

AGENTS.md reference: AGENTS.md:L78-L83

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Confirmed, and fixed in 77923ed. I reproduced the gap with a mutation test first: I removed the path in sandbox_docker_exact_paths arm from build_plan()'s consumption check (keeping the prefix arm intact) and reran the suite. test_sandbox_docker_exact_paths_resolve_through_crate_inventory_when_nested stayed green because it only asserts on _sandbox_docker_exact_paths()'s return value, never touching build_plan(). That's the exact silent-coverage-loss scenario this PR exists to prevent.

Added test_sandbox_docker_exact_paths_route_relocated_crate_through_build_plan, following the same pattern as test_sandbox_docker_prefix_follows_crate_inventory_when_nested: it mocks crate_directory to relocate ironclaw_runtime_policy and drives build_plan() itself instead of calling the resolver directly. With the mutation in place this new test fails (run_sandbox_docker is False); reverting the mutation makes it pass again.

One deliberate detail: the test also mutates the synthetic package's manifest_path to the relocated directory. Without that, build_plan()'s package-directory lookup can't find the moved crate, hits the "a crate path maps to no workspace package" arm, and falls back to _full_plan() — which sets run_sandbox_docker=True unconditionally regardless of the exact-paths logic. That fallback would make the assertion pass for the wrong reason and mask a real regression. The test also asserts plan["mode"] == "selected" (not "full") specifically to rule that out.

Reran both suites clean: test_reborn_pr_test_plan.py (75/75) and test_ws12_workflow_contracts.py (52/52).

@ironloopai ironloopai Bot 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.

🔍 IronLoop review

🟢 No actionable findings

No actionable findings in the exact merge-base-to-head comparison.

Validation

  • ✅ git diff --check — Completed without whitespace errors.
  • ⚪ Focused behavioral validation — Not run. No concrete defect warranted execution; the review relied on static inspection of the complete diff, planner call paths, crate inventory behavior, and tests.
Review details
  • Run: 73c22572-6f0d-4d36-a32f-1447ccf76639
  • Workflow: Review
  • Attempts: 1

_sandbox_docker_exact_paths_resolve_through_crate_inventory_when_nested
only inspects the resolver's returned set, so it would stay green if
build_plan() stopped consuming that set or stopped setting
run_sandbox_docker for a matched path. Its sibling relocation test for
_sandbox_docker_prefixes already drives build_plan() end-to-end; add
the equivalent for the exact-paths resolver so a regression in
build_plan()'s consumption of the resolved set is actually caught.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: new First-time contributor risk: low Changes to docs, tests, or low-risk modules size: M 50-199 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant