Skip to content

launch-session.bats: 6 tests fail when run inside an orchestrate worker session (ambient LO_* env not isolated) #100

Description

@choiyounggi

What happened

During the #87#90 orchestration run, a worker session running the full suite inside its worktree got 6 deterministic failures in tests/launch-session.bats (LO_DRY_RUN session-name test, unsubmitted-prompt-Enter-remedy test, 4x pre-seed tests) that do not reproduce on the same commit in a normal shell.

Root cause (verified 2026-08-14)

launch-session.sh exports LO_RUN_ID, LO_STATUS_DIR, LO_TASK_ID (and the guardrails escalation env) into every worker session it spawns. When that worker itself runs bats tests/launch-session.bats, those ambient values leak into the script under test and change its behavior (session naming via LO_RUN_ID, status pre-seeding via LO_STATUS_DIR/LO_TASK_ID), breaking tests written against the unset-env baseline.

Reproduction on a clean checkout (0 failures normally):

env LO_RUN_ID=i8790 LO_STATUS_DIR=$PWD/.orchestration/status LO_TASK_ID=t90 \
    GROUNDWORK_ESCALATION_DIR=$PWD/.orchestration/escalations \
    bats tests/launch-session.bats 2>&1 | grep -cE '^not ok'
# -> 6

Why it matters

Every orchestrate worker whose DoD includes "full suite passes" hits this: the suite is red for reasons outside the worker's diff, which trains workers (and coordinators) to hand-wave failures — the same signal-erosion problem as issue #99.

Suggested fix

In tests/launch-session.bats setup() (or per-test run env -u ...), unset the orchestration env the script reads: LO_RUN_ID, LO_STATUS_DIR, LO_TASK_ID, LO_READY_EXTRA, LO_TRUST_EXTRA, LO_READY_TIMEOUT, GROUNDWORK_ESCALATION_DIR, GROUNDWORK_TASK_ID — tests that need them set already set them explicitly, so the change only removes ambient leakage (wiki: tests must control their own inputs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions