feat(files): register agents from any Git repository over SSH #2617
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #2617"
general
weight: 0.35
matthewgrossman
<!-- SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -->
<!-- SPDX-License-Identifier: Apache-2.0 -->
<!-- markdownlint-disable MD041 -->
Summary
<!-- In 1-3 plain sentences, explain what changes and why. Describe before-and-after behavior when it applies. -->
Agents could only be registered from GitHub, through the GitHub REST API. This adds a
gitfileset storage type that reads any Git repository over SSH with a private key stored in a workspace secret. The lookups Studio needs to register one (an SSH host key scan and a search for files in a commit) are in #2645, stacked on this one, and the Studio registration flow is in #2634, stacked on that.Changes
<!-- List the concrete changes included in this pull request. -->
Files service
GitStorageConfig(type: git):url(git@host:org/repo.gitorssh://host:port/...),revision,path,ssh_key_secret, requiredknown_hosts. URLs, revisions and paths that git or ssh could read as options, or that escape the repository, are rejected. Percent-encoding is refused in URLs, because git decodesssh://URLs before connecting and%2Fwould move the host it reaches past the allowlist. The URL is split the way git reads it (anssh://URL at its first/, the SCP form when a:comes before any/), then hosts are limited to DNS labels and users to login characters, because the allowlist'surlparsestops a host at?or#while ssh does not. Control characters are refused in the URL, revisions and path. The URL keeps the form it was given, so anssh://absolute path stays absolute, with the host lowercased, any trailing dot and anssh://URL's:22dropped, so ssh andknown_hostsname the host the same way.read_chunk_sizeis limited to 1 byte–16 MiB. SCP paths may be absolute, ports must be ASCII 1–65535, and commit SHAs are lowercased; SHA-256 ids are refused, and a branch on a SHA-256 repository is refused at create.revisionandoriginal_revisionmust be plain branch, tag or commit names, since a refresh resolves the latter withls-remote.GitStorageImpl: resolves a branch, tag or other name underrefs/withgit ls-remotein git's order (so a tag wins over a same-named branch, andheads/xorpull/5/headwork), which also proves the key can read the repository, and pins the fileset to that commit; the existing tracked-revision refresh moves it to a branch's new head.original_revisionis always recorded from the requested revision, as for GitHub filesets, so a client-supplied value cannot repoint a pinned fileset on refresh. A pinned commit SHA is fetched at create with the fileset's key, even if another fileset already cached it, so a commit the remote lacks or will not serve to that key fails up front. On first use a commit's listing of paths, blob ids and sizes is written to the files service's default storage and kept in memory, up to 250,000 listed files; a stored listing is rebuilt if it is missing or its contents are wrong (another commit, a malformed entry, a bad blob id or size), while errors from the store itself fail the request; a commit over 100,000 files is refused, and a listing that cannot be stored is still served. File contents stream fromgit cat-fileand are cached in the background by the files service's download cache, as other external backends' are:get_cache_path_keykeys each file by URL and blob, so an update caches only the files that changed, andcache=Truewarms git filesets too. Looking a file up, which a download does before its 10 s first-byte deadline starts, makes sure the commit is in the local fetch repository, so a restart, second replica or pruned repository fetches outside that deadline. HEAD and other metadata lookups of an uncached file therefore fetch the commit too: the backend cannot tell them from a GET, and a GET usually follows. The download itself runs one git process without taking the repository lock, and fetching or listing a commit finishes even when its request is cancelled, so a retry finds it done. Storage errors from the cache key lookup map to the same 502s as the rest of the download path.GIT_LITERAL_PATHSPECS); at most 16 git commands other than file streams run at once.-F /dev/null,IdentitiesOnly,IdentityAgent=none,StrictHostKeyChecking=yesagainst the fileset'sknown_hosts,BatchMode,GIT_ALLOW_PROTOCOL=ssh, no system or global git config. The key is written to a 0600 temp file per call; keys pasted into a single-line secret field are re-wrapped.Permission denied (...), host key mismatch), config (missing repository, ref or path, including GitLab's "not found or no permission") and unavailable (network failures, hung-up remotes, ServerAlive timeouts). Faults on the server itself, such as a missing git or ssh binary, ssh refusing a uid without a passwd entry, or a full disk, raiseGitServerFault, a newStorageServerFault, and surface as 500s, on downloads too.allowed_external_hostsgates SSH hosts too;ssh://host:22matchesssh://host.openssh-clientadded tonhx-python-base;gitwas already present, but--no-install-recommendsleft out ssh.Studio compatibility
GitStorageConfig. The registration flow itself is in #2634.Type of Change
Quality Gates
<!-- Check one tests line and one documentation line. Include the requested justification when a gate is not applicable. -->
Documentation for the new storage type, the SSH registration flow and the
allowed_external_hostsrequirement is not written yet.Verification
<!-- Check an item only when supported by evidence. List exact targeted validation commands and results below. -->
Signed-off-by:traileruv run pre-commit run -apasses, or any blocked checks are identified belowTargeted validation:
<!-- List each command and result. Explain skipped, blocked, or non-successful checks without marking them as passed. -->
pytest services/core/files/testswith.envset aside — 829 passed, 51 skipped (git backend 156). The backend tests drive realgitagainst a local repository over the file protocol, enabled only in tests.ty check,ruff check,ruff formaton the changed Python — clean.script/generate-openapi-spec.sh— spec unchanged after the last change; web SDK regenerated withpnpm gen.npm run typecheckinweb/packages/studio— 0 errors; Studio agent, secrets, API and datasets suites — 750 passed.uv run pre-commit run -aacross the whole repository was not run.pytest packages/nemo_helix_plugin/tests -k "storage or files or git"— 98 passed.generate-config-docsleavesdocs/set-up/config-reference.mdxunchanged by this PR.gitlab-master.nvidia.com:12051over SSH against a local platform. The current design has not been exercised against a real SSH host yet.Not run or known gaps:
opa testfails to compilecommon.regolocally with OPA 1.21.1 on unmodifiedmainas well; CI runs its own pinned OPA.NHX_FILES_ALLOWED_EXTERNAL_HOSTSset in a developer.env, fivetest_files_config.pytests fail when the full files suite runs, because the integration tests load.env. Unrelated to this change.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Added read-only Git storage over SSH for filesets, with configurable repository, revision, and path. Files can be listed and downloaded, including byte-range downloads.
Studio now identifies Git-backed filesets as “Git (SSH)” and displays their repository location.
Bug Fixes
* Improved file-download error handling so server-side faults are reported accurately.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->