Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): show the gated-repo banner on the torch trainer too
[._.]/ Adam Eivybd69ddadb96f
diff --git a/server/lib/hfErrors.js b/server/lib/hfErrors.jsindex 9e7d8da544..5395bb99c1 100644--- a/server/lib/hfErrors.js+++ b/server/lib/hfErrors.js@@ -6,12 +6,17 @@//// Pure, no side effects.-// Matches both huggingface_hub gated-access message shapes:-// "Access to model <repo> is restricted …" (GatedRepoError prose)+// Matches the gated-access message shapes every runner emits:+// "Access to model <repo> is restricted …" (mflux wrapper / hub GatedRepoError prose)+// "Access to <repo> is restricted. Visit …" (torch _runner_common, no "model")// "Cannot access gated repo for url https://huggingface.co/<repo>/…"+// any "…huggingface.co/<owner>/<repo>…" URL (the torch message's "Visit <url>")+// `model` is optional; the bare `huggingface.co/` branch catches the URL forms.// The optional backtick tolerates markdown-wrapped repo ids; the trailing-// `.git` strip normalizes clone-style refs.-export const GATED_REPO_RE = /(?:Access to model|Cannot access gated repo for url https?:\/\/huggingface\.co\/)\s*`?([\w.-]+\/[\w.-]+)/i;+// `.git` strip normalizes clone-style refs. extractGatedRepo is only called+// once a failure is already classified as gated, so matching a HF URL here is+// the gated repo by construction (no false-positive risk on benign output).+export const GATED_REPO_RE = /(?:Access to (?:model )?|huggingface\.co\/)`?([\w.-]+\/[\w.-]+)/i;export function extractGatedRepo(text = '') {const match = String(text).match(GATED_REPO_RE);diff --git a/server/services/loraTraining/failure.js b/server/services/loraTraining/failure.jsindex d61f12fdfb..91ecb44b1b 100644--- a/server/services/loraTraining/failure.js+++ b/server/services/loraTraining/failure.js@@ -21,10 +21,15 @@ const CLI_MISMATCH_RE = /unrecognized arguments|invalid choice|the following argexport function classifyTrainingFailure({ stderrTail = [], exitCode = null, signal = null, userError = null } = {}) {const tail = stderrTail.join('\n');if (userError?.message) {- const code = userError.kind || 'DATASET_ERROR';+ // Runners label gated-repo failures differently: the mflux wrapper sniffs+ // FATAL_PATTERNS and emits USER_ERROR:HF_AUTH:…, while the torch+ // _runner_common walks the exception chain and emits USER_ERROR:gated_repo:….+ // Normalize both to HF_AUTH so the UI's single gated branch (errorCode ===+ // 'HF_AUTH') and the repo deep-link fire regardless of runtime.+ const code = userError.kind === 'gated_repo' ? 'HF_AUTH' : (userError.kind || 'DATASET_ERROR');const result = { code, message: userError.message };- // The trainer re-emits the raw gated-repo stderr line as USER_ERROR:HF_AUTH:…,- // so the repo is usually already in userError.message; fall back to the tail.+ // The trainer re-emits the raw gated-repo stderr line in the USER_ERROR+ // message, so the repo is usually already there; fall back to the tail.if (code === 'HF_AUTH') result.repo = extractGatedRepo(userError.message) || extractGatedRepo(tail);return result;}diff --git a/server/services/loraTraining/failure.test.js b/server/services/loraTraining/failure.test.jsindex 8bfac9ae30..06dc774b0a 100644--- a/server/services/loraTraining/failure.test.js+++ b/server/services/loraTraining/failure.test.js@@ -35,6 +35,19 @@ describe('classifyTrainingFailure', () => {expect(out.repo).toBe('black-forest-labs/FLUX.2-klein-base-9B');});+ it('normalizes the torch runner gated_repo USER_ERROR kind to HF_AUTH with a repo', () => {+ // _runner_common (torch FLUX.2) emits USER_ERROR:gated_repo:… instead of+ // HF_AUTH — both must classify as HF_AUTH so the UI banner fires.+ const out = classifyTrainingFailure({+ userError: {+ kind: 'gated_repo',+ message: 'Access to black-forest-labs/FLUX.2-klein-base-9B is restricted. Visit https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B to request access, then make sure your HF token is set in PortOS.',+ },+ });+ expect(out.code).toBe('HF_AUTH');+ expect(out.repo).toBe('black-forest-labs/FLUX.2-klein-base-9B');+ });+it('extracts the gated repo from a raw stderr tail and rewrites the message', () => {const out = classifyTrainingFailure({stderrTail: ['Cannot access gated repo for url https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B/resolve/main/config.json.'],