# NousResearch/hermes-agent · HERMES_CRON_SESSION leak fixes in test runner scripts

## Open now

- Nothing open on GitHub.

These issues and pull requests address a variable leak where HERMES_CRON_SESSION bleeds into pytest when tests run under cron. Several fixes also adjust pytest-split installation to work with uv-based environments.

## TL;DR

- 8 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 6 PR(s) closed without merging.
- A fix was merged to main in PR #22767. Verify it addresses your case.
- **Recommended:** read PR #22767 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-22767`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.25`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #22400: scripts/run_tests.sh leaks HERMES_CRON_SESSION into pytest under cron

## Prior & competing PRs

- **#22767: fix(tests): harden run_tests.sh (uv-aware bootstrap + scrub HERMES_CRON_SESSION)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `pyproject.toml`, `scripts/run_tests.sh`
  - fix hunks:
  - `pyproject.toml`

    ```diff
    @@ -54,7 +54,7 @@ dependencies = [
     modal = ["modal>=1.0.0,<2"]
     daytona = ["daytona>=0.148.0,<1"]
     vercel = ["vercel>=0.5.7,<0.6.0"]
    -dev = ["debugpy>=1.8.0,<2", "pytest>=9.0.2,<10", "pytest-asyncio>=1.3.0,<2", "pytest-xdist>=3.0,<4", "mcp>=1.2.0,<2", "ty>=0.0.1a29,<0.0.22", "ruff"]
    +dev = ["debugpy>=1.8.0,<2", "pytest>=9.0.2,<10", "pytest-asyncio>=1.3.0,<2", "pytest-xdist>=3.0,<4", "pytest-split>=0.9,<1", "mcp>=1.2.0,<2", "ty>=0.0.1a29,<0.0.22", "ruff"]
     messaging = ["python-telegram-bot[webhooks]>=22.6,<23", "discord.py[voice]>=2.7.1,<3", "aiohttp>=3.13.3,<4", "slack-bolt>=1.18.0,<2", "slack-sdk>=3.27.0,<4", "qrcode>=7.0,<8"]
     cron = []  # croniter is now a core dependency; this extra kept for back-compat
     slack = ["slack-bolt>=1.18.0,<2", "slack-sdk>=3.27.0,<4"]
    ```
  - `scripts/run_tests.sh`

    ```diff
    @@ -44,7 +44,15 @@ PYTHON="$VENV/bin/python"
     # ── Ensure pytest-split is installed (required for shard-equivalent runs) ──
     if ! "$PYTHON" -c "import pytest_split" 2>/dev/null; then
       echo "→ installing pytest-split into $VENV"
    -  "$PYTHON" -m pip install --quiet "pytest-split>=0.9,<1"
    +  if command -v uv >/dev/null 2>&1; then
    +    uv pip install --python "$PYTHON" --quiet "pytest-split>=0.9,<1"
    +  elif "$PYTHON" -m pip --version >/dev/null 2>&1; then
    +    "$PYTHON" -m pip install --quiet "pytest-split>=0.9,<1"
    +  else
    +    echo "error: neither uv nor pip is available in $VENV — pytest-split is missing" >&2
    +    echo "  fix: run  uv pip install -e \".[dev]\"  from $REPO_ROOT" >&2
    +    exit 1
    +  fi
     fi
     
     # ── Hermetic environment ────────────────────────────────────────────────────
    ```

    ```diff
    @@ -67,6 +75,7 @@ unset HERMES_YOLO_MODE HERMES_INTERACTIVE HERMES_QUIET HERMES_TOOL_PROGRESS \
           HERMES_TOOL_PROGRESS_MODE HERMES_MAX_ITERATIONS HERMES_SESSION_PLATFORM \
           HERMES_SESSION_CHAT_ID HERMES_SESSION_CHAT_NAME HERMES_SESSION_THREAD_ID \
           HERMES_SESSION_SOURCE HERMES_SESSION_KEY HERMES_GATEWAY_SESSION \
    +      HERMES_CRON_SESSION \
           HERMES_PLATFORM HERMES_INFERENCE_PROVIDER HERMES_MANAGED HERMES_DEV \
           HERMES_CONTAINER HERMES_EPHEMERAL_SYSTEM_PROMPT HERMES_TIMEZONE \
           HERMES_REDACT_SECRETS HERMES_BACKGROUND_NOTIFICATIONS HERMES_EXEC_ASK \
    ```
- **#22421: fix(scripts): unset HERMES_CRON_SESSION and use uv for pytest-split install**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `f00dc6d7a3a1d1a1cc5e98507d2efb201990f517`, `#22767`, `#22400`, `#22401`
- **#22441: fix(tests): scrub HERMES_CRON_SESSION in canonical test runner**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#22767`
- **#22503: fix(scripts): support uv venv for pytest-split + unset HERMES_CRON_SESSION**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `#22767`
- **#22519: fix(test-runner): scrub HERMES_CRON_SESSION in run_tests.sh (#22400)**. closed without merge
  - maintainer direction: category `duplicate_of`; implication `duplicate`; refs `#22441`, `#22400`, `#22441`
- **#22725: fix(scripts): scrub HERMES_CRON_SESSION in run_tests.sh**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#22767`, `#22401`
- **#22730: fix(scripts): declare pytest-split in dev deps and unset HERMES_CRON_SESSION**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#22767`, `#22767`, `#22401`

## Fix status

- Merged to main in PR #22767 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-05-09`.
- Subsystem: `cron`
