Skip to content

Serialize WTA hooks bundle environment mutation in tests #495

Description

@vanzue

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: #491 (comment)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-SessionManagementSessions, windows, panes lifecycle and persistence; includes hooks install/lifecycleIssue-BugSomething is broken or behaves incorrectlyNeeds-TriageAwaiting first review by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions