test(plugins): isolate GOOSE_PATH_ROOT in discovery tests - #11407
Conversation
plugins::discovery tests mutated the process-global GOOSE_PATH_ROOT with a bare set_var and no lock, so the fake home was visible to sibling tests in the same binary and flaked unrelated PRs out of the merge queue. Take the env_lock guard around discovery calls, matching the pattern in #11262. Fixes #11059
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d0606418c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| let _guard = env_lock::lock_env([("GOOSE_PATH_ROOT", None::<&str>)]); | ||
| discover_enabled_plugins_with_config(Some(project), config) |
There was a problem hiding this comment.
Coordinate with every GOOSE_PATH_ROOT mutator
This lock only serializes tests that also use env_lock; it does not coordinate with the existing unit tests that directly call set_var/remove_var for GOOSE_PATH_ROOT (for example, acp/server/apps.rs:255-263, hints/load_hints.rs:337-362, and goose_apps/cache.rs:188-195). Because those tests are compiled into the same lib-test binary and can run alongside these unannotated discovery tests, they can still replace the value after this guard clears it, while the fake-home test can still expose its value to them, so the merge-queue race this commit targets remains. Migrate those mutators to the same lock or serialize all participating tests with one mechanism.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
we might have the issue elsewhere, feel free to add to this PR or leave it, I don't think this needs to be blocked by the existence of other bare env access
…bined * origin/main: (85 commits) feat(desktop): sort configured providers to the top of the provider list (#11409) fix(cli): refuse symlink diagnostics outputs (#11398) test(plugins): isolate GOOSE_PATH_ROOT in discovery tests (#11407) fix(config): serialize secret mutations (#11388) fix: decouple source file and tool response limits (#11391) chore(deps): bump pctx_code_mode from 0.4.1 to 0.5.0 (#11245) fix(security): suppress sensitive OTLP traces (#11381) feat(openrouter): forward session_id and add app category header (#10868) feat(acp): derive and forward thinking effort from the ACP harness (#10949) fix(aws_bedrock): replace flat model list with routing table, add Gemma 4 Mantle support (#10297) Add GPT-5.6 follow-up support for Codex and Responses API (#10460) fix(update): fetch attestation bundles from bundle_url (#10557) fix(security): fail closed on invalid default GCP credentials (#11363) fix(codex): reject socket-backed MCP extensions (#11304) fix: pass complete response to stop hooks (#11366) fix: contain and bound skill supporting file reads (#11342) chore(deps): bump the ui-minor-and-patch group across 1 directory with 53 updates (#11386) fix(security): bound call graph traversal (#11193) fix: pin arrayref to known-good commit (#11389) feat(providers): add SayGM as declarative OpenAI-compatible provider (#11267) ... # Conflicts: # crates/goose/src/agents/agent.rs
* main: (70 commits) cli: remove recipe secret discovery (#11435) fix(openrouter): escape Gemini tool response ref keys (#11276) fix(security): honor MCP tool model visibility in Code Mode (#11425) fix(providers): estimate cost for Azure Foundry models via inferred catalog pricing (#11264) feat(providers): add Gondola as declarative OpenAI-compatible provider (#11421) feat(otel): add request params, response metadata, tool call parity, and agent identification (#11261) fix(providers): coalesce consecutive Thinking blocks in collect_stream (#11317) feat(hooks): add PreToolUseResult event and stable tool_call_id across tool lifecycle (#11120) add MCP conformance tests to goose CI (combines #10800 + #10801) (#10940) feat(desktop): sort configured providers to the top of the provider list (#11409) fix(cli): refuse symlink diagnostics outputs (#11398) test(plugins): isolate GOOSE_PATH_ROOT in discovery tests (#11407) fix(config): serialize secret mutations (#11388) fix: decouple source file and tool response limits (#11391) chore(deps): bump pctx_code_mode from 0.4.1 to 0.5.0 (#11245) fix(security): suppress sensitive OTLP traces (#11381) feat(openrouter): forward session_id and add app category header (#10868) feat(acp): derive and forward thinking effort from the ACP harness (#10949) fix(aws_bedrock): replace flat model list with routing table, add Gemma 4 Mantle support (#10297) Add GPT-5.6 follow-up support for Codex and Responses API (#10460) ...
* main: (107 commits) fix(providers): inform user of clipboard copy and remove copilot auth retry on timeout (aaif-goose#11160) feat(desktop): select saved recipes when creating a schedule (aaif-goose#10892) More provider test scripts (aaif-goose#10515) cli: remove recipe secret discovery (aaif-goose#11435) fix(openrouter): escape Gemini tool response ref keys (aaif-goose#11276) fix(security): honor MCP tool model visibility in Code Mode (aaif-goose#11425) fix(providers): estimate cost for Azure Foundry models via inferred catalog pricing (aaif-goose#11264) feat(providers): add Gondola as declarative OpenAI-compatible provider (aaif-goose#11421) feat(otel): add request params, response metadata, tool call parity, and agent identification (aaif-goose#11261) fix(providers): coalesce consecutive Thinking blocks in collect_stream (aaif-goose#11317) feat(hooks): add PreToolUseResult event and stable tool_call_id across tool lifecycle (aaif-goose#11120) add MCP conformance tests to goose CI (combines aaif-goose#10800 + aaif-goose#10801) (aaif-goose#10940) feat(desktop): sort configured providers to the top of the provider list (aaif-goose#11409) fix(cli): refuse symlink diagnostics outputs (aaif-goose#11398) test(plugins): isolate GOOSE_PATH_ROOT in discovery tests (aaif-goose#11407) fix(config): serialize secret mutations (aaif-goose#11388) fix: decouple source file and tool response limits (aaif-goose#11391) chore(deps): bump pctx_code_mode from 0.4.1 to 0.5.0 (aaif-goose#11245) fix(security): suppress sensitive OTLP traces (aaif-goose#11381) feat(openrouter): forward session_id and add app category header (aaif-goose#10868) ...
Summary
plugins::discovery tests mutated the process-global GOOSE_PATH_ROOT with a bare set_var and no lock, so the fake home was visible to sibling tests in the same binary and flaked unrelated PRs out of the merge queue.
Take the env_lock guard around discovery calls, matching the pattern in #11262.
Fixes #11059
Testing
Ran the tests
Related Issues
#11059
Screenshots/Demos (for UX changes)
N/A