GitNexus/gitnexus/.env.example
Gergő Magyar d9d5775cdd
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Gitleaks / gitleaks (push) Waiting to run
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
perf(embeddings): remove quadratic vector-store scans and speed up the embedding phase (#3874)
* perf(embeddings): remove quadratic vector-store scans and speed up the embedding phase

Per-unit vector-store statements keyed by `{pk:$ids[i]}` were planned as
SCAN_NODE_TABLE -> CROSS_PRODUCT -> FILTER, and MERGE always hash-joined a
full table scan, so every 64-node unit scanned the whole receipt/chunk
tables and a large run was quadratic (#3870). Bind the key through WITH so
LadybugDB uses QUERY_PRIMARY_KEY_LOOKUP, and replace MERGE in beginNodes and
markSelected with a keyed update plus CREATE inside one transaction.

Further embedding-phase speedups, measured on released rc.216 with only the
changed files swapped in:

- Vector rows are passed as one float32 string per row and CAST natively
  instead of a numeric list the Node binding converts element by element
  on the main thread. Float32 values round-trip exactly; only the sign of a
  negative zero is not kept.
- seal() builds the vector index with the whole CPU allowance
  (budget.embedding.indexThreads) rather than the model thread cap.
- Structural field names no longer build a type environment over the whole
  hydrated class; only field types consulted it and embedding text keeps
  names alone, so the generated inputs are unchanged.
- HTTP providers keep a bounded window of requests in flight per unit
  (GITNEXUS_EMBEDDING_CONCURRENCY, default 4, 1 = serial). Results stay in
  input order so chunks reach the store contiguously; local models stay
  serial.

157k nodes / 192k chunks, zero-latency endpoint: embedding 13m45s -> 3m15s,
index build ~3m -> 1m24s. 31k nodes at 40 ms per request: 265s -> 95s.

Refs #3870

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* perf(embeddings): skip the transaction when a unit only creates or only updates

beginNodes and markSelected wrapped their keyed update and create in a
transaction even when only one of the two statements ran, which is the
normal case: a first run only creates and a replayed unit only updates. A
lone statement is already atomic, so only a unit that does both now pays
for BEGIN/COMMIT. Same durability, two fewer native round trips per unit.

Refs #3870

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: restore concurrent embedding recovery

Count original provider batches, preserve resumable failures, and
serialize half-open admission. Stop unconsumed window work safely.

Refs #3874

Note: pre-existing environment failures in setup.test.ts,
setup-skills.test.ts, and scenario-map/consolidation.test.ts are not
changed by this PR. All 103 tests pass with CODEX_HOME unset and
pinned jscpd available.

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 13:08:17 +00:00

86 lines
4.5 KiB
Text

# GitNexus HTTP Embedding Configuration
# Copy to .env and uncomment to use a remote OpenAI-compatible endpoint
# instead of the local snowflake-arctic-embed-xs model.
# When unset, local embeddings are used unchanged.
# GITNEXUS_EMBEDDING_URL=http://your-server:8080/v1
# GITNEXUS_EMBEDDING_MODEL=BAAI/bge-large-en-v1.5
# GITNEXUS_EMBEDDING_DIMS=1024
# GITNEXUS_EMBEDDING_API_KEY=your-key
# GITNEXUS_EMBEDDING_MAX_ATTEMPTS=3
# GITNEXUS_EMBEDDING_RETRY_CAP_MS=5000
# GITNEXUS_EMBEDDING_MIN_INTERVAL_MS=0
# HTTP requests in flight (1-64). Use 1 for serial or rate-limited endpoints,
# or set MIN_INTERVAL_MS above to pace request starts. Local models stay serial.
# GITNEXUS_EMBEDDING_CONCURRENCY=4
# GITNEXUS_EMBEDDING_HTTP_TIMEOUT_MS=180000
# Works with Infinity, vLLM, TEI, llama.cpp, Ollama, LM Studio, or OpenAI.
# See README for details.
# JVM / Kotlin same-package sibling injection
# Limits implicit sibling class bindings per module scope, nearest first by path.
# Set to 0 for no limit. Files whose sibling set is truncated are marked
# visibility-incomplete (wildcard attribution disabled for them). Packages over
# 500 files are skipped entirely regardless of this value.
# GITNEXUS_MAX_INJECTED_SIBLINGS=200
# Azure DevOps Server (Self-Hosted) Integration
# Base URL of your Azure DevOps Server instance. Prefer https:// — the PAT is
# sent in an Authorization header, so cleartext http:// exposes it on the wire
# (http:// is still supported for internal-only instances; the server warns).
# AZURE_DEVOPS_URL=https://azuredevops.example.com
# Personal Access Token with Code (Read) scope for cloning private repos.
# Used for both self-hosted and cloud (dev.azure.com) Azure DevOps.
# AZURE_DEVOPS_PAT=your-pat-here
# Scope-resolution property-key dispatch cap (default 32). Per-property-key
# registration cap in the property-dispatch scope-resolution pass. Raise for
# repos whose provider/hook tables lose CALLS coverage on a legitimate key.
# Positive integer only — non-integer or < 1 values fall back to 32.
# See README § "Scope-resolution property-key dispatch cap".
# GITNEXUS_MAX_PROPERTY_DISPATCH_FANOUT=32
# Per-callable-site dispatch-target cap (default 32). Raise this for repos whose
# wide dispatch tables overflow the default and lose a whole call chain; analyze
# then logs "callable-value-flow: candidate set exceeded the cap". Positive
# integer only — non-integer or < 1 values fall back to 32.
# See README § "Scope-resolution dispatch-target cap".
# GITNEXUS_MAX_CALLABLE_VALUE_TARGETS=64
# `serve` behind a reverse proxy
# Only needed when `gitnexus serve` is reached through a proxy, or bound to a
# wildcard address. Leave both unset for a local install.
# The single browser origin this server is reached through. A wildcard bind has
# no host identity, so without this the write-route guard rejects the UI's
# writes.
#
# NOT USABLE YET: `serve` has no authentication, and requests with no Origin
# header (curl, any script) already reach POST /api/analyze and DELETE /api/repo,
# so setting this makes `serve` refuse to start rather than open a public bind
# with nothing behind it.
#
# Matching rules for when the gate lifts: the hostname must match exactly, and so
# must the scheme. A value with no scheme means https, so plain HTTP needs the
# explicit http:// form. An explicit port must match; with no port, any port on
# that hostname is accepted. Anything that is not one reachable host (a list, a
# wildcard, a bare port number, a :0 port, a trailing dot) warns and allows
# nothing.
# GITNEXUS_PUBLIC_ORIGIN=https://gitnexus.example.com
# Which upstream hops may set X-Forwarded-*, so the per-IP rate limiter keys on
# the client IP and not the proxy's. Set it to the exact number of proxies you
# control. Every hop past that is one more entry of the chain the caller gets to
# write. false/no/off (and a 0 hop count) trust no hop; a proxy list Express can
# compile ("loopback", "10.0.0.0/8, 127.0.0.1") names them instead.
# true/yes/on is REJECTED: it reads the client-controlled leftmost
# X-Forwarded-For entry, so a spoofed chain earns a fresh rate-limit key per
# request, and express-rate-limit rejects it too. Counts above 16 are rejected as
# well, as a sanity ceiling rather than a safety boundary. Any invalid value warns
# and falls back to "loopback, linklocal, uniquelocal".
# Bind non-loopback with this unset and `serve` warns: a load balancer outside the
# private ranges is untrusted, so every request keys to the balancer and the
# per-IP limit becomes one shared limit.
# GITNEXUS_TRUST_PROXY=1