Repository navigation
[sentry:7837173848] Fixed: artifactMetadata now validates the Hub mirror before building any metadata URL. src/workspace-service/models/artifact-metadata.ts previously declared `hub = 'h - #108
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed:
artifactMetadatanow validates the Hub mirror before building any metadata URL.src/workspace-service/models/artifact-metadata.tspreviously declaredhub = 'https://huggingface.co'as a default parameter and interpolated it directly, so anHF_ENDPOINTthat is set but empty, whitespace-only or scheme-less produced a relative request path such as/api/models/.... The runtime fetch then rejected while parsing that URL, raisingTypeErrorat therequest(call on line 30 — the exact file/line/column of the innermost Sentry frame in ATOMIC-CHAT-SERVER-1G — and the failure escapedartifacts.planuntyped (failure_reason: unknown). The change adds a smallhubOriginhelper that accepts only an absolute http/https URL (trailing slashes stripped) and otherwise falls back tohttps://huggingface.co, matching the empty-means-unset semantics already implemented byhubOfinmanaged-models.ts. Absolute mirrors such ashttp://localhost:4321/keep working unchanged; file URLs, commit checks, size/sha256 comparisons and digest computation are untouched, and no telemetry, contract or severity behaviour changed. Verified: the carried probesrc/workspace-service/models/artifact-metadata-mirror.test.tspasses for all three cases ('', ' ', 'hf-mirror.example'), and it failed on the base withTypeError: Invalid URLatartifact-metadata.ts:30:34.Evidence:
Sentry frames are
src/workspace-service/models/artifact-metadata.ts46:26 (await ofreading) and 30:34 (const response = await request(), matching the metadata fetch site.Base code declared
hub = 'https://huggingface.co'as a default parameter; a default parameter does not apply to a set-but-emptyHF_ENDPOINT, yielding a relative URL.src/workspace-service/models/artifacts.ts:79passesthis.options.env?.['HF_ENDPOINT']straight through as that argument.src/workspace-service/managed/managed-models.tsuses(env?.['HF_ENDPOINT'] || HF_HUB), confirming empty-means-unset is the intended semantics.Пробный тест
src/workspace-service/models/artifact-metadata-mirror.test.tsfailed on the base atartifact-metadata.ts:30:34withTypeError: Invalid URLfor '', ' ' and 'hf-mirror.example'.After the fix the same probe passes all three cases; the request URL is
https://huggingface.co/api/models/a/model/revision/<sha>?blobs=true&files_metadata=true.An absolute mirror is still honoured:
hubOrigin('http://localhost:4321/')yieldshttp://localhost:4321, preserving the existing mirror test path.Integrity logic is unchanged: commit/revision check,
siblingsvalidation, size andlfs.sha256comparisons, and the digest computation were not modified.Regression tests: src/workspace-service/models/artifact-metadata-mirror.test.ts
Full CI and human review are required.
Report: http://127.0.0.1:8080/tenants/707d0855-80ab-4e1f-a156-f1c4546cbf52/runs/5d2169e5-cfcb-4012-9327-8323732879b8
Sentry: https://atomic-chat.sentry.io/issues/7837173848/