Skip to content

[DASHBOARDS] chat agent improvements + new validation layer#17722

Merged
FelixMalfait merged 41 commits intomainfrom
dashboards-chat-agent-improvements
Feb 10, 2026
Merged

[DASHBOARDS] chat agent improvements + new validation layer#17722
FelixMalfait merged 41 commits intomainfrom
dashboards-chat-agent-improvements

Conversation

@ehconitin
Copy link
Contributor

CleanShot.2026-02-05.at.00.24.04.mp4
CleanShot.2026-02-05.at.00.27.54.mp4

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:2063

This environment will automatically shut down when the PR is closed or after 5 hours.

@ehconitin ehconitin marked this pull request as ready for review February 5, 2026 07:52
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 21 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/twenty-server/src/modules/dashboard/tools/utils/resolve-group-by.util.ts">

<violation number="1" location="packages/twenty-server/src/modules/dashboard/tools/utils/resolve-group-by.util.ts:182">
P2: The relation fallback warns that it is defaulting to "${field.name}Id", but the returned subFieldName is undefined, so no default is applied. Either set the subFieldName to the id field or adjust the warning to match the actual behavior to avoid misleading output and incorrect grouping.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 5, 2026

Greptile Overview

Greptile Summary

This PR improves the dashboards chat agent by (1) enriching the AI browsing context on record pages with pageLayoutId and activeTabId, (2) expanding dashboard tool capabilities with a new add_dashboard_tab tool, and (3) making dashboard retrieval more agent-friendly by enriching graph widget configurations with metadata-derived _resolved labels/paths.

On the server side it also adds real validation for chart widget field references in PageLayoutWidgetService (using cached flat metadata maps) and transforms rich text bodies through the RichTextV2 transformer, with integration tests/snapshots updated accordingly. These changes fit the existing architecture by leveraging the flat entity maps cache and keeping dashboard operations within the existing tool-provider/dashboard-tools module.

Confidence Score: 4/5

  • This PR is close to merge-ready, with one functional issue in get_dashboard enrichment logic and a test robustness gap.
  • Core changes (browsing context enrichment chart field validation, new tool wiring) are coherent and covered by updated integration tests, but get_dashboard currently enriches configs based only on presence of configurationType rather than widget type, which can produce incorrect outputs for non-graph widgets. The new unit test also lacks dependency call assertions, reducing regression protection.
  • packages/twenty-server/src/modules/dashboard/tools/get-dashboard.tool.ts; packages/twenty-server/src/modules/dashboard/tools/tests/get-dashboard.tool.spec.ts

Important Files Changed

Filename Overview
packages/twenty-front/src/modules/ai/hooks/useBrowsingContext.ts Enriches recordPage browsing context with pageLayoutId and activeTabId pulled from record store and tab-list state.
packages/twenty-server/src/engine/metadata-modules/ai/ai-chat/services/chat-execution.service.ts Adds pageLayoutId/activeTabId to record-page context string when present.
packages/twenty-server/src/engine/metadata-modules/page-layout-widget/services/page-layout-widget.service.ts Adds rich text body transformation and server-side validation of chart field references on create/update.
packages/twenty-server/src/engine/metadata-modules/page-layout-widget/utils/validate-chart-configuration-field-references.util.ts Adds validation for aggregate/group-by field references against metadata maps and widget type.
packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/skill-metadata/create-standard-flat-skill-metadata.util.ts Updates dashboard skill prompt text with clearer graph workflow and subfield rules.
packages/twenty-server/src/modules/dashboard/tools/tests/get-dashboard.tool.spec.ts Adds test for get_dashboard configuration enrichment, but misses dependency call assertions.
packages/twenty-server/src/modules/dashboard/tools/add-dashboard-tab.tool.ts Introduces add_dashboard_tab tool to create a new page layout tab for a dashboard.
packages/twenty-server/src/modules/dashboard/tools/get-dashboard.tool.ts Enhances get_dashboard output by adding _resolved field metadata for graph configs; currently not gated by widget type.
packages/twenty-server/src/modules/dashboard/tools/schemas/widget.schema.ts Improves tool schema docs for subFieldName usage and rich text body fields.
packages/twenty-server/src/modules/dashboard/tools/utils/build-resolved-group-by.util.ts Adds helper to compute resolved group-by display info from metadata for get_dashboard enrichment.

Sequence Diagram

sequenceDiagram
  participant U as User
  participant FE as twenty-front (useGetBrowsingContext)
  participant AI as ChatExecutionService
  participant Tools as Dashboard Tools
  participant Cache as FlatEntityMapsCacheService
  participant PL as PageLayoutService
  participant W as PageLayoutWidgetService

  U->>FE: Navigate record page / dashboards
  FE->>FE: Read selectedRecordId + pageLayoutId
  FE->>FE: Read activeTabId for tab list instance
  FE-->>AI: BrowsingContext(recordId, pageLayoutId?, activeTabId?)

  AI->>AI: buildRecordPageContext(..., pageLayoutId?, activeTabId?)
  AI-->>Tools: Agent chooses get_dashboard / add_dashboard_tab / update_dashboard_widget

  Tools->>Cache: getOrRecomputeManyOrAllFlatEntityMaps(flatFieldMetadataMaps)
  Tools->>PL: findByIdOrThrow(pageLayoutId)
  PL-->>Tools: tabs + widgets + raw configuration
  Tools->>Tools: Enrich graph widget config with _resolved (labels/paths)
  Tools-->>AI: Dashboard layout response

  AI->>W: create/update widget (rich text or graph)
  W->>Cache: getOrRecomputeManyOrAllFlatEntityMaps(fields + objects)
  W->>W: validateChartConfigurationFieldReferences()
  W-->>AI: success / INVALID_PAGE_LAYOUT_WIDGET_DATA
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 4 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/twenty-server/src/modules/dashboard/tools/update-dashboard-widget.tool.ts">

<violation number="1" location="packages/twenty-server/src/modules/dashboard/tools/update-dashboard-widget.tool.ts:60">
P2: Type-only updates can bypass GRAPH configuration validation. Include `parameters.type` in the validation gate so switching to GRAPH triggers the required configuration check.</violation>
</file>

<file name="packages/twenty-server/src/modules/dashboard/tools/create-complete-dashboard.tool.ts">

<violation number="1" location="packages/twenty-server/src/modules/dashboard/tools/create-complete-dashboard.tool.ts:140">
P2: GRAPH widgets can still accept non-graph configuration types (e.g., IFRAME) because the new validation returns early for non-graph configurationType. This allows invalid GRAPH widgets to be created even after the added checks. Add an explicit check that GRAPH widgets must use one of the graph configuration types (or extend validateGraphWidgetConfiguration to error when widgetType is GRAPH and configurationType isn’t a graph type).</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@charlesBochet
Copy link
Member

@ehconitin sorry about that, we have merge a bit PR today, could you fix conflicts and CI?

Copy link
Member

@FelixMalfait FelixMalfait left a comment

Choose a reason for hiding this comment

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

Great work

@FelixMalfait FelixMalfait added this pull request to the merge queue Feb 10, 2026
Merged via the queue into main with commit e995e84 Feb 10, 2026
75 checks passed
@FelixMalfait FelixMalfait deleted the dashboards-chat-agent-improvements branch February 10, 2026 14:00
@github-actions
Copy link
Contributor

Fails
🚫

node failed.

Log

Details
�[31mError: �[39m SyntaxError: Unexpected token 'C', "Contributo"... is not valid JSON
    at JSON.parse (<anonymous>)
�[90m    at parseJSONFromBytes (node:internal/deps/undici/undici:4259:19)�[39m
�[90m    at successSteps (node:internal/deps/undici/undici:6882:27)�[39m
�[90m    at readAllBytes (node:internal/deps/undici/undici:5807:13)�[39m
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)�[39m
danger-results://tmp/danger-results-3e15a3a7.json

Generated by 🚫 dangerJS against 9bc5c89

@twenty-eng-sync
Copy link

Hey @ehconitin! After you've done the QA of your Pull Request, you can mark it as done here. Thank you!

1 similar comment
@twenty-eng-sync
Copy link

Hey @ehconitin! After you've done the QA of your Pull Request, you can mark it as done here. Thank you!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants