Skip to content

fix(selfhost): wire GITHUB_CACHE_TTL_SECONDS or remove the dead config #2505

Description

@JSONbored

Parent: #1936

Problem

GITHUB_CACHE_TTL_SECONDS (threaded into createRedisResponseCache as the fallback ttlSeconds in src/selfhost/redis-response-cache.ts) is dead in production: every real call site into GitHubResponseCache.set() always passes an explicit ttlOverrideSeconds, so ttlOverrideSeconds ?? ttlSeconds never falls through to the configured value.

src/github/client.ts and src/github/graphql-cache.ts both always supply a 3rd argument, resolved from separate per-class env vars (GITHUB_BRANCH_PROTECTION_CACHE_TTL_SECONDS, GITHUB_COMMIT_CACHE_TTL_SECONDS, GITHUB_METADATA_CACHE_TTL_SECONDS, GITHUB_GRAPHQL_CACHE_TTL_SECONDS) that ignore GITHUB_CACHE_TTL_SECONDS entirely. A self-host operator who sets GITHUB_CACHE_TTL_SECONDS=5 (wanting fresher data) or =120 (wanting more aggressive caching), per .env.example's own documentation ("Short default Redis TTL for safe GitHub GET response caching. Set 0 to disable.") and docker-compose.yml's default wiring, gets no change in actual TTL behavior — only the >0/=0 enable/disable gate has any effect. A stale comment in src/server.ts ("Short-TTL cache ... Default 20s") reinforces the false impression that 20s governs freshness, when real entries live 10-20 minutes.

Fix

Either:

  1. Remove the unused ttlSeconds parameter/env var and update .env.example + docker-compose.yml + the server.ts comment to stop advertising a knob that does nothing, OR
  2. Wire GITHUB_CACHE_TTL_SECONDS in as the actual default that githubResponseCacheTtlSeconds()/githubGraphQlCacheTtlSeconds() fall back to when their own per-class env vars are unset, so the documented operator-facing setting is load-bearing again.

Option 2 preserves the documented operator-facing contract; option 1 is simpler. Pick one deliberately rather than leaving the current half-documented, non-functional state.

Verification

  • Confirm current dead-config behavior against src/selfhost/redis-response-cache.ts, src/github/client.ts, src/github/graphql-cache.ts (line numbers may have shifted).
  • Whichever option is chosen, add/update a test proving GITHUB_CACHE_TTL_SECONDS either has no effect (documented) or does have effect (wired).

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

Status
Done

Relationships

None yet

Development

No branches or pull requests

Issue actions