Skip to content

FE-1994: Pass whole EntityId around for Flow Runs instead of just the EntityUuid - #10072

Merged
CiaranMn merged 6 commits into
mainfrom
cm/fe-1994-flow-run-entity-ids
Oct 19, 2026
Merged

CiaranMn merged 6 commits into
mainfrom
cm/fe-1994-flow-run-entity-ids

Conversation

@CiaranMn

Copy link
Copy Markdown
Member

🌟 Purpose

A flow run was previously identified in various functions by flowRunId, the uuid of its Flow Run entity. A uuid alone doesn't say which web a run is in, so finding a run searched every web for an entity with that uuid, and code that needed the run's web had to find the entity first.

This PR identifies a run by its full entity id everywhere: the GraphQL API, the backend, the frontend and the browser plugin.

FE-2006 will do the same exercise for Flow Definitions.

🔍 Changes

Entirely function signature update and consequential mechanical changes.

⚠️ Known issues

  • The browser plugin needs a new release before it will work for related functionality.

@CiaranMn
CiaranMn requested a balanced review from Copilot October 17, 2026 09:20
@CiaranMn
CiaranMn requested a review from a team as a code owner October 17, 2026 09:20
@vercel

vercel Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Oct 19, 2026 1:50pm UTC
hashdotdesign-tokens Ready Ready Preview Oct 19, 2026 1:50pm UTC
petrinaut Ready Ready Preview Oct 19, 2026 1:50pm UTC
petrinaut-docs Ready Ready Preview Oct 19, 2026 1:50pm UTC

Request Review

@cursor

cursor Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

PR Summary

High Risk
Breaking GraphQL and WebSocket contract across API, frontend, and browser plugin; incorrect ids would target the wrong Temporal workflow or fail lookups until all clients are updated.

Overview
Flow runs are now identified by the full EntityId of their Flow Run entity (flowRunEntityId) instead of a bare entity UUID (flowRunId / flowUuid). That identifier is threaded through GraphQL, the API, Temporal workflow params, the inference WebSocket protocol, the web app, and the browser plugin.

GraphQL & API: FlowRun.flowRunEntityId replaces flowRunId; queries/mutations (getFlowRunById, startFlow, cancelFlow, resetFlow, submitExternalInputResponse) take or return EntityId. startFlow returns entityIdFromComponents(webId, workflowId) while Temporal still uses a separate workflow UUID. Lookups use getFlowRunEntityById with web + uuid from the entity id; cancel/reset/signals resolve the Temporal handle from the run entity’s workflow-id property, not the client-supplied id alone.

Clients: Frontend context, Apollo cache keys, dashboards/goals/workers UI, and worker routes build the selected run’s EntityId from the route web + run-id uuid. Paths still expose only the uuid via generateWorkerRunPath. Entity history provenance links to a run use the run’s web shortname when the origin id is a flow entity id.

Browser plugin: WebSocket and local messages use flowRunEntityId; optimistic pending runs store entityIdFromComponents(webId, requestUuid). Requires a plugin release to stay compatible.

Reviewed by Cursor Bugbot for commit 7852622. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/apps labels Oct 17, 2026
@CiaranMn
CiaranMn deployed to pull-request October 17, 2026 09:23 — with GitHub Actions Active
@CiaranMn
CiaranMn deployed to pull-request October 17, 2026 09:23 — with GitHub Actions Active
@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.23%. Comparing base (0aebf06) to head (b340e12).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
.../resolvers/flows/submit-external-input-response.ts 0.00% 3 Missing ⚠️
libs/@local/hash-backend-utils/src/flows.ts 0.00% 3 Missing ⚠️
...-websocket/handle-cancel-infer-entities-request.ts 0.00% 2 Missing ⚠️
...ash-api/src/graphql/resolvers/flows/cancel-flow.ts 0.00% 2 Missing ⚠️
.../src/graphql/resolvers/flows/get-flow-run-by-id.ts 0.00% 2 Missing ⚠️
...hash-api/src/graphql/resolvers/flows/reset-flow.ts 0.00% 2 Missing ⚠️
...orkflow/common-activities/persist-flow-activity.ts 0.00% 2 Missing ⚠️
...tils/src/flows/shared/get-flow-run-entity-by-id.ts 0.00% 2 Missing ⚠️
apps/hash-api/src/ai/infer-entities-websocket.ts 0.00% 1 Missing ⚠️
...h-backend-utils/src/flows/process-flow-workflow.ts 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10072   +/-   ##
=======================================
  Coverage   68.22%   68.23%           
=======================================
  Files        1990     1993    +3     
  Lines      205165   205225   +60     
  Branches     8699     8713   +14     
=======================================
+ Hits       139979   140038   +59     
  Misses      63520    63520           
- Partials     1666     1667    +1     
Flag Coverage Δ
apps.hash-ai-worker-ts 7.37% <ø> (+0.47%) ⬆️
apps.hash-api 15.57% <0.00%> (+0.19%) ⬆️
local.hash-backend-utils 6.23% <0.00%> (-0.02%) ⬇️
local.hash-isomorphic-utils 31.55% <0.00%> (+0.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI 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.

🟡 Changes recommended

Workflow-target authorization and compatibility with persisted browser and Temporal inputs remain unresolved.

3 open issues
What changed in this PR

Migrates flow-run identification from UUIDs to full entity IDs across shared libraries, the API, frontend, and browser plugin, enabling web-scoped lookups.

Changes:

  • Updates GraphQL contracts, client state, and browser messages.
  • Scopes run lookups by web and resolves Temporal targets from stored workflow IDs.
  • Updates navigation while retaining UUID-based URL segments.
File Description
libs/​@local/​hash-isomorphic-utils/​src/​graphql/​type-defs/​knowledge/​flow.typedef.ts Updates GraphQL contracts.
libs/​@local/​hash-isomorphic-utils/​src/​graphql/​queries/​flow.queries.ts Updates shared operations.
libs/​@local/​hash-isomorphic-utils/​src/​flows/​temporal-types.ts Renames workflow input field.
libs/​@local/​hash-isomorphic-utils/​src/​flows/​frontend-paths.ts Extracts UUIDs for URLs.
libs/​@local/​hash-isomorphic-utils/​src/​create-apollo-client.ts Updates cache identity.
libs/​@local/​hash-isomorphic-utils/​src/​ai-inference-types.ts Updates WebSocket contracts.
libs/​@local/​hash-backend-utils/​src/​flows/​shared/​get-flow-run-entity-by-id.ts Adds web-scoped lookup.
libs/​@local/​hash-backend-utils/​src/​flows/​process-flow-workflow/​common-activities/​persist-flow-activity.ts Renames persistence input.
libs/​@local/​hash-backend-utils/​src/​flows/​process-flow-workflow.ts Forwards renamed input.
libs/​@local/​hash-backend-utils/​src/​flows/​get-flow-run-details.ts Returns full run IDs.
libs/​@local/​hash-backend-utils/​src/​flows.ts Threads full run IDs.
apps/​plugin-browser/​src/​shared/​storage.ts Updates stored run type.
apps/​plugin-browser/​src/​shared/​messages.ts Updates cancellation messages.
apps/​plugin-browser/​src/​scripts/​background/​infer-entities.ts Updates messages and optimistic IDs.
apps/​plugin-browser/​src/​pages/​popup/​popup-contents/​action-center/​shared/​use-flow-runs.ts Reconciles by entity ID.
apps/​plugin-browser/​src/​pages/​popup/​popup-contents/​action-center/​history/​shared/​history-row/​flow-status-cell.tsx Sends full cancellation ID.
apps/​plugin-browser/​src/​pages/​popup/​popup-contents/​action-center/​history/​shared/​history-row/​flow-metadata-cell-contents.tsx Accepts entity IDs for usage.
apps/​plugin-browser/​src/​pages/​popup/​popup-contents/​action-center/​history/​shared/​history-row.tsx Updates history links.
apps/​plugin-browser/​src/​pages/​popup/​popup-contents/​action-center/​history/​manually-triggered.tsx Updates row keys.
apps/​plugin-browser/​src/​pages/​popup/​popup-contents/​action-center/​history/​automatically-triggered.tsx Updates row keys.
apps/​plugin-browser/​src/​graphql/​queries/​flow.queries.ts Requests full run IDs.
apps/​hash-frontend/​src/​pages/​workers.page/​flow-run-table.tsx Updates links and usage keys.
apps/​hash-frontend/​src/​pages/​workers.page.tsx Updates context property.
apps/​hash-frontend/​src/​pages/​shared/​use-flow-runs-usage.ts Groups usage by entity ID.
apps/​hash-frontend/​src/​pages/​shared/​flow-runs-context.ts Updates selected-run type.
apps/​hash-frontend/​src/​pages/​shared/​flow-runs-context-provider.tsx Queries by entity ID.
apps/​hash-frontend/​src/​pages/​shared/​entity/​entity-editor/​history-section/​history-table/​provenance.tsx Passes full provenance run ID.
apps/​hash-frontend/​src/​pages/​goals/​new.page.tsx Updates post-start navigation.
apps/​hash-frontend/​src/​pages/​goals.page/​goals-list/​goal-list-section/​goal-row.tsx Updates goal run links.
apps/​hash-frontend/​src/​pages/​goals.page/​goals-list/​goal-list-section.tsx Updates goal row keys.
apps/​hash-frontend/​src/​pages/​goals.page/​goals-list.tsx Stores full run IDs.
apps/​hash-frontend/​src/​pages/​goals.page.tsx Updates context property.
apps/​hash-frontend/​src/​pages/​flows.page.tsx Updates context property.
apps/​hash-frontend/​src/​pages/​dashboard/​hooks/​use-dashboard-item-generations.ts Polls with entity IDs.
apps/​hash-frontend/​src/​pages/​dashboard/​hooks/​use-dashboard-item-config.ts Updates generation state and polling.
apps/​hash-frontend/​src/​pages/​dashboard/​[dashboard-id].page/​item-config-modal.tsx Updates callback contract.
apps/​hash-frontend/​src/​pages/​dashboard/​[dashboard-id].page.tsx Updates generation callback.
apps/​hash-frontend/​src/​pages/​@/​[shortname]/​workers/​[run-id].page.tsx Reconstructs ID from route namespace.
apps/​hash-frontend/​src/​pages/​@/​[shortname]/​shared/​flow-visualizer/​topbar.tsx Updates selection and cancellation.
apps/​hash-frontend/​src/​pages/​@/​[shortname]/​shared/​flow-visualizer/​shared/​question-modal.tsx Submits full run ID.
apps/​hash-frontend/​src/​pages/​@/​[shortname]/​shared/​flow-visualizer/​outputs/​claims-output.tsx Uses full provenance ID directly.
apps/​hash-frontend/​src/​pages/​@/​[shortname]/​shared/​flow-visualizer/​flow-run-sidebar.tsx Updates usage lookup.
apps/​hash-frontend/​src/​pages/​@/​[shortname]/​shared/​flow-visualizer/​activity-log.tsx Updates reset input.
apps/​hash-frontend/​src/​pages/​@/​[shortname]/​shared/​flow-visualizer.tsx Updates navigation and run state.
apps/​hash-frontend/​src/​pages/​@/​[shortname]/​flows/​[flow-def-id].page.tsx Updates context property.
apps/​hash-frontend/​src/​graphql/​queries/​knowledge/​flow.queries.ts Updates mutation arguments.
apps/​hash-api/​src/​graphql/​resolvers/​flows/​submit-external-input-response.ts Resolves stored workflow target.
apps/​hash-api/​src/​graphql/​resolvers/​flows/​start-flow.ts Returns full entity ID.
apps/​hash-api/​src/​graphql/​resolvers/​flows/​reset-flow.ts Resolves stored reset target.
apps/​hash-api/​src/​graphql/​resolvers/​flows/​get-flow-run-by-id.ts Accepts full entity ID.
apps/​hash-api/​src/​graphql/​resolvers/​flows/​cancel-flow.ts Resolves stored cancellation target.
apps/​hash-api/​src/​ai/​infer-entities-websocket/​handle-infer-entities-request.ts Sets predictable run UUID.
apps/​hash-api/​src/​ai/​infer-entities-websocket/​handle-cancel-infer-entities-request.ts Cancels through entity lookup.
apps/​hash-api/​src/​ai/​infer-entities-websocket.ts Updates validation and signaling.

Review effort: Balanced

Comment thread apps/hash-api/src/graphql/resolvers/flows/cancel-flow.ts
Comment thread libs/@local/hash-isomorphic-utils/src/flows/temporal-types.ts
Base automatically changed from cm/fe-1894-flow-definitions-in-graph to main October 17, 2026 09:38
kostandinang
kostandinang previously approved these changes Oct 19, 2026

@kostandinang kostandinang 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.

Looks good. Left couple of notes, maybe worth checking.

Comment thread libs/@local/hash-isomorphic-utils/src/graphql/type-defs/knowledge/flow.typedef.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – petrinaut October 19, 2026 13:29 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs October 19, 2026 13:29 Inactive
@CiaranMn
CiaranMn requested a review from kostandinang October 19, 2026 13:34

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7852622. Configure here.

@CiaranMn
CiaranMn added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 19, 2026
@CiaranMn
CiaranMn added this pull request to the merge queue Oct 19, 2026
Merged via the queue into main with commit 80975c5 Oct 19, 2026
71 checks passed
@CiaranMn
CiaranMn deleted the cm/fe-1994-flow-run-entity-ids branch October 19, 2026 15:07

This branch was successfully deployed

5 active (1 outdated) deployments
Preview – hash — 78526220 Deployed Oct 19, 2026 by vercel[bot]
Preview – petrinaut-docs — 78526220 Deployed Oct 19, 2026 by vercel[bot]
Preview – petrinaut — 78526220 Deployed Oct 19, 2026 by vercel[bot]
Preview – hashdotdesign-tokens — 78526220 Deployed Oct 19, 2026 by vercel[bot]
pull-request — 0a96dc3a Deployed Oct 17, 2026 by CiaranMn via Sourcemaps (@apps/hash-ai-worker-ts) #40164
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/apps area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

3 participants