Skip to content

selfhost-env-reference generator misses AI review-pipeline env vars #6993

Description

@JSONbored

Context

scripts/gen-selfhost-env-reference.mjs's DEFAULT_SOURCE_ROOTS (lines 8-15) scans src/selfhost, src/server.ts, src/services/notify-discord.ts, src/services/notify-pagerduty.ts, and three scripts — it never scans src/services/ai-review.ts, src/queue/ai-review-orchestration.ts, or src/queue/processors.ts. Four self-host-relevant env vars are read in those unscanned files but missing (or only partially present) from the generated reference:

  • AI_SUMMARIES_ENABLED — read at src/services/ai-review.ts:2042, src/queue/ai-review-orchestration.ts:243; present in .env.example:629 but missing from the generated apps/loopover-ui/src/lib/selfhost-env-reference.ts.
  • AI_PUBLIC_COMMENTS_ENABLEDai-review.ts:2044, ai-review-orchestration.ts:244.
  • AI_MAX_OUTPUT_TOKENSai-review.ts:2057.
  • AI_BYOK_DAILY_REPO_LIMITai-review.ts:2168, processors.ts:7335.

All four are already declared in src/env.d.ts's self-host doc-comment block (~lines 84-96), so the generator's own source-of-truth already knows about them in principle — it just never scans the files that actually read them at runtime.

Requirements

  • Add src/services/ai-review.ts, src/queue/ai-review-orchestration.ts, and src/queue/processors.ts to DEFAULT_SOURCE_ROOTS in scripts/gen-selfhost-env-reference.mjs.
  • Regenerate apps/loopover-ui/src/lib/selfhost-env-reference.ts (npm run selfhost:env-reference) and commit the result in the same PR — a stale generated file fails CI.
  • Do not manually hand-edit the generated file — it must come from running the generator.

Deliverables

  • DEFAULT_SOURCE_ROOTS includes the three additional files
  • Regenerated selfhost-env-reference.ts includes AI_SUMMARIES_ENABLED, AI_PUBLIC_COMMENTS_ENABLED, AI_MAX_OUTPUT_TOKENS, AI_BYOK_DAILY_REPO_LIMIT
  • Test asserting the generator's scan picks up at least one of these four vars from the newly-added source roots

Test Coverage Requirements

99%+ Codecov patch coverage on every changed line and branch, plus the regression test above. This is a scripts/** change — confirm it's within the Codecov coverage.include scope for this repo (most scripts/** generator code is covered; verify rather than assume).

Expected Outcome

All four AI review-pipeline env vars are documented in the generated self-host env reference, matching what the code actually reads — a self-hoster configuring these knobs no longer has to read source to find them.

Links & Resources

scripts/gen-selfhost-env-reference.mjs:8-15 (DEFAULT_SOURCE_ROOTS). src/env.d.ts:84-96 — the existing doc-comment declarations these vars already have. src/services/ai-review.ts:2042,2044,2057,2168, src/queue/ai-review-orchestration.ts:243-244, src/queue/processors.ts:7335 — the actual read sites.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions