Skip to content

fix(ci): tests render CLI help at the same width locally and in github ci, so the gate catches width-dependent failures #1041

Closed

Description

@dan-petty

Problem

The local gate passed PR #1039 (#950), and GitHub CI then failed it on tests/test_data_dir_worktrees.py::test_dataset_help_says_a_relative_dataset_is_under_the_main_worktree. The test reads a phrase from devops ai prompt-eval --help; in CI the help wrapped at 80 columns and a table border split the phrase.

The cause is the test environment, not the CLI:

  • tests/conftest.py sets COLUMNS=250, NO_COLOR=1 and TERM=dumb for every test (_TERMINAL_ENV).
  • Typer sets FORCE_TERMINAL = True at import when GITHUB_ACTIONS is set (typer/rich_utils.py).
  • A Rich console that is forced to be a terminal and has TERM=dumb reports a size of 80x25, whatever COLUMNS says. Without GITHUB_ACTIONS the console is not a terminal, and Rich uses COLUMNS.

So the same test renders at 250 columns in the devcontainer and in the pre-push gate, and at 80 in GitHub CI. Reproduced at a99dd4e: the test passes with no extra environment and fails with CI=true GITHUB_ACTIONS=true uv run pytest tests/test_data_dir_worktrees.py -k dataset_help. #1039 fixed that one test by reading the phrase with table borders removed; the mismatch remains for every other help or table assertion.

Acceptance criteria

  • Tests see one terminal width in every environment: tests/conftest.py stops Typer's GitHub Actions detection from forcing a terminal for test consoles (for example by setting typer.rich_utils.FORCE_TERMINAL = None before any app is built, or by not using TERM=dumb with a forced terminal), so Rich always reads COLUMNS.
  • A test asserts that, with GITHUB_ACTIONS=true in the environment, a CliRunner render of a help panel uses the conftest width (no line of the help is wrapped at 80 columns).
  • The full suite passes with CI=true GITHUB_ACTIONS=true set locally, and without them.
  • changelog.d/1041.md records the fix under ### Fixed. CHANGELOG.md is not edited.
  • uv run devops ci passes.

Key questions

  • Make the local gate run with GITHUB_ACTIONS=true instead? (proposed) No. Tests should not depend on CI detection at all; removing the forced terminal makes both environments the same.

Depends on: none.
Order: any time.
Related: #1039 (where it surfaced), #843 (GitHub CI runs the gate through devops ci).

Activity

  1. added
    type/bug
    priority/p2-medium
    scope/ci
    on Oct 3, 2026
  2. added this to the v0.2.31 milestone on Oct 8, 2026
  3. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Placed in v0.2.31 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: finding identity v2, URL credential masking, tests that leave no state, the Docker endpoint check and the Argo CD/OTel perimeters. Position 4 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.

  4. dan-petty-bot commented on Oct 9, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1475, merged into release/v0.2.31 as acfbdee.

    Closes #1041

    4 file(s) changed.

    How it was verified

    Check runs at 9ddd69c:

    • Prune PR DevContainer Images: pass
    • CodeQL: pass
    • Static Analysis: pass
    • Analyze (python): pass
    • Tests & Coverage: pass
    • Analyze (actions): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1041-ci-test-terminal-width.md:

    • Tests see one terminal width in every environment: tests/conftest.py stops Typer's GitHub Actions detection from forcing a terminal for test consoles by clearing typer.rich_utils.FORCE_TERMINAL = None, so Rich always reads COLUMNS.
    • A test asserts that, with GITHUB_ACTIONS=true in the environment, a CliRunner render of a help panel uses the conftest width (no line of the help is wrapped at 80 columns): test_cli_help_panel_renders_at_conftest_width_under_github_actions in tests/test_output.py.
    • The full suite passes with CI=true GITHUB_ACTIONS=true set locally, and without them.
    • changelog.d/1041.md records the fix under ### Fixed. CHANGELOG.md is not edited.
    • uv run devops ci passes.
  5. added a commit that references this issue on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2-mediumscope/citype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions