Skip to content

Consolidate and rename hardcoded User-Agent header literals #5335

Description

@JSONbored

Problem: Roughly 33 hardcoded User-Agent HTTP header string literals are sent to GitHub's API and other external APIs across the codebase. Each file independently hardcodes its own copy of the literal instead of importing one shared constant, so a rename today requires touching 20+ files individually with no single source of truth -- and it's easy to miss a few in the process.

Area: Code / Maintainability

Proposal:

Open question (needs a maintainer decision before starting): Two of the literals (src/orb/app-auth.ts line 14 and src/orb/relay.ts line 468, both currently gittensory-orb/0.1) fuse the product brand with the orb internal engine codename. Should the renamed value become something like loopover/0.1 (drop the orb suffix entirely), loopover-orb/0.1 (keep the codename, just rebrand the prefix), or is the internal ORB codename itself also being renamed as part of this rebrand, in which case the suffix should follow whatever that new codename is? This can't be decided from the User-Agent refactor alone -- it needs an answer on whether ORB the codename is in scope for renaming anywhere else first.

Once that's settled, introduce one shared, exported User-Agent constant (plus a small number of sibling/suffixed constants for the genuinely distinct product-area literals) that every call site imports instead of defining its own string. The bulk of the literals are gittensory/0.1 at the GitHub client call sites; the rest are distinct product-area literals (gittensory-api, gittensory-selfhost, gittensory-selfhost/1.0, gittensory-miner, gittensory-content-lane, gittensory-mcp-release-watch, gittensory-production-smoke) that should become sibling constants derived from the same shared base rather than separately hardcoded ad hoc strings. This fixes the maintainability gap and completes the rename in the same pass.

Deliverables:

  • One shared, exported User-Agent constant (plus any necessary sibling/suffixed constants for the distinct product-area literals) that every call site imports.
  • All ~33 call sites across the files listed in Resources updated to import the shared constant instead of hardcoding their own literal.
  • A resolution for the two ORB-fused literals consistent with the maintainer's answer to the open question above.

Acceptance criteria:

  • Every hardcoded User-Agent literal listed in Resources is replaced with an import of the shared constant or the appropriate sibling constant.
  • No second, independently hardcoded copy of the new brand's User-Agent string exists anywhere in src/** or packages/gittensory-miner/** after this change.
  • src/orb/app-auth.ts and src/orb/relay.ts are resolved consistently with the maintainer's decision on the open question, not guessed.
  • No reference to the gittensor SN74 network's own name is altered.

Test scenarios:

  • Exercise a GitHub API-calling code path (e.g. the GitHub client) and confirm the outbound request carries the new shared constant's value, not the old literal.
  • Exercise a self-host code path and a gittensory-miner package code path and confirm each still sends its own distinct, correctly-branded literal rather than being accidentally collapsed onto the GitHub client's constant.
  • Grep the repository after the change for the old literal strings to confirm none remain outside of comments, changelog, or historical references.

Resources:

  • src/github/client.ts line 51
  • src/github/public.ts lines 69, 195
  • src/github/graphql-cache.ts line 88
  • src/github/backfill.ts line 4393
  • src/github/migration-tree.ts line 11
  • src/orb/oauth.ts lines 39, 63
  • src/auth/github-oauth.ts lines 46, 72, 133, 186, 216
  • src/registry/sync.ts line 38
  • src/gittensor/api.ts line 285
  • src/services/draft.ts line 355
  • src/signals/focus-manifest-loader.ts line 80
  • src/selfhost/setup-wizard.ts line 136
  • src/review/enrichment-wire.ts lines 69, 437
  • src/review/rag-index.ts line 96
  • src/review/visual/actions-fallback.ts lines 100, 361
  • src/review/visual/preview-url.ts line 49
  • src/review/grounding-wire.ts line 188
  • src/review/content-lane/netuid-verification.ts line 89
  • packages/gittensory-miner/lib/opportunity-fanout.js
  • packages/gittensory-miner/lib/ams-policy.js
  • packages/gittensory-miner/lib/self-review-context.js
  • packages/gittensory-miner/lib/live-issue-snapshot.js
  • packages/gittensory-miner/lib/rejection-signal.js
  • packages/gittensory-miner/lib/ci-poller.js
  • scripts/check-mcp-release-due.mjs line 143
  • scripts/smoke-production.mjs line 109
  • src/orb/app-auth.ts line 14
  • src/orb/relay.ts line 468

Boundaries:

  • Leave every reference to the separate gittensor network's own domain/name untouched -- the User-Agent literal on line 285 of src/gittensor/api.ts is the only thing in that file in scope for this issue.
  • Do not decide the ORB-related open question yourself. Land the shared-constant refactor for every other call site, and treat src/orb/app-auth.ts and src/orb/relay.ts as blocked on the maintainer's answer rather than guessing an outcome.

Part of #4761.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.roadmapOn the Wave-2 agent-layer roadmap board (project 9)

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions