Skip to content

drift_check sticky issue ignores --gh-token, can match the wrong issue, and passes body via argv #107

Closed

Description

@TMHSDigital

Why it matters

The scheduled drift-check keeps a sticky issue that summarizes ecosystem drift. Three problems make that path unreliable.

Evidence

  • The supplied token is ignored. scripts/drift_check/cli.py:420-433 requires --gh-token (or DRIFT_CHECK_TOKEN) in sticky mode, but calls issue.upsert_sticky_issue(...) without passing it. report/issue.py:46-53 (_default_gh_runner) runs gh with the ambient environment, so the write uses GH_TOKEN, GITHUB_TOKEN or the local login instead of the supplied token.
  • The lookup can match the wrong issue. report/issue.py:103-114 finds the existing issue with a GitHub full-text search for an HTML-comment marker, then takes items[0] without checking that its body actually contains the marker.
  • The body is passed via argv. --body (issue.py:174,186) can exceed the Windows 32K command-line limit or GitHub's 65,536-character body limit on a large report.

Suggested approach

  • Pass the token to the runner: env={**os.environ, "GH_TOKEN": token}.
  • Request body in --json and filter on the exact marker. Prefer a dedicated label as the primary key.
  • Use --body-file - and truncate oversized bodies, with a pointer to the workflow artifact.
  • Extend tests/test_issue_upsert.py, which already has a fake runner, to cover each case.

Done when

  • --gh-token is honored.
  • The lookup is exact.
  • Oversized reports degrade gracefully.

Activity

  1. added
    bug
    priority: medium
    on Oct 8, 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

    bugpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions