Repository navigation
Closed
Description
Summary
The git-ai bg run background daemon grows unbounded in memory (observed 10.2GB RSS, 46% CPU sustained) when the configured api_key is rejected by the metrics telemetry endpoint. The daemon retries the failed upload roughly every 30 seconds indefinitely instead of backing off after a permanent auth failure, and the local metrics backlog grows without bound in the meantime.
Environment
- git-ai version: 1.6.10
- OS: macOS (Darwin 25.5.0, arm64, Apple M4 Max, 36GB RAM)
- Install: fleet-managed deployment (MDM)
Observed behavior
git-ai bg rundaemon running in background (auto-started via git hooks / Trace2 integration).- Daemon periodically attempts metrics upload to
https://usegitai.com/worker/metrics/uploadusing theapi_keyfrom~/.git-ai/config.json. - Server responds
Unauthorizedfor every batch. - Daemon retries approximately every 30 seconds, indefinitely:
INFO metrics upload batch sending min_id=... max_id=... events=NN INFO metrics upload batch failed ... error=Generic error: Unauthorized WARN telemetry: failed to upload pending metrics e=Generic error: Unauthorized - Over ~24 hours this grew
metrics-dbon disk to 766MB (vs <7MB for the daemon's other sqlite DBs: transcripts-db, notes-db, bash-checkpoints-db), and daemon RSS grew to 10.2GB with sustained ~46% CPU. git-ai bg shutdown --hard+ restart reclaims memory temporarily, but the leak resumes since the underlying auth failure isn't addressed and no backoff is applied.
Additional findings
- Running
git-ai loginfixed an unrelated, contradictory login-state issue (git-ai debugsaid "logged out" whilegit-ai loginsaid "Already logged in"), but did not fix this leak — the metrics endpoint uses the standaloneapi_keyfield, independent of the interactive login session used fornotes_backend. - Could not disable this telemetry channel client-side:
git-ai config set telemetry_oss_disabled true→Error: Unknown config key: telemetry_oss_disabled, despite it being a real, readable field (git-ai config telemetry_oss_disabledreturnsfalse).- Manually setting
"telemetry_oss_disabled": truedirectly in config.json had no effect after a full daemon restart — the value still reads back asfalse.
Expected behavior
- On a persistent auth failure (
Unauthorized), the daemon should back off or circuit-break rather than retrying every ~30s forever, and should not let the pending-metrics backlog/memory grow unbounded. telemetry_oss_disabledshould be settable viagit-ai config setand/or honored from config.json, so users can opt out of this telemetry channel independent of the auth issue.
Impact
10.2GB RAM / 46% CPU sustained on a 36GB machine, contributing to significant system-wide memory pressure alongside normal daily usage.
Metadata
Metadata
Assignees
Labels
No labels
Activity
svarlamov commentedon Jul 9, 2026
Please do NOT post or download ZIPs in comments (even if you're trying to be helpful). Not referring to OP -- referring to a deleted comment with that nature of content. If you'd like to propose a solution, please open a PR or even direct to a fork that's hosted on GitHub, etc.
Regarding the issue, we are working on a solution in #1700 and planning to release in the next version. Does removing the API Key address the issue? Just OOC, why are you setting an API Key? There was another comment regarding
telemetry_oss_disabled, but that's for open source telemetry -- setting the API Key is for the Git AI proprietary cloud offering -- and does not interact withtelemetry_oss_disabled(setting that to false is independent of this memory issue and the API Key)Siddhant-K-code commentedon Jul 9, 2026
Hey @dbasilfid, can you run the following commands and share their output!
dbasilfid commentedon Jul 9, 2026
~/development git-ai --version
1.6.10
~/development ls -la ~/.git-ai/internal/
total 1704968
drwxr-xr-x 23 drb-fid staff 736 Jul 8 20:53 .
drwxr-xr-x 7 drb-fid staff 224 Jul 8 20:46 ..
drwxr-xr-x@ 23 drb-fid staff 736 May 5 23:06 async-checkpoint-blobs
-rw-r--r--@ 1 drb-fid staff 7544832 Jul 9 10:34 bash-checkpoints-db
-rw-r--r--@ 1 drb-fid staff 32768 Jul 8 23:32 bash-checkpoints-db-shm
-rw-r--r--@ 1 drb-fid staff 4161232 Jul 9 11:00 bash-checkpoints-db-wal
-rw-------@ 1 drb-fid staff 668 Jul 9 10:25 credentials
drwxr-xr-x@ 7 drb-fid staff 224 Jul 8 23:32 daemon
-rw-r--r--@ 1 drb-fid staff 10440704 May 5 23:02 db
-rw-r--r--@ 1 drb-fid staff 32768 May 5 16:17 db-shm
-rw-r--r--@ 1 drb-fid staff 4622672 May 6 08:18 db-wal
drwxr-xr-x@ 8 drb-fid staff 256 Jul 8 20:56 debug-self-checks
-rw-r--r-- 1 drb-fid staff 36 Mar 19 16:15 distinct_id
-rw-r--r--@ 1 drb-fid staff 809439232 Jul 9 11:01 metrics-db
-rw-r--r--@ 1 drb-fid staff 32768 Jul 8 23:32 metrics-db-shm
-rw-r--r--@ 1 drb-fid staff 14366472 Jul 9 11:01 metrics-db-wal
-rw-r--r--@ 1 drb-fid staff 626688 Jul 7 17:53 notes-db
-rw-r--r--@ 1 drb-fid staff 32768 Jul 8 23:32 notes-db-shm
-rw-r--r--@ 1 drb-fid staff 4124152 Jul 9 10:54 notes-db-wal
-rw-r--r--@ 1 drb-fid staff 970752 Jul 8 23:44 transcripts-db
-rw-r--r--@ 1 drb-fid staff 32768 Jul 8 23:32 transcripts-db-shm
-rw-r--r--@ 1 drb-fid staff 4124152 Jul 9 11:00 transcripts-db-wal
-rw-r--r--@ 1 drb-fid staff 94 Jul 8 21:56 update_check
~/development for dir in ~/.cursor ~/.codex ~/.claude ~/.windsurf ~/.amp ~/.continue ~/.gemini; do
[ -d "$dir" ] && echo "$dir: $(du -sh "$dir" 2>/dev/null | cut -f1)"
done
/Users/drb-fid/.cursor: 1.8G
/Users/drb-fid/.codex: 847M
/Users/drb-fid/.claude: 377M
/Users/drb-fid/.gemini: 9.6M
~/development ls -lh ~/.git-ai/internal/metrics-db
-rw-r--r--@ 1 drb-fid staff 772M Jul 9 11:01 /Users/drb-fid/.git-ai/internal/metrics-db
dbasilfid commentedon Jul 9, 2026
Thanks — good to hear #1700 is coming!
To answer your questions:
Does removing the API Key address the issue? No. I ran
git-ai config unset api_key, verified it was gone from config.json, and hard-restarted the daemon (bg restart --hard). The daemon still attempts metrics uploads to usegitai.com every ~30s and still receivesUnauthorizedon every batch — this despitegit-ai debugshowing an active, valid login session (access token auto-refreshing, refresh token valid for months). So the retry/backlog growth continues regardless of whether the key is present.Why was an API Key set? I didn't set it myself — git-ai is deployed fleet-wide to developer laptops by my company's admin (managed/MDM install), and the key came provisioned in config.json. It's presumably stale or revoked at the server. I already flagged the bad key to our admin separately, but the client-side symptom (infinite ~30s retries with unbounded backlog growth on a permanent 401) reproduces with or without the key.
And thanks for the clarification on
telemetry_oss_disabledvs. the proprietary cloud pathSiddhant-K-code commentedon Jul 10, 2026
Memory leak issues would be fixed/better after the release of
v1.6.12- #1772 was just merged today!svarlamov commentedon Jul 10, 2026
Hey @dbasilfid! I just tried to replicate and was not able to -- I do know that there was an issue with this previously though. Do you mind checking if you can still reproduce with v1.6.12?
dbasilfid commentedon Jul 10, 2026
@svarlamov Confirmed fixed in v1.6.12 — thanks!
I upgraded from 1.6.11 → 1.6.12 and hard-restarted the daemon. The
Unauthorizederrors still occur in my environment (my api_key is stale/revoked at the server — a provisioning issue on our MDM side, unrelated to git-ai), so this is actually a good stress test.Results on v1.6.12 under sustained upload failures:
Closing this out on my end, I appreciate the quick turnaround.