Skip to content

test_agent_engine_environment.py: 13 tests fail on macOS (GNU-only stat -c / base64 -d <file> in the local bash) #7778

Closed

Description

@iamthehimansh

🔴 Required Information

Describe the Bug:
13 tests in tests/unittests/integrations/vmaas/test_agent_engine_environment.py fail on macOS. The test's fake sandbox runs the commands that AgentEngineEnvironment sends to the (Linux) sandbox in a local bash. Since the chunked large-file read/write changes on 2026-10-27 (4c88040, 5843c58), those commands use GNU coreutils options that the BSD tools on macOS don't accept. CI runs only on ubuntu-latest, so this isn't caught there.

The production code is probably fine, because the real sandbox is Linux. This is a test-portability problem, but it means pytest tests/unittests is red for anyone developing ADK on a Mac.

Steps to Reproduce:

  1. On macOS, pip install -e '.[test]' on main (571670d).
  2. pytest tests/unittests/integrations/vmaas/test_agent_engine_environment.py

Expected Behavior:
The tests pass, or skip, on macOS.

Observed Behavior:
13 failed, for example:

FAILED tests/unittests/integrations/vmaas/test_agent_engine_environment.py::test_written_file_is_read_back
E       OSError: Failed to read .../test_written_file_is_read_back0/new dir/data.bin: stat: illegal option -- c
E       usage: stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]

Across the 13 failures the errors are stat: illegal option -- c (6) and base64: invalid argument <file> (7). The other GNU-only options in the same command strings are dd iflag=fullblock, mv -T and chmod --reference. Failing tests: test_written_file_is_read_back, test_empty_file_is_read, test_file_of_one_slice_is_read_in_one_command, test_large_binary_file_is_read_in_slices, test_symlink_to_large_file_is_read_in_slices, test_large_file_truncated_during_read_raises, test_write_is_split_at_chunk_boundaries[one_chunk_plus_one / exactly_two_chunks / two_chunks_plus_one], test_large_binary_file_round_trips, test_chunked_write_replaces_existing_file, test_chunked_write_keeps_existing_file_mode, test_chunked_write_with_long_multibyte_filename.

Environment Details:

  • ADK Library Version: 2.13.0 (editable install of main @ 571670d)
  • Desktop OS: macOS 26.6.2 (arm64), /bin/bash 3.2.57
  • Python Version: 3.13.15

Model Information:

  • Are you using LiteLLM: N/A (unit tests only)
  • Which model is being used: N/A

🟡 Optional Information

Regression:
Yes. Before 5843c58 the only such command was printf %s ... | base64 -d > file, which works with macOS base64 because it reads stdin. The failing forms arrived with the large-file read/write support on 2026-10-27. On macOS, base64 -d <file> exits 64 with invalid argument, and stat -c %s <file> exits 1 with illegal option -- c.

Possible fixes (happy to send a PR for whichever you prefer):

  1. Skip these tests when the local tools aren't GNU coreutils, e.g. a module-level pytest.mark.skipif that runs stat -c %s once and checks it succeeds. Smallest change.
  2. Have the fake sandbox resolve GNU tools when they're installed (gstat, gbase64, gdd, gmv, gchmod from Homebrew coreutils) by prepending a shim directory to PATH, and skip only when they're missing. This keeps the tests running on Macs that have coreutils.

AI-assisted: yes (Cana)

Activity

  1. added
    agent engine[Component] This issue is related to Vertex AI Agent Engine
    on Oct 28, 2026
  2. Samecho commented on Oct 28, 2026

    @Samecho
    Contributor

    I'd like to keep this to test-side portability: use GNU tools when they're available and skip only the tests that require them when they aren't. The lifecycle tests and Linux coverage would stay active, and the production sandbox commands would be unchanged. Is anyone already working on this?

  3. iamthehimansh commented on Oct 28, 2026

    @iamthehimansh
    ContributorAuthor

    @Samecho thanks, that's option 2 from the issue, and I'm already on it. I'll have a PR up shortly.

    The plan is test-only, in one place: _FakeSandboxes.execute_bash in test_agent_engine_environment.py, since every sandbox command goes through it. If GNU coreutils are installed (Homebrew's gstat/gbase64/gdd/gmv/gchmod), it runs bash with a shim directory first on PATH so the commands resolve to the GNU tools. If they aren't, only the tests that need them are skipped. Linux CI and the production sandbox commands are unchanged.

    AI-assisted: yes (Cana)

  4. sanketpatil06 commented on Oct 28, 2026

    @sanketpatil06

    Thanks @iamthehimansh for the report and the fix!

    We reproduced this on macOS: the same 13 tests fail on main. With #7790 applied, those tests are skipped when GNU coreutils aren't installed. The PR is under review, and our team will follow up there.

  5. added a commit that references this issue on Nov 3, 2026
    051c62d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent engine[Component] This issue is related to Vertex AI Agent Engine

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions