[AUTO-UAT-2] Investigation: container_tool_exec.feature sync_results_to_host scenarios — all tests already passing, no fix needed #8045

Closed
opened 2026-04-13 01:15:17 +00:00 by HAL9000 · 1 comment
Owner

Investigation Report — [AUTO-UAT-2]

Scenarios under investigation: features/container_tool_exec.feature — 7 sync_results_to_host scenarios

  • Line 188: sync_results_to_host rejects path traversal attempts
  • Line 195: sync_results_to_host maps container path to host
  • Line 293: sync_results_to_host rejects null bytes in container_path
  • Line 298: sync_results_to_host rejects relative container_path
  • Line 303: sync_results_to_host raises on timeout during file sync
  • Line 308: sync_results_to_host raises on non-zero exit during file sync
  • Line 313: sync_results_to_host raises on OSError during file write

Findings

After a thorough investigation, all 7 scenarios are already passing in the current master branch. No code change was required.

Root Cause Analysis

The production code in src/cleveragents/tool/container_executor.py already contains the complete and correct implementation of sync_results_to_host() (lines 344–417):

Null byte rejection (line 293):

if "\x00" in container_path:
    raise ValueError("container_path must not contain null bytes")

Relative path rejection (line 298):

if not container_path.startswith("/"):
    raise ValueError(f"container_path must be absolute, got {container_path!r}")

Path traversal protection (line 188):

sandbox_root = Path(self._path_mapper.host_root).resolve()
resolved_host = Path(host_path).resolve()
if not resolved_host.is_relative_to(sandbox_root):
    raise ContainerExecutionError(
        f"Mapped host path {host_path!r} resolves outside "
        f"sandbox root {sandbox_root}",
        exit_code=-1,
    )

Timeout handling (line 303):

if result.timed_out:
    raise ContainerTimeoutError(
        timeout_seconds=self._config.timeout_seconds,
        stderr=result.stderr,
    )

Non-zero exit handling (line 308):

if result.exit_code != 0:
    raise ContainerExecutionError(
        f"Failed to sync {container_path} to host: {result.stderr}",
        exit_code=result.exit_code,
        stderr=result.stderr,
    )

OSError handling (line 313):

except OSError as exc:
    raise ContainerExecutionError(
        f"Failed to write synced file to host path {dest}: {exc}",
        exit_code=-1,
        stderr=str(exc),
    ) from exc

The step definitions in features/steps/container_tool_exec_steps.py are also complete and correct, with proper Given steps for each scenario that set up the appropriate mocks.

Test Execution Results

nox -e unit_tests -- features/container_tool_exec.feature

1 feature passed, 0 failed, 0 skipped
79 scenarios passed, 0 failed, 5 skipped
304 steps passed, 0 failed, 21 skipped

Overall summary:
1 features passed, 0 failed, 0 errored, 0 skipped
79 scenarios passed, 0 failed, 0 errored, 5 skipped
225 steps passed, 0 failed, 0 errored, 16 skipped

All 79 scenarios pass (5 are intentionally skipped with @skip tag). All 7 targeted scenarios pass.

History

The sync_results_to_host method with all its validation guards was already present in the codebase on master. The step definitions for all 7 scenarios were also already present and complete.

Existing Open PRs

No open PRs are needed to address these scenarios. The tests were never broken in the current codebase.


Conclusion

No fix was needed. All 7 sync_results_to_host scenarios in features/container_tool_exec.feature pass correctly on master. The task description may have been based on stale information or a misidentification of failing tests.

No PR was created since no code changes were required.


Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: [AUTO-UAT-2]

## Investigation Report — [AUTO-UAT-2] **Scenarios under investigation:** `features/container_tool_exec.feature` — 7 `sync_results_to_host` scenarios - Line 188: `sync_results_to_host rejects path traversal attempts` - Line 195: `sync_results_to_host maps container path to host` - Line 293: `sync_results_to_host rejects null bytes in container_path` - Line 298: `sync_results_to_host rejects relative container_path` - Line 303: `sync_results_to_host raises on timeout during file sync` - Line 308: `sync_results_to_host raises on non-zero exit during file sync` - Line 313: `sync_results_to_host raises on OSError during file write` --- ## Findings After a thorough investigation, **all 7 scenarios are already passing** in the current `master` branch. No code change was required. ### Root Cause Analysis The production code in `src/cleveragents/tool/container_executor.py` already contains the complete and correct implementation of `sync_results_to_host()` (lines 344–417): **Null byte rejection (line 293):** ```python if "\x00" in container_path: raise ValueError("container_path must not contain null bytes") ``` **Relative path rejection (line 298):** ```python if not container_path.startswith("/"): raise ValueError(f"container_path must be absolute, got {container_path!r}") ``` **Path traversal protection (line 188):** ```python sandbox_root = Path(self._path_mapper.host_root).resolve() resolved_host = Path(host_path).resolve() if not resolved_host.is_relative_to(sandbox_root): raise ContainerExecutionError( f"Mapped host path {host_path!r} resolves outside " f"sandbox root {sandbox_root}", exit_code=-1, ) ``` **Timeout handling (line 303):** ```python if result.timed_out: raise ContainerTimeoutError( timeout_seconds=self._config.timeout_seconds, stderr=result.stderr, ) ``` **Non-zero exit handling (line 308):** ```python if result.exit_code != 0: raise ContainerExecutionError( f"Failed to sync {container_path} to host: {result.stderr}", exit_code=result.exit_code, stderr=result.stderr, ) ``` **OSError handling (line 313):** ```python except OSError as exc: raise ContainerExecutionError( f"Failed to write synced file to host path {dest}: {exc}", exit_code=-1, stderr=str(exc), ) from exc ``` The step definitions in `features/steps/container_tool_exec_steps.py` are also complete and correct, with proper `Given` steps for each scenario that set up the appropriate mocks. ### Test Execution Results ``` nox -e unit_tests -- features/container_tool_exec.feature 1 feature passed, 0 failed, 0 skipped 79 scenarios passed, 0 failed, 5 skipped 304 steps passed, 0 failed, 21 skipped Overall summary: 1 features passed, 0 failed, 0 errored, 0 skipped 79 scenarios passed, 0 failed, 0 errored, 5 skipped 225 steps passed, 0 failed, 0 errored, 16 skipped ``` All 79 scenarios pass (5 are intentionally skipped with `@skip` tag). All 7 targeted scenarios pass. ### History The `sync_results_to_host` method with all its validation guards was already present in the codebase on `master`. The step definitions for all 7 scenarios were also already present and complete. ### Existing Open PRs No open PRs are needed to address these scenarios. The tests were never broken in the current codebase. --- ## Conclusion **No fix was needed.** All 7 `sync_results_to_host` scenarios in `features/container_tool_exec.feature` pass correctly on `master`. The task description may have been based on stale information or a misidentification of failing tests. **No PR was created** since no code changes were required. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: [AUTO-UAT-2]
Owner

superseded by next cycle

superseded by next cycle
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#8045
No description provided.