Skip to content

[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
Ooooze merged 3 commits into
mainfrom
codex/sentry-fix/7837173848
Nov 18, 2026
Merged

Ooooze merged 3 commits into
mainfrom
codex/sentry-fix/7837173848

Conversation

@Ooooze

@Ooooze Ooooze commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Fixed: artifactMetadata now validates the Hub mirror before building any metadata URL. src/workspace-service/models/artifact-metadata.ts previously declared hub = 'https://huggingface.co' as a default parameter and interpolated it directly, so an HF_ENDPOINT that 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, raising TypeError at the request( call on line 30 — the exact file/line/column of the innermost Sentry frame in ATOMIC-CHAT-SERVER-1G — and the failure escaped artifacts.plan untyped (failure_reason: unknown). The change adds a small hubOrigin helper that accepts only an absolute http/https URL (trailing slashes stripped) and otherwise falls back to https://huggingface.co, matching the empty-means-unset semantics already implemented by hubOf in managed-models.ts. Absolute mirrors such as http://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 probe src/workspace-service/models/artifact-metadata-mirror.test.ts passes for all three cases ('', ' ', 'hf-mirror.example'), and it failed on the base with TypeError: Invalid URL at artifact-metadata.ts:30:34.

Evidence:
Sentry frames are src/workspace-service/models/artifact-metadata.ts 46:26 (await of reading) 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-empty HF_ENDPOINT, yielding a relative URL.
src/workspace-service/models/artifacts.ts:79 passes this.options.env?.['HF_ENDPOINT'] straight through as that argument.
src/workspace-service/managed/managed-models.ts uses (env?.['HF_ENDPOINT'] || HF_HUB), confirming empty-means-unset is the intended semantics.
Пробный тест src/workspace-service/models/artifact-metadata-mirror.test.ts failed on the base at artifact-metadata.ts:30:34 with TypeError: Invalid URL for '', ' ' 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/') yields http://localhost:4321, preserving the existing mirror test path.
Integrity logic is unchanged: commit/revision check, siblings validation, size and lfs.sha256 comparisons, 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/

@Ooooze
Ooooze merged commit d9c9715 into main Nov 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant