Skip to content

[fix] Forward className in Editor noProvider mode and remove CSS workarounds#4555

Draft
mmabrouk wants to merge 2 commits into
fix/playground-message-view-modefrom
fix/editor-noprovider-classname
Draft

[fix] Forward className in Editor noProvider mode and remove CSS workarounds#4555
mmabrouk wants to merge 2 commits into
fix/playground-message-view-modefrom
fix/editor-noprovider-classname

Conversation

@mmabrouk
Copy link
Copy Markdown
Member

@mmabrouk mmabrouk commented Jun 5, 2026

Stacked on #4554.

Context

The shared Editor (@agenta/ui) silently dropped className / editorClassName whenever it was rendered with noProvider. The provider path applied the class to .agenta-rich-text-editor, but the noProvider path rendered EditorInner directly and never forwarded the class, and EditorInner didn't apply one either. Since ChatMessageEditor and several other editors use noProvider, any styling passed through editorClassName was a no-op. That is why the message-text alignment in #4554 had to be done with a global CSS workaround.

Changes

  • Fix the forward. Editor now passes className to EditorInner in noProvider mode, and EditorInner applies it to its container div. Provider mode is unchanged (it still lands on .agenta-rich-text-editor, and EditorInner gets no className there, so there's no double application).

With the prop working, the call sites that worked around the drop are cleaned up:

  • ChatMessageEditor: message text + placeholder alignment now goes through editorClassName ([&_.editor-input:not(.code-only)]:px-2, [&_.editor-placeholder]:left-2). globals.css keeps only the antd role-button override, which can't go through the editor prop.
  • VariableControlAdapter: removed editorClassName={className} in the rich-text branch. That class is a container/cell-strip style (*:!border-none px-3); the file already documents it must stay off the editor (it strips the editor's border and gutter). It remains applied to the container only.
  • GenerationComparisonChatOutput: pad the editor body via editorClassName: "!p-3" instead of the [&_.agenta-editor-wrapper]:!p-3 container hack (which would otherwise double-pad now that the prop works).

Behavior change to be aware of

Two preview surfaces passed editorClassName font-size classes that were dead until now and will start applying (this is the intended styling, previously broken by the bug):

  • Eval run chat messages (renderChatMessages): !text-xs
  • Online-evaluation prompt preview (PromptPreview): !text-sm

Tests

  • tsc --noEmit passes for @agenta/ui and @agenta/playground-ui.
  • Prettier and ESLint pass on the changed files.
  • Manual QA pending (see PR discussion / QA checklist).

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 5, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 5, 2026 12:28pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 33fcfe20-d15a-4294-bc8d-fb37ff2976f3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/editor-noprovider-classname

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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Railway Preview Environment

Image tag pr-4555-0dac8b9
Status Failed
Railway logs Open logs
Logs View workflow run
Updated at 2026-06-05T09:47:56.990Z

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/packages/agenta-playground-ui/src/components/ExecutionItemComparisonView/GenerationComparisonChatOutput/index.tsx (1)

203-210: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Inconsistent styling approach: container hack still present.

The ChatTurnView at line 205 still uses the container selector hack [&_.agenta-editor-wrapper]:!p-3 alongside editorClassName: "!p-3" at line 206. This is inconsistent with the TurnMessageAdapter change above (lines 153-158), which removed the container hack and uses only editorClassName.

For consistency and to avoid potential double-padding or override conflicts, consider applying the same refactor here: remove [&_.agenta-editor-wrapper]:!p-3 from the className and rely solely on editorClassName: "!p-3".

♻️ Proposed fix to remove the container hack
                         className:
-                            "!p-0 [&_.agenta-editor-wrapper]:!p-3 !mt-0 [&:nth-child(1)]:!mt-0 mt-2",
+                            "!p-0 !mt-0 [&:nth-child(1)]:!mt-0 mt-2",
                         editorClassName: "!p-3",

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fb310ad8-c181-48e1-9351-54e0be6b445b

📥 Commits

Reviewing files that changed from the base of the PR and between a8529a4 and 28c478f.

📒 Files selected for processing (5)
  • web/oss/src/styles/globals.css
  • web/packages/agenta-playground-ui/src/components/ExecutionItemComparisonView/GenerationComparisonChatOutput/index.tsx
  • web/packages/agenta-playground-ui/src/components/adapters/VariableControlAdapter.tsx
  • web/packages/agenta-ui/src/ChatMessage/components/ChatMessageEditor.tsx
  • web/packages/agenta-ui/src/Editor/Editor.tsx

mmabrouk added 2 commits June 5, 2026 14:26
…up workarounds

The shared Editor dropped `className`/`editorClassName` when rendered with
`noProvider` (it only applied the class on the EditorProvider path). Forward
it to EditorInner and apply it to the editor container in that mode too.

With the prop working, clean up the call sites that relied on the drop:
- ChatMessageEditor: move the message text/placeholder alignment from the
  globals.css workaround to editorClassName; globals.css now only carries the
  antd role-button override that cannot go through the prop.
- VariableControlAdapter: stop forwarding the generation-row container class as
  editorClassName (it is a container/cell-strip style that would strip the
  editor's border and gutter); it stays on the container only.
- GenerationComparisonChatOutput: pad the editor body via editorClassName
  instead of the [&_.agenta-editor-wrapper] container hack.
…l padding

The comparison view renders messages with their own editor padding (!p-3
cells). The role-alignment inset added by ChatMessageEditor stacked on top of
that, over-padding the message text, and the assistant output cell also
double-padded (the [&_.agenta-editor-wrapper]:!p-3 hack plus editorClassName).

Add an alignTextWithRole prop (default true) to ChatMessageEditor; the
comparison view passes false so the inset and role pin are skipped there.
Remove the leftover wrapper-padding hack so the comparison cells pad the editor
once, via editorClassName.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend Improvement size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant