core-agent-ide/codex-rs/exec/tests/suite
Michael Bolin f6b563ec64
feat: introduce find_resource! macro that works with Cargo or Bazel (#8879)
To support Bazelification in https://github.com/openai/codex/pull/8875,
this PR introduces a new `find_resource!` macro that we use in place of
our existing logic in tests that looks for resources relative to the
compile-time `CARGO_MANIFEST_DIR` env var.

To make this work, we plan to add the following to all `rust_library()`
and `rust_test()` Bazel rules in the project:

```
rustc_env = {
    "BAZEL_PACKAGE": native.package_name(),
},
```

Our new `find_resource!` macro reads this value via
`option_env!("BAZEL_PACKAGE")` so that the Bazel package _of the code
using `find_resource!`_ is injected into the code expanded from the
macro. (If `find_resource()` were a function, then
`option_env!("BAZEL_PACKAGE")` would always be
`codex-rs/utils/cargo-bin`, which is not what we want.)

Note we only consider the `BAZEL_PACKAGE` value when the `RUNFILES_DIR`
environment variable is set at runtime, indicating that the test is
being run by Bazel. In this case, we have to concatenate the runtime
`RUNFILES_DIR` with the compile-time `BAZEL_PACKAGE` value to build the
path to the resource.

In testing this change, I discovered one funky edge case in
`codex-rs/exec-server/tests/common/lib.rs` where we have to _normalize_
(but not canonicalize!) the result from `find_resource!` because the
path contains a `common/..` component that does not exist on disk when
the test is run under Bazel, so it must be semantically normalized using
the [`path-absolutize`](https://crates.io/crates/path-absolutize) crate
before it is passed to `dotslash fetch`.

Because this new behavior may be non-obvious, this PR also updates
`AGENTS.md` to make humans/Codex aware that this API is preferred.
2026-01-07 18:06:08 -08:00
..
add_dir.rs feat: Add support for --add-dir to exec and TypeScript SDK (#6565) 2025-11-13 13:47:10 -08:00
apply_patch.rs feat: introduce codex-utils-cargo-bin as an alternative to assert_cmd::Command (#8496) 2025-12-23 19:29:32 -08:00
auth_env.rs feat: introduce find_resource! macro that works with Cargo or Bazel (#8879) 2026-01-07 18:06:08 -08:00
mod.rs feat: Add support for --add-dir to exec and TypeScript SDK (#6565) 2025-11-13 13:47:10 -08:00
originator.rs feat: change ConfigLayerName into a disjoint union rather than a simple enum (#8095) 2025-12-17 08:13:59 -08:00
output_schema.rs Update defaults to gpt-5.1 (#6652) 2025-11-17 17:40:11 -08:00
resume.rs feat: introduce find_resource! macro that works with Cargo or Bazel (#8879) 2026-01-07 18:06:08 -08:00
sandbox.rs feat: introduce codex-utils-cargo-bin as an alternative to assert_cmd::Command (#8496) 2025-12-23 19:29:32 -08:00
server_error_exit.rs tests: replace mount_sse_once_match with mount_sse_once for SSE mocking (#6640) 2025-11-13 18:04:05 -08:00