Handle forks in update-check version payload

Jan Tomášek committed Feb 21, 2026 at 15:40 UTC e13ed04f6cc2124427a88a49d4ebaca56becfeea
2 files changed +24 -3
python/helpers/git.py
+18 -1
@@ -74,6 +74,23 @@ def get_version():
74 return "unknown"
75
76
77 +def is_official_agent_zero_repo() -> bool:
78 + """Return True when origin points to agent0ai/agent-zero."""
79 + try:
80 + repo = Repo(files.get_base_dir())
81 + if not repo.remotes:
82 + return False
83 +
84 + remote_url = strip_auth_from_url(repo.remotes.origin.url).lower().rstrip("/")
85 +
86 + if remote_url.endswith(".git"):
87 + remote_url = remote_url[:-4]
88 +
89 + return remote_url.endswith("github.com/agent0ai/agent-zero") or remote_url.endswith("github.com:agent0ai/agent-zero")
90 + except Exception:
91 + return False
92 +
93 +
94 def clone_repo(url: str, dest: str, token: str | None = None):
95 """Clone a git repository. Uses http.extraHeader for token auth (never stored in URL/config)."""
96 cmd = ['git']
@@ -158,4 +175,4 @@ def get_repo_status(repo_path: str) -> dict:
175 "last_commit": last_commit
176 }
177 except Exception as e:
161 - return {"is_git_repo": False, "error": str(e)}
\ No newline at end of file
178 + return {"is_git_repo": False, "error": str(e)}
python/helpers/update_check.py
+6 -2
@@ -1,15 +1,19 @@
1 from python.helpers import git, runtime
2 import hashlib
3
4 +
5 async def check_version():
6 import httpx
7
8 current_version = git.get_version()
9 + if not git.is_official_agent_zero_repo():
10 + current_version = "fork"
11 +
12 anonymized_id = hashlib.sha256(runtime.get_persistent_id().encode()).hexdigest()[:20]
9 -
13 +
14 url = "https://api.agent-zero.ai/a0-update-check"
15 payload = {"current_version": current_version, "anonymized_id": anonymized_id}
16 async with httpx.AsyncClient() as client:
17 response = await client.post(url, json=payload)
18 version = response.json()
15 - return version
\ No newline at end of file
19 + return version