Skip to content

test: agent-spawn env test is non-hermetic — fails under OPENCODE_CONFIG_CONTENT (server sessions) #645

Description

@aarontrowbridge

Important

Problem — One agent-spawn test is non-hermetic: it fails in any harness whose environment exports OPENCODE_CONFIG_CONTENT — true for every session inside the amicode server — because the OPENCODE_-prefix env allowlist forwards the inherited variable to the spawned child, changing the behavior the test expects. It passes in clean CI and with the variable scrubbed, which means the suite goes red exactly where developers actually work (server sessions), training everyone to ignore red.
Approach — Make the test hermetic: scrub the variable within the test's own environment (targeted beforeAll/env fixture) so its outcome never depends on the caller's environment. The allowlist forwarding is correct product behavior — only the test's assumption changes.

Acceptance Criteria

  • The test passes identically with and without OPENCODE_CONFIG_CONTENT exported
  • No change to the allowlist's forwarding behavior (that is product surface, not test surface)

Prior Art

The agent-spawn module's OPENCODE_-prefix allowlist (the forwarding is deliberate); the test file that asserts the child environment.

Notes

Found during #642's director gate runs; proven pre-existing — fails identically on pristine origin/main, passes 40/40 with the variable scrubbed. Not a regression of PR #644. Part of the skill-health campaign (session-20260830-skill-health).

Metadata

Metadata

Assignees

No one assigned

    Labels

    afkImplementable without human interaction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions