Skip to content

[Detail Bug] Ontology bulk authoring UI hides background jobs beyond the 20 most recent (and stops polling for active jobs) #36030

Closed

Description

@detail-app

Detail Bug Report

https://app.detail.dev/org_3377c26d-da48-4ccd-b83a-22c542f4fe83/bugs/bug_67e063b2-99e6-4571-9c4b-99fb100fba08

Introduced in #28042 by @harshach on Aug 30, 2026

Summary

  • Context: The Ontology bulk authoring UI shows a "Background jobs" panel (via useOntologyBulkJobs) listing the bulk operations the current user has submitted for the selected glossary, polling for progress while jobs are queued/running.
  • Bug: The jobs list is fetched once with the default limit=20 over all glossaries of the calling user and then filtered client-side by glossary, so jobs of the selected glossary that fall outside the 20-most-recent window are silently dropped — and polling is gated on the filtered list, so a queued/running job outside the window never updates or reappears.
  • Actual vs. expected: The panel should show the selected glossary's jobs; instead it shows only those of the user's 20 most recent bulk jobs (across every glossary) that happen to belong to the selected glossary, and polling stops even when a job for that glossary is still queued/running.
  • Impact: A user who runs 20+ bulk jobs across multiple glossaries silently loses visibility of jobs for the selected glossary — including an active background import whose progress, status, and result cannot be seen from the UI while it runs (it does not reappear even after manual refresh, and only resurfaces days later if newer terminal rows age out of the 7-day retention window), with no way to cancel or download its result.

Code with Bug

// openmetadata-ui/src/main/resources/ui/src/components/OntologyExplorer/hooks/useOntologyBulkJobs.ts
const refreshJobs = useCallback(async () => {
  setIsLoading(true);
  setHasLoadError(false);

  try {
    const response = await listOntologyBulkJobs(); // <-- BUG 🔴 default limit=20, spans ALL glossaries
    setJobs(response.jobs.filter((job) => job.glossary.id === glossaryId)); // <-- BUG 🔴 client-side filter after truncation
  } catch {
    setHasLoadError(true);
  } finally {
    setIsLoading(false);
  }
}, [glossaryId]);

// ...

const hasActiveJobs = useMemo(
  () => jobs.some(isActiveOntologyBulkJob), // <-- BUG 🔴 computed from the truncated+filtered list
  [jobs]
);

usePollingEffect(refreshJobs, { enabled: hasActiveJobs }); // <-- BUG 🔴 polling never starts if the active job was dropped
// openmetadata-ui/src/main/resources/ui/src/rest/ontologyAPI.ts
export const listOntologyBulkJobs = async (limit = 20) => { // <-- BUG 🔴 hardcoded default
  const response = await APIClient.get<OntologyBulkJobList>(
    `${ONTOLOGY_BULK_PATH}/jobs`,
    { params: { limit } }
  );

  return response.data;
};
// openmetadata-service/src/main/java/org/openmetadata/service/jobs/JobDAO.java
@SqlQuery(
    "SELECT id, jobType, methodName, jobArgs, status, createdAt, updatedAt, createdBy, runAt, "
        + "progress, total, NULL AS result, error, message, cancelRequested, completedAt "
        + "FROM background_jobs WHERE createdBy = :createdBy "
        + "AND jobType = 'ONTOLOGY_BULK' ORDER BY createdAt DESC LIMIT :limit") // <-- BUG 🔴 no glossary predicate, truncates before the client filters
List<BackgroundJob> listOntologyBulkJobsByUser(
    @Bind("createdBy") String createdBy, @Bind("limit") int limit);

Explanation

  • The backend list endpoint (GET /v1/ontology/bulk/jobs) supports only a limit (default 20) and returns the user’s most recent ONTOLOGY_BULK jobs across all glossaries (SQL filters by createdBy + jobType only). There is no server-side glossary filter and no pagination.
  • The UI then filters the already-truncated response by job.glossary.id === glossaryId, so any jobs for the selected glossary that are older than the user’s 20 most recent jobs become unretrievable for the panel.
  • Polling is enabled only when hasActiveJobs is true, but hasActiveJobs is computed from the truncated+filtered jobs state. If the selected glossary’s only queued/running job is outside the 20-job window, polling never runs (and manual refresh hits the same endpoint), so the job stays invisible and never updates in the UI while still running server-side.

Codebase Inconsistency

  • The UI component using this hook expects a glossary-scoped background-jobs panel (useOntologyBulkJobs(glossary?.id) feeding OntologyBulkJobsPanel), but the backend API only provides a user-scoped list. The hook compensates with client-side filtering, which fails once server-side truncation occurs.

Recommended Fix

Request the maximum the server allows (listOntologyBulkJobs(100)) and/or add a glossary filter server-side (e.g. a glossaryId query param resolved in listOntologyBulkJobsByUser) so the panel's list is complete for the selected glossary. For the polling gate, base enabled on information that is not destroyed by the truncation — e.g. keep polling while any submission for this glossary may still be in flight (the hook knows when submitOntologyBulkOperation returned ExecutionMode.Background), or have the list endpoint expose the caller's active-job count independent of the page window.

History

This bug was introduced in commit 7b1bc6b (feat(rdf): SPARQL playground, MCP knowledge-graph tools, insights endpoints (#28042), 2026-08-29). The commit created the entire Ontology bulk-authoring feature in one pass — useOntologyBulkJobs.ts, the listOntologyBulkJobs API in ontologyAPI.ts, OntologyBulkResource.java, and JobDAO.listOntologyBulkJobsByUser — and baked the faulty design in from day one: a hardcoded limit = 20 default on the client and a server SQL that filters only by createdBy and jobType = 'ONTOLOGY_BULK' with no glossary predicate, forcing the hook to filter client-side over an already-truncated, cross-glossary list and gating polling on that filtered result.

Activity

  1. added a commit that references this issue on Oct 23, 2026
    e67d905
  2. added
    UI
    on Nov 6, 2026
  3. added this to Shipping and removed this from Roadmapon Nov 9, 2026
  4. moved this to In Review / QA 👀 in Shippingon Nov 9, 2026
  5. added 2 commits that reference this issue on Nov 9, 2026
    afc255f
    8f684a0
  6. moved this from In Review / QA 👀 to Done ✅ in Shippingon Nov 9, 2026
  7. added 2 commits that reference this issue on Nov 9, 2026
    4975211
    05ea59f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

UI

Type

No type

Projects

  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions