Skip to content

Fix: The agent version page exported an incorrect DSL format. - #17736

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
cike8899:feat-pipeline-dataset-config
Aug 3, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
cike8899:feat-pipeline-dataset-config

Conversation

@cike8899

@cike8899 cike8899 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix: The agent version page exported an incorrect DSL format.

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 3, 2026
@cike8899
cike8899 requested a review from wangq8 August 3, 2026 09:12
@cike8899 cike8899 added the ci Continue Integration label Aug 3, 2026
@cike8899
cike8899 marked this pull request as draft August 3, 2026 09:12
@cike8899
cike8899 marked this pull request as ready for review August 3, 2026 09:12
@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds shared DSL sanitization and download utilities. Agent JSON export and version download now use the complete DSL, clear sensitive API keys, normalize globals, and use the provided title for the JSON filename.

Changes

DSL Export

Layer / File(s) Summary
DSL sensitive-field sanitization
web/src/pages/agent/utils/clear-sensitive-fields.ts, web/src/pages/agent/utils/clear-sensitive-fields.test.ts
clearSensitiveFields deep-clones DSL data and clears supported API keys. Tests cover Querit variants, aliases, graph structures, immutability, and unrelated tools.
Shared DSL download integration
web/src/pages/agent/utils/download-dsl.ts, web/src/pages/agent/hooks/use-export-json.ts
downloadDsl sanitizes DSL data, normalizes globals, and writes the titled JSON file. The export hook delegates to this helper.
Version dialog full-DSL download
web/src/pages/agent/version-dialog/index.tsx
Version downloads now use the complete agent DSL instead of downloading only the graph.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

I’m a rabbit with a tidy DSL,
Keys are cleared before files fare well.
Globals stand in a normalized row,
Full graphs travel where downloads go.
Hop, hop—safe JSON below!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: correcting the DSL format exported from the agent version page.
Description check ✅ Passed The description includes the required Summary heading and briefly explains that the PR fixes the incorrect DSL format export.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/pages/agent/utils/clear-sensitive-fields.ts`:
- Around line 37-50: Update the sensitive-field sanitization logic in
clear-sensitive-fields.ts to clear data.form.api_key when data.label matches
either Querit operators or any configured apiKeyOperators, including
TavilySearch. In clear-sensitive-fields.test.ts, replace the regression
expectation that preserves the Tavily key with an assertion that the key is
empty.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e1b08e62-39db-4668-8d59-fd392778cebc

📥 Commits

Reviewing files that changed from the base of the PR and between c69a2d4 and 6b4fd73.

📒 Files selected for processing (5)
  • web/src/pages/agent/hooks/use-export-json.ts
  • web/src/pages/agent/utils/clear-sensitive-fields.test.ts
  • web/src/pages/agent/utils/clear-sensitive-fields.ts
  • web/src/pages/agent/utils/download-dsl.ts
  • web/src/pages/agent/version-dialog/index.tsx

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/pages/agent/utils/clear-sensitive-fields.ts`:
- Around line 37-50: Update the sensitive-field sanitization logic in
clear-sensitive-fields.ts to clear data.form.api_key when data.label matches
either Querit operators or any configured apiKeyOperators, including
TavilySearch. In clear-sensitive-fields.test.ts, replace the regression
expectation that preserves the Tavily key with an assertion that the key is
empty.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e1b08e62-39db-4668-8d59-fd392778cebc

📥 Commits

Reviewing files that changed from the base of the PR and between c69a2d4 and 6b4fd73.

📒 Files selected for processing (5)
  • web/src/pages/agent/hooks/use-export-json.ts
  • web/src/pages/agent/utils/clear-sensitive-fields.test.ts
  • web/src/pages/agent/utils/clear-sensitive-fields.ts
  • web/src/pages/agent/utils/download-dsl.ts
  • web/src/pages/agent/version-dialog/index.tsx
🛑 Comments failed to post (1)
web/src/pages/agent/utils/clear-sensitive-fields.ts (1)

37-50: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Sanitize graph-form API keys for all configured operators.

The complete DSL download includes graph. A node with data.label: Operator.TavilySearch retains data.form.api_key, so the downloaded JSON exposes its credential.

  • web/src/pages/agent/utils/clear-sensitive-fields.ts#L37-L50: Match data.label against apiKeyOperators as well as Querit aliases before clearing data.form.api_key.
  • web/src/pages/agent/utils/clear-sensitive-fields.test.ts#L108-L125: Replace the regression test that preserves the Tavily key with an assertion that the key is empty.

As per coding guidelines, “remove tests that protect obsolete behavior.”

📍 Affects 2 files
  • web/src/pages/agent/utils/clear-sensitive-fields.ts#L37-L50 (this comment)
  • web/src/pages/agent/utils/clear-sensitive-fields.test.ts#L108-L125
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/pages/agent/utils/clear-sensitive-fields.ts` around lines 37 - 50,
Update the sensitive-field sanitization logic in clear-sensitive-fields.ts to
clear data.form.api_key when data.label matches either Querit operators or any
configured apiKeyOperators, including TavilySearch. In
clear-sensitive-fields.test.ts, replace the regression expectation that
preserves the Tavily key with an assertion that the key is empty.

Source: Coding guidelines

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice catch and clean refactor. This PR fixes a real bug where the version-history dialog exported only agent.dsl.graph instead of the full canonical DSL.

What was broken

The version dialog was doing:

downloadJsonFile(graph, agent?.title);

This was missing:

  • Sensitive field sanitization (clearSensitiveFields — strips api_key etc.)
  • The globals wrapper that the canvas export path includes
  • Non-graph DSL fields (e.g., components, globals, path)
  • The .json file extension

What the fix does well

  • Extracts downloadDsl as a shared utility → single source of truth for DSL export
  • Moves clear-sensitive-fields from hooks/ to utils/ — more appropriate location
  • Both the canvas export button and the version dialog now produce identical output
  • Clean diff: mostly moves/renames + the new shared function

Minor notes

  • The .test.ts and .ts files in utils/clear-sensitive-fields show 0 additions / 0 deletions — these are pure renames (hooks/ → utils/). This is fine but worth confirming the import paths inside those files are updated (they appear to be export-only utility files, so likely no internal import changes needed).

Verdict

LGTM. The fix is correct, the refactor reduces duplication, and both export paths now emit the same (sanitized) DSL format. Approve.

@wangq8
wangq8 merged commit f116001 into infiniflow:main Aug 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants