microsoft / microsoft/intelligent-terminal

Serialize WTA hooks bundle environment mutation in tests

Open Beginner friendly
#495 0 comments 0 reactions 0 assignees View on GitHub
Area-SessionManagement Issue-Bug
Dominant language
C++
Stars
2k
Forks
159
Avg merge
21h 42m
Merged PRs (30d)
120

Description

## Problem

`bundle_resolve_source_returns_none_when_nothing_resolves` mutates the process-wide `WTA_HOOKS_BUNDLE_DIR` environment variable without acquiring `crate::test_support::lock_env()`.

The test comment says CI uses `--test-threads=1`, but the WTA pipeline runs plain `cargo test`, whose unit tests are parallel by default. This can race with other environment-mutating tests; `lock_env()` is already the crate convention for guarding these mutations.

## Expected behavior

Acquire the shared environment lock before reading, changing, and restoring `WTA_HOOKS_BUNDLE_DIR`, and update the safety comment accordingly.

## Context

Found during review of #491: https://github.com/microsoft/intelligent-terminal/pull/491#discussion_r3645018980

The test existed in the original `agent_hooks_installer.rs` before #491 and was moved unchanged into `agent_hooks_installer_tests.rs`; track the test-safety fix separately so #491 remains a file-splitting-only PR.

Contributor guide

Open the contributing guide

Research direction

Start in agent_hooks_installer_tests.rs at bundle_resolve_source_returns_none_when_nothing_resolves, then review crate::test_support::lock_env() and the existing safety comment. Run the relevant tests with the repository's plain cargo test setup. Done means the test locks the shared environment before reading, changing, and restoring WTA_HOOKS_BUNDLE_DIR, with the comment updated to reflect parallel tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.