Skip to content

feat(studio): add the describe-with-AI job config generation hook - #1021

Merged
steramae-nvidia merged 3 commits into
mainfrom
steramae/dd-ai-generation-hook
Aug 5, 2026
Merged

feat(studio): add the describe-with-AI job config generation hook#1021
steramae-nvidia merged 3 commits into
mainfrom
steramae/dd-ai-generation-hook

Conversation

@steramae-nvidia

@steramae-nvidia steramae-nvidia commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What

useDescribeWithAi drives the generate → validate → repair loop that drafts a Data Designer job config from a plain-language description:

  • calls the model with the existing generateDataDesignerJobRequest tool
  • parses the tool call and normalizes the result
  • runs the draft through validateGeneratedJobRequest, so nothing unloadable can reach the builder
  • when validation reports problems, buildFixMessages replays the original prompt, the draft, and the specific issues back to the model so it can repair its own output

Also drops the Alias "x" now uses "y" instead of the drafted "z" warning from aiSeed. The generation model overrides drafted aliases by design, so that warning fired on essentially every run — and would have sent the new repair loop chasing a non-issue.

Why

PR 2 of 3 in the "Describe with AI" stack. This is all logic and tests, no UI imports, which is why it's separable.

⚠️ The hook is not consumed by anything until PR 3. It's fully tested but technically unused at this commit. Flagging in case you'd rather I squash it into the UI PR.

Stack

  1. steramae/dd-start-selection — contract refactor
  2. → this PR — generation hook
  3. steramae/dd-ai-start-option — the panel, and flipping the tile on

Testing

  • pnpm --filter nemo-studio-ui typecheck — clean
  • pnpm --filter nemo-studio-ui test src/components/CreateFilesetStart src/routes/DataDesignerJobBuildRoute/aiSeed.test.ts — 34 passing

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added AI-assisted generation of Data Designer job configurations from user prompts.
    • Added validation and error feedback for incomplete, malformed, or failed generations.
    • Added the ability to request repairs for invalid drafts while preserving valid content.
    • Added support for displaying pending actions and retaining raw model output.
  • Bug Fixes

    • Improved generation-model handling to avoid unnecessary warnings when the selected model is used.

onContinue took (optionId, templateId?), which could not carry a payload
per option without growing more optional arguments. Replace it with a
StartSelection union so each option's payload travels with its own case.

The Continue footer now renders as soon as an option is picked and
disables itself with a hint, rather than appearing only once the choice
is complete — previously the button materialized with no explanation of
what was missing.

Signed-off-by: Sean Teramae <steramae@nvidia.com>
useDescribeWithAi drives the generate/validate/repair loop for drafting a
Data Designer job config from a plain-language description: it calls the
model with the job-config tool, parses the tool call, and runs the draft
through validateGeneratedJobRequest so nothing unloadable reaches the
builder. When validation reports problems, buildFixMessages replays the
prompt, the draft, and the issues so the model can repair its own output.

The hook is not wired into any UI yet — the Describe with AI panel that
consumes it lands next.

Also drops the "alias now uses X instead of the drafted Y" warning from
aiSeed: the generation model always overrides drafted aliases by design,
so the warning fired on every run and would have made the repair loop
chase a non-issue.

Signed-off-by: Sean Teramae <steramae@nvidia.com>
@steramae-nvidia
steramae-nvidia requested review from a team as code owners July 31, 2026 19:41
@github-actions github-actions Bot added the feat label Jul 31, 2026
Base automatically changed from steramae/dd-start-selection to main August 4, 2026 18:51
Signed-off-by: Sean Teramae <steramae@nvidia.com>
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds useDescribeWithAi for generating and repairing Data Designer job configurations. It builds repair conversations, validates model outputs, tracks request state, and updates model normalization so selected models do not produce substitution warnings.

Changes

AI fileset configuration flow

Layer / File(s) Summary
Repair request construction
web/packages/studio/src/components/CreateFilesetStart/fixRequest.ts
Defines repair input data and builds messages containing the original prompt, draft configuration, validation issues, and correction instructions.
Generation and repair hook
web/packages/studio/src/components/CreateFilesetStart/useDescribeWithAi.ts, web/packages/studio/src/components/CreateFilesetStart/useDescribeWithAi.test.tsx
Adds form validation, AI completion handling, tool-output parsing, configuration validation, request state, error handling, and draft repair actions with test coverage.
Generation model normalization
web/packages/studio/src/routes/DataDesignerJobBuildRoute/aiSeed.ts, web/packages/studio/src/routes/DataDesignerJobBuildRoute/aiSeed.test.ts
Replaces drafted model identifiers with the selected model without adding substitution warnings, while preserving provider fallback behavior.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant useDescribeWithAi
  participant ChatCompletion
  participant DataDesignerValidator
  User->>useDescribeWithAi: submit prompt
  useDescribeWithAi->>ChatCompletion: request tool-required completion
  ChatCompletion-->>useDescribeWithAi: return tool arguments
  useDescribeWithAi->>DataDesignerValidator: sanitize and validate job request
  DataDesignerValidator-->>useDescribeWithAi: return validation result
  useDescribeWithAi-->>User: expose valid config or error state
  User->>useDescribeWithAi: request draft repair
  useDescribeWithAi->>ChatCompletion: send draft and validation issues
Loading

Possibly related PRs

Suggested reviewers: aray12, htolentino-nvidia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary change: adding the Describe-with-AI job configuration generation hook.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch steramae/dd-ai-generation-hook

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: 3

🤖 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/packages/studio/src/components/CreateFilesetStart/useDescribeWithAi.test.tsx`:
- Around line 180-187: Update the “reports which request is in flight” test
around setUp and generate to use a deferred mutateAsync promise; start generate
without awaiting its completion, assert pendingAction is “generate” while the
promise remains unresolved, then resolve the deferred response and assert
pendingAction returns to null after generate completes.

In `@web/packages/studio/src/components/CreateFilesetStart/useDescribeWithAi.ts`:
- Around line 39-48: Update describeWithAiFormSchema.provider to reject empty
values using the existing PROVIDER_REQUIRED_MESSAGE, ensuring runGeneration
receives an explicit provider. Adjust the test setup around the invalid
submission case to provide a non-empty provider where required and preserve
coverage for provider validation.
- Around line 196-210: Update requestFix to return when validation has neither
errors nor warnings, in addition to its existing rawOutput, validation, and
model guards. Only invoke run with buildFixMessages when at least one validation
issue exists, preserving the current handling of invalid errors and warnings.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 39f3c68e-6a0a-498a-a167-85369220c4ed

📥 Commits

Reviewing files that changed from the base of the PR and between 9b7f483 and bd1de85.

📒 Files selected for processing (5)
  • web/packages/studio/src/components/CreateFilesetStart/fixRequest.ts
  • web/packages/studio/src/components/CreateFilesetStart/useDescribeWithAi.test.tsx
  • web/packages/studio/src/components/CreateFilesetStart/useDescribeWithAi.ts
  • web/packages/studio/src/routes/DataDesignerJobBuildRoute/aiSeed.test.ts
  • web/packages/studio/src/routes/DataDesignerJobBuildRoute/aiSeed.ts

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 30743/39237 78.3% 62.7%
Integration Tests 18058/37189 48.6% 21.0%

@steramae-nvidia
steramae-nvidia added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit 071c81c Aug 5, 2026
54 checks passed
@steramae-nvidia
steramae-nvidia deleted the steramae/dd-ai-generation-hook branch August 5, 2026 18:30
gabwow pushed a commit that referenced this pull request Aug 5, 2026
)

* refactor(studio): make the fileset start selection a discriminated union

onContinue took (optionId, templateId?), which could not carry a payload
per option without growing more optional arguments. Replace it with a
StartSelection union so each option's payload travels with its own case.

The Continue footer now renders as soon as an option is picked and
disables itself with a hint, rather than appearing only once the choice
is complete — previously the button materialized with no explanation of
what was missing.

Signed-off-by: Sean Teramae <steramae@nvidia.com>

* feat(studio): add the describe-with-AI job config generation hook

useDescribeWithAi drives the generate/validate/repair loop for drafting a
Data Designer job config from a plain-language description: it calls the
model with the job-config tool, parses the tool call, and runs the draft
through validateGeneratedJobRequest so nothing unloadable reaches the
builder. When validation reports problems, buildFixMessages replays the
prompt, the draft, and the issues so the model can repair its own output.

The hook is not wired into any UI yet — the Describe with AI panel that
consumes it lands next.

Also drops the "alias now uses X instead of the drafted Y" warning from
aiSeed: the generation model always overrides drafted aliases by design,
so the warning fired on every run and would have made the repair loop
chase a non-issue.

Signed-off-by: Sean Teramae <steramae@nvidia.com>

---------

Signed-off-by: Sean Teramae <steramae@nvidia.com>
Signed-off-by: Aaron Gabow <agabow@nvidia.com>
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.

2 participants