Skip to content

feat(workflow): advanced debug mode with breakpoints and variable watch#6446

Open
stakeswky wants to merge 3 commits intolabring:mainfrom
stakeswky:feat/advanced-debug-mode
Open

feat(workflow): advanced debug mode with breakpoints and variable watch#6446
stakeswky wants to merge 3 commits intolabring:mainfrom
stakeswky:feat/advanced-debug-mode

Conversation

@stakeswky
Copy link
Contributor

What does this PR do?

Implements the Advanced Debug Mode feature from the project roadmap — adds breakpoint support, run-to-breakpoint execution, and a variables watch panel to the workflow editor debug experience.

Changes

Breakpoints

  • hasBreakpoint field added to FlowNodeItemType zod schema
  • Toggle via menu: Right-click any node → "Set Breakpoint" / "Remove Breakpoint"
  • Visual indicator: Red dot on the top-left corner of nodes with breakpoints

Run to Breakpoint

  • onRunToBreakpoint in WorkflowDebugContext: auto-advances step-by-step execution, stopping when the next entry node has a breakpoint
  • "Continue" button added alongside "Next Step" in the debug result panel
  • Safety limit of 100 iterations to prevent infinite loops

Variables Watch Panel

  • debugVariables state tracks current workflow variables throughout the debug session
  • Watch panel rendered at the bottom of the debug result card
  • Shows all variable key-value pairs in monospace formatting
  • Cleared when debug session stops

i18n

  • Added keys for zh-CN, en, zh-Hant:
    • debug.Set breakpoint / debug.Remove breakpoint / debug.Breakpoint
    • debug.Continue / debug.Run to breakpoint
    • debug.Variables watch

How it works

The existing debug mode uses a step-by-step API pattern:

  1. Frontend sends postWorkflowDebug → backend runs entry nodes → returns next entryNodeIds
  2. User clicks "Next Step" to advance

This PR adds:

  • Breakpoints: purely frontend — nodes are marked with hasBreakpoint, checked before each step
  • Continue: loops onNextNodeDebug automatically, checking after each step if the next entry node has a breakpoint
  • Variables: captured from newVariables in each debug response, displayed in real-time

Files Changed (7 files, +186/-16)

File Change
packages/global/core/workflow/type/node.ts Add hasBreakpoint to schema
packages/web/i18n/{en,zh-CN,zh-Hant}/workflow.json i18n keys
NodeCard.tsx Breakpoint menu item + red dot indicator
NodeDebugResponse.tsx Continue button + variables watch panel
workflowDebugContext.tsx onRunToBreakpoint + debugVariables state

Testing

  • Lint and format checks pass (lint-staged)
  • No backend changes — breakpoints are frontend-only, leveraging existing step-by-step debug protocol
  • Compatible with existing debug workflow (Next Step still works as before)

- Add NodeLogItemType (time/level/message/data) to runtime types
- Instrument workflow dispatcher with lifecycle logs:
  - Node start (name, type)
  - Params resolved (keys)
  - Dispatch callback (catch error, edge count)
  - Execution finished (duration, error status)
  - Error responses
- Attach nodeLogs to DispatchNodeResponseType and debug responses
- Add nodeLogs to FlowNodeItemType debugResult schema
- Render node logs in WholeResponseModal (chat response detail)
- Render node logs in NodeDebugResponse (workflow debug panel)
- Pass nodeLogs through workflowDebugContext
- Add i18n keys for zh-CN, en, zh-Hant

Closes: workflow node log feature from README roadmap
… watch

- Add breakpoint support on workflow nodes:
  - hasBreakpoint field in FlowNodeItemType schema
  - Toggle breakpoint via node right-click menu
  - Red dot visual indicator on nodes with breakpoints
- Add run-to-breakpoint functionality:
  - onRunToBreakpoint in debug context auto-advances execution
  - Stops when next entry node has a breakpoint set
  - 'Continue' button alongside existing 'Next Step' in debug panel
- Add variables watch panel:
  - debugVariables state tracks current workflow variables during debug
  - Variables panel rendered in debug result card
  - Shows all variable key-value pairs with monospace formatting
- Add i18n keys for zh-CN, en, zh-Hant

Part of: Advanced workflow debug mode from README roadmap
@github-actions
Copy link

github-actions bot commented Feb 17, 2026

Preview sandbox Image:

registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pr:fatsgpt_sandbox_16bfae5582aa7340ea378a940319e98f54947b80

@github-actions
Copy link

github-actions bot commented Feb 17, 2026

Preview mcp_server Image:

registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pr:fatsgpt_mcp_server_16bfae5582aa7340ea378a940319e98f54947b80

@github-actions
Copy link

Preview fastgpt Image:

registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pr:fatsgpt_16bfae5582aa7340ea378a940319e98f54947b80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant