Skip to content

fix(ui): stop rendering the disabled-resource sentinel as a real API failure - #9919

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-9672
Jul 29, 2026
Merged

fix(ui): stop rendering the disabled-resource sentinel as a real API failure#9919
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-9672

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

fix(ui): stop rendering the disabled-resource sentinel as a real API failure

useApiResource wrote the literal "disabled" into error as a synthetic
sentinel for a switched-off resource, and MinerPanel rendered it through
the same warning box as a genuine apiFetch failure -- so a signed-out
visitor saw "Miner dashboard is unavailable right now (disabled)". Export
API_RESOURCE_DISABLED and compare against it explicitly instead, gate
MinerPanel on useSession's hydrated flag so the box never flashes before
the session resolves, and split AgentRuns' source pill so a live API
error no longer reads as "No session".

Closes #9672

UI Evidence

Viewport · Theme Before After
Desktop · Dark Desktop · Dark before
before
Desktop · Dark after
after
Tablet · Dark Tablet · Dark before
before
Tablet · Dark after
after
Mobile · Dark Mobile · Dark before
before
Mobile · Dark after
after

…failure

useApiResource wrote the literal "disabled" into error as a synthetic
sentinel for a switched-off resource, and MinerPanel rendered it through
the same warning box as a genuine apiFetch failure -- so a signed-out
visitor saw "Miner dashboard is unavailable right now (disabled)". Export
API_RESOURCE_DISABLED and compare against it explicitly instead, gate
MinerPanel on useSession's hydrated flag so the box never flashes before
the session resolves, and split AgentRuns' source pill so a live API
error no longer reads as "No session".
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 29, 2026 22:52
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb

loopover-orb Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-29 23:00:09 UTC

5 files · 1 AI reviewer · no blockers · readiness 93/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR fixes a real bug where useApiResource's synthetic "disabled" sentinel (used to mark a switched-off resource) was rendered through the same warning path as a genuine apiFetch failure, causing signed-out visitors to see "Miner dashboard is unavailable right now (disabled)" and signed-in operators with real API failures on Agent Runs to see "No session". The fix correctly exports API_RESOURCE_DISABLED as a named constant, compares against it explicitly at both call sites, and adds a `hydrated` gate in MinerPanel to prevent a false sign-in-prompt flash before the session resolves. Tracing the logic confirms correctness: when canUseLiveRuns is true the resource is enabled so the disabled sentinel can never appear there, and the isSignedOut/isDashboardError branch ordering in MinerPanel handles the pre-hydration, signed-out, and real-error cases exactly as the new tests assert. Coverage is thorough — the new tests exercise all three states in MinerPanel and both source-pill branches in AgentRuns.

Nits — 6 non-blocking
  • apps/loopover-ui/src/routes/app.runs.tsx: AgentRuns doesn't apply the same `hydrated` gate as MinerPanel, so a signed-in operator could still see a brief "No session" flash before the session hook resolves — worth confirming this is intentionally out of scope for ui(app): stop rendering the useApiResource "disabled" sentinel as a real API failure #9672.
  • apps/loopover-ui/src/routes/app.runs.tsx:349: the `liveRuns.error !== API_RESOURCE_DISABLED` check inside `isError` is now unreachable dead code since the disabled sentinel can only occur when `canUseLiveRuns` is false (and the resource is thus not enabled) — consider removing it or leaving a comment explaining why it's kept defensively.
  • apps/loopover-ui/src/lib/api/use-api-resource.ts:26: the constant value `"disabled"` is still a bare string literal at its own definition — fine since it's now single-sourced, just noting there's no enum/union type constraining comparisons elsewhere.
  • Consider whether AgentRuns should adopt the same `hydrated`-gated sign-in check MinerPanel got, for consistency across panels that render a source/session status pill.
  • The dead API_RESOURCE_DISABLED comparison in app.runs.tsx's `isError` prop could be removed now that `enabled: canUseLiveRuns` makes that branch unreachable, simplifying the conditional.
  • Possible screenshot-table issue: pair 1 — Advisory only — verify the screenshot-table images against the stated change before deciding.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9672
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ⚠️ 20/25 Preflight is ready, but the PR body does not name the validation run.
Contributor workload ✅ 10/10 Author activity: 101 registered-repo PR(s), 69 merged, 1 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 101 PR(s), 1 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff exports API_RESOURCE_DISABLED and uses it at both sentinel assignment sites plus app.runs.tsx's comparison, gates MinerPanel on useSession's hydrated flag with a distinct sign-in EmptyState free of the word 'disabled', and splits AgentRuns' sourceLabel/sourceStatus so a live API error reads 'Live API error' instead of 'No session'. All five listed deliverables appear to have matching test

Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript
  • Official Gittensor activity: 101 PR(s), 1 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add validation command/output.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/app/runs/test desktop before /app/runs/test
before /app/runs/test
after /app/runs/test
after /app/runs/test
/app/runs/test mobile before /app/runs/test (mobile)
before /app/runs/test (mobile)
after /app/runs/test (mobile)
after /app/runs/test (mobile)
/app/runs desktop before /app/runs
before /app/runs
after /app/runs
after /app/runs
/app/runs mobile before /app/runs (mobile)
before /app/runs (mobile)
after /app/runs (mobile)
after /app/runs (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

Scroll preview
Route Before (production) After (this PR's preview)
/app/runs/test before /app/runs/test (scroll)
before /app/runs/test (scroll)
after /app/runs/test (scroll)
after /app/runs/test (scroll)
/app/runs before /app/runs (scroll)
before /app/runs (scroll)
after /app/runs (scroll)
after /app/runs (scroll)

A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 29, 2026

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit ac0c078 into JSONbored:main Jul 29, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui(app): stop rendering the useApiResource "disabled" sentinel as a real API failure

1 participant