Skip to content

feat(observe): ExecutionDetail with tree view, headers, and resizable drawer#6325

Open
jocelynlin-wd wants to merge 7 commits intomainfrom
feat/observe-execution-detail
Open

feat(observe): ExecutionDetail with tree view, headers, and resizable drawer#6325
jocelynlin-wd wants to merge 7 commits intomainfrom
feat/observe-execution-detail

Conversation

@jocelynlin-wd
Copy link
Copy Markdown
Contributor

@jocelynlin-wd jocelynlin-wd commented May 1, 2026

Summary

Ports the legacy ExecutionDetails.jsx (~984 lines) into the @flowiseai/observe SDK as a composable ExecutionDetail orchestrator.

  • ExecutionDetail: split-pane (sidebar tree + node detail) with sidebar header that holds the agentflow chip, Copy-ID chip, formatted updated date, and refresh button. Auto-selects the first STOPPED node (or first top-level otherwise) on initial tree build.
  • ExecutionTreeSidebar: @mui/x-tree-view RichTreeView with a custom TreeItem2 slot — per-branch border colored from AGENTFLOW_ICONS, status-icon variants on each row, virtual Iteration #N containers, controlled expand/collapse defaulting to all-expanded.
  • useExecutionTree rewritten to mirror the legacy three-pass buildTreeData: previousNodeIds parent→child with most-recent disambiguation, iteration grouping under the latest parent instance, sub-tree linking inside virtual containers, iterations-first sibling sort, and recursive FLOWISE_CREDENTIAL_ID scrub. Iteration container status is the legacy ERROR > INPROGRESS > all-FINISHED > UNKNOWN rollup.
  • useDrawerWidths + useResizableSidebar({ inverted }) extension drive a resizable ExecutionsViewer Drawer (parity with the legacy left-edge drag handle). Adds a public ExecutionsViewerProps.drawer?: { defaultWidth?, minWidth?, maxWidth? } override.
  • AGENTFLOW_ICONS lifted from atoms/NodeIcon.tsx to core/primitives/agentflowIcons.ts so the tree slot can consume it without re-importing through atoms.
  • ExecutionDetailProps.agentflow?: AgentflowRef seeds the header chip while the detail endpoint loads (server-side getExecutionById doesn't perform the agentflow join — only getAllExecutions does).
  • Adds @mui/x-tree-view as a runtime dep.

Test plan

  • pnpm -C packages/observe test:coverage — 331 tests pass, all coverageThreshold entries met (85.37% statements / 82.98% branches overall; useExecutionTree 96.5% / 85.18%, new useDrawerWidths 100% / 90.9%, ExecutionDetail 89.18% / 92.5%).
  • Manually verify in packages/observe/examples (pnpm dev after copying .env.example to .env):
    • List → row click opens the resizable Drawer; left-edge handle widens/narrows.
    • Tree shows status icons for each row plus rolled-up status on virtual iteration containers; IconLoader spins for INPROGRESS rows.
    • Agentflow chip is clickable and opens the canvas in a new tab when VITE_AGENTFLOW_CANVAS_URL is set; non-clickable otherwise.
    • Copy-ID chip flips inline to Copied! for 2s. Behavior change from legacy: legacy dispatched a Redux/notistack snackbar toast ("ID copied to clipboard") via the host app; the SDK can't assume a snackbar provider exists, so the confirmation is rendered on the chip itself.
    • Refresh button re-fetches; date formatted as MMM d, yyyy h:mm a.
    • Standalone <ExecutionDetail> demo by execution id renders the same surface without the list.

FLOWISE-576

Demo

execution-detail-demo1-clickable-agentflow.mov
execution-detail-demo2-non-clickable-agentflow.mov

… drawer

## Summary

Ports the legacy `ExecutionDetails.jsx` (~984 lines) into the `@flowiseai/observe` SDK as a composable `ExecutionDetail` orchestrator.

- **`ExecutionDetail`**: split-pane (sidebar tree + node detail) with sidebar header that holds the agentflow chip, Copy-ID chip, formatted updated date, and refresh button. Auto-selects the first STOPPED node (or first top-level otherwise) on initial tree build.
- **`ExecutionTreeSidebar`**: `@mui/x-tree-view` `RichTreeView` with a custom `TreeItem2` slot — per-branch border colored from `AGENTFLOW_ICONS`, status-icon variants on each row, virtual `Iteration #N` containers, controlled expand/collapse defaulting to all-expanded.
- **`useExecutionTree`** rewritten to mirror the legacy three-pass `buildTreeData`: `previousNodeIds` parent→child with most-recent disambiguation, iteration grouping under the latest parent instance, sub-tree linking inside virtual containers, iterations-first sibling sort, and recursive `FLOWISE_CREDENTIAL_ID` scrub. Iteration container status is the legacy `ERROR > INPROGRESS > all-FINISHED > UNKNOWN` rollup.
- **`useDrawerWidths`** + `useResizableSidebar({ inverted })` extension drive a resizable `ExecutionsViewer` Drawer (parity with the legacy left-edge drag handle). Adds a public `ExecutionsViewerProps.drawer?: { defaultWidth?, minWidth?, maxWidth? }` override.
- **`AGENTFLOW_ICONS`** lifted from `atoms/NodeIcon.tsx` to `core/primitives/agentflowIcons.ts` so the tree slot can consume it without re-importing through `atoms`.
- **`ExecutionDetailProps.agentflow?: AgentflowRef`** seeds the header chip while the detail endpoint loads (server-side `getExecutionById` doesn't perform the agentflow join — only `getAllExecutions` does).
- Adds `@mui/x-tree-view` as a runtime dep.

## Test plan

- [x] `pnpm -C packages/observe test:coverage` — 331 tests pass, all `coverageThreshold` entries met (85.37% statements / 82.98% branches overall; `useExecutionTree` 96.5% / 85.18%, new `useDrawerWidths` 100% / 90.9%, `ExecutionDetail` 89.18% / 92.5%).
- [x] Manually verify in `packages/observe/examples` (`pnpm dev` after copying `.env.example` to `.env`):
  - List → row click opens the resizable Drawer; left-edge handle widens/narrows.
  - Tree shows status icons for each row plus rolled-up status on virtual iteration containers; `IconLoader` spins for INPROGRESS rows.
  - Agentflow chip is clickable and opens the canvas in a new tab when `VITE_AGENTFLOW_CANVAS_URL` is set; non-clickable otherwise.
  - Copy-ID chip flips inline to `Copied!` for 2s. **Behavior change from legacy**: legacy dispatched a Redux/notistack snackbar toast ("ID copied to clipboard") via the host app; the SDK can't assume a snackbar provider exists, so the confirmation is rendered on the chip itself.
  - Refresh button re-fetches; date formatted as `MMM d, yyyy h:mm a`.
  - Standalone `<ExecutionDetail>` demo by execution id renders the same surface without the list.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces significant enhancements to the observability SDK, including a new ExecutionTreeSidebar component using @mui/x-tree-view, improved tree-building logic in useExecutionTree to support iteration grouping and previous-node parenting, and a resizable drawer for execution details. I have identified several areas for improvement: the ExecutionDetail component needs a unique key in the ExecutionsViewer to prevent state leakage between executions, the 'copied' state reset logic in ExecutionDetail should be moved to a useEffect for safety, the O(N^2) complexity in useExecutionTree should be optimized, and the tree indexing in ExecutionTreeSidebar should be memoized.

Comment thread packages/observe/src/features/executions/hooks/useExecutionTree.ts
Comment thread packages/observe/src/features/executions/components/ExecutionTreeSidebar.tsx Outdated
Comment thread packages/observe/src/features/executions/components/ExecutionTreeSidebar.tsx Outdated
@jocelynlin-wd
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the observability module by introducing a resizable execution detail drawer and a hierarchical tree sidebar utilizing @mui/x-tree-view. The core tree-building logic was refactored to support complex parenting and iteration grouping, and client-side credential redaction was added. Feedback identifies a logic error in the drawer width calculation that could lead to minWidth exceeding maxWidth on small viewports, with a specific suggestion to constrain the minimum width by the maximum width.

Comment thread packages/observe/src/features/executions/hooks/useDrawerWidths.ts Outdated
@jocelynlin-wd
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly refactors the observability features, introducing a more robust execution tree building logic based on previousNodeIds and iteration grouping. It migrates the sidebar to MUI's RichTreeView, adds resizable panels for both the sidebar and the detail drawer, and improves the UI with better status indicators, date formatting, and navigation chips. Feedback was provided to ensure the 'Copied!' state is only triggered upon a successful clipboard operation and to implement proper user-facing error handling for such failures.

Comment thread packages/observe/src/features/executions/components/ExecutionDetail.tsx Outdated
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jocelynlin-wd jocelynlin-wd requested a review from j-sanaa May 1, 2026 15:39
Copy link
Copy Markdown
Contributor

@j-sanaa j-sanaa left a comment

Choose a reason for hiding this comment

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

Tested the changes and everything looks good!

Not sure if Iteration Node is a part of the scope of these changes but the outputs of the child nodes are not being displayed

Image

jocelynlin-wd and others added 2 commits May 1, 2026 15:16
Iteration metadata (parentNodeId/iterationIndex) is nested under `data`
in the runtime payload per IAgentflowExecutedData; the SDK was reading
from the top level so virtual Iteration #N containers never materialized
and iteration children dangled at root. Same shape fix applies to
humanInputAgentflow detection in useNodeData. Iteration parent input
now shows "No data" matching legacy's `data.input.question || '*No
data*'` fallback, and virtual Iteration #N containers are selectable
with empty Input/Output panels.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jocelynlin-wd
Copy link
Copy Markdown
Contributor Author

Not sure if Iteration Node is a part of the scope of these changes but the outputs of the child nodes are not being displayed

Thanks for catching this. Should be fixed now

Screen.Recording.2026-05-01.at.5.20.41.PM.mov

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.

2 participants