Skip to content

fix(scm,tests): eliminate remaining GraphQL-backed scm.py / live SCM smoke bucket drain after #961 #976

@MScottAdams

Description

@MScottAdams

Summary

#884 (ghx adoption) and #961 (REST fallback helpers + release_publish.py REST refactor) reduced the GraphQL burn rate, but they did not eliminate it. The remaining in-repo hotspot is the SCM stub / live SCM smoke path:

  • scripts/scm.py still shells out to gh issue list / gh issue view
  • tasks/scm.yml still documents the stub as a thin wrapper over ghx|gh issue list/view/close/edit
  • tests/integration/test_scm_smoke.py still exercises that live path against deftai/directive

When the shared GitHub GraphQL bucket is depleted, that smoke test fails and agent task check runs hit the same rate-limit wall even after #961 lands.

This issue is the narrow "remaining bucket drain" follow-up to #884 / #961, and the concrete near-term slice of the broader scm:* abstraction tracked in #881.

Problem

Directive still has at least one live path that depends on GraphQL-backed gh surfaces:

  • scripts/scm.py Story 1 stub (issue list, issue view, issue close, issue edit) is a direct subprocess wrapper around ghx|gh issue ...
  • the smoke test tests/integration/test_scm_smoke.py::test_scm_issue_view_returns_nonempty_json shells out through that wrapper to prove the round-trip

Today, after #961 landed, the shared GraphQL bucket still re-exhausted. The clearest repo-local symptom was:

So:

Important distinction

Not every GraphQL consumer is removable:

  • markPullRequestReadyForReview (gh pr ready) is GraphQL-only on GitHub's side
  • review approval mutations are also GraphQL-only

Those are unavoidable and should be minimized / budgeted.

The SCM stub path is different: it is an avoidable GraphQL drain and should move to explicit REST or be skipped when the bucket is empty.

Evidence from this session

  1. gh api rate_limit repeatedly showed graphql=0/5000 while core remained healthy.
  2. task release:publish -- 0.26.1 failed before feat(scripts): gh_rest.py — REST fallback helpers for gh mutations and reads when GraphQL is exhausted #961 because release_publish.py called gh release view / gh release edit (GraphQL). feat(scripts): gh_rest.py — REST fallback helpers for gh mutations and reads when GraphQL is exhausted #961 fixed that.
  3. After feat(scripts): gh_rest.py — REST fallback helpers for gh mutations and reads when GraphQL is exhausted #961 landed, task check for the P1-polish branch still failed only at tests/integration/test_scm_smoke.py, proving another GraphQL-backed path remains.
  4. Profiling / live inspection showed scripts/scm.py still wraps raw gh issue list/view rather than a REST helper.
  5. While filing docs: surface refinement/triage workflow to end users (Phase 0 / cache / ingest) #979 today (a routine gh issue create) the call failed with GraphQL: API rate limit already exceeded; the REST fall-through (gh api -X POST repos/.../issues --input <json>) succeeded immediately. Concrete confirmation that even simple maintainer workflows are now GraphQL-coupled in ways the user does not see until the bucket is empty.

Proposed scope

  1. Remove GraphQL-backed gh issue list / gh issue view dependence from the SCM stub where possible.
    • Preferred: explicit gh api REST endpoints
    • Acceptable: route through scripts/gh_rest.py where the helper surface already exists, and extend that module only if the extension fits the issue/PR charter cleanly
  2. Make tests/integration/test_scm_smoke.py bucket-aware.
    • If the smoke still requires GraphQL after the SCM refactor, skip cleanly when graphql.remaining == 0
    • Preferably, make the smoke exercise a REST-backed path instead so GraphQL depletion no longer fails unrelated PRs
  3. Document the remaining GraphQL-only surfaces explicitly so future agents know which operations are budgeted and which are accidental drain

Complementary mitigation

Per-identity credential separation for swarm workers has been carved out into
its own issue: #983. That track is complementary to and does not block the
SCM/REST migration in this issue.

Non-goals

Why this should exist separately from #881

#881 is the broad strategic abstraction issue.
This issue is the tactical reliability slice:

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    adoption blockerBlocks consumer adoption / first-session UX

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions