Skip to content

perf(rees): add cost-aware analyzer scheduling and profiles #1811

Description

@JSONbored

Context

REES currently treats requested analyzers too uniformly. Cheap local analyzers, package registry analyzers, and GitHub-heavy analyzers need different concurrency, timeout, and degradation behavior.

This issue adds a scheduler that plans analyzer execution around remaining budget, cost class, external fanout, and operator-selected profiles.

Parent: #1499

Deliverables

  • Introduce analyzer cost classes such as local, registry, github-light, github-heavy, and tooling.
  • Add per-class concurrency caps and per-host external call limits.
  • Add request-level budget planning with a reserved response window so REES returns before the engine transport timeout.
  • Add skip predicates so analyzers can be skipped before execution when relevant inputs are absent.
  • Add profiles: fast, balanced, and deep.
  • Preserve explicit REES_ANALYZERS behavior while allowing profile defaults.
  • Emit safe per-analyzer status: ok, skipped, degraded, capped, timeout, elapsedMs, and safe reason codes.

Requirements

  • Fast profile should favor local and low-cost checks.
  • Balanced profile should remain the production default unless another issue explicitly changes that policy.
  • Deep profile may run heavier checks but must still honor bounded budgets and degradation.
  • No analyzer should consume the whole request budget without leaving time to serialize and return a partial response.
  • Do not leak raw request payloads, diffs, prompts, comments, or tokens in diagnostics.

Acceptance criteria

  • REES can return partial/degraded output before the caller timeout even when a heavy analyzer stalls.
  • Expensive analyzers are capped by cost class and remaining budget.
  • Skip predicates avoid calling registry/GitHub analyzers when no relevant files changed.
  • Engine-side caller treats degraded/partial analyzer results as usable enrichment.

Validation

  • Tests for scheduler ordering, skip predicates, profile selection, and reserved response budget.
  • Regression test where a slow analyzer degrades without causing the whole request to abort.
  • Focused engine enrichment-wire test for degraded REES responses.

Ownership

Maintainer-only. No gittensor:* labels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions