Skip to content

feat(frontend): editable revision drawer in /m Registry and Deployments - #8157

Merged
mmabrouk merged 7 commits into
release/v0.128.9from
feat/m-parity-editable-drawer
Nov 6, 2026
Merged

mmabrouk merged 7 commits into
release/v0.128.9from
feat/m-parity-editable-drawer

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Nov 6, 2026

Copy link
Copy Markdown
Member

Context

In /m developer mode, a click on a revision in Registry or on a row in Deployments opened a read-only drawer. You could not edit the prompt, commit it or test it there, and the header said only "Revision" or "Deployment", without the variant name or version. The Deployments drawer could also open on an empty JSON view. /w opens an editable drawer for the same clicks (edit, Commit, Test App, Playground). This closes parity findings apps-arch-01 and apps-registry-05 (decision D3, option 1), and also covers apps-deploy-05 and apps-deploy-07 for developer mode.

Changes

A new drawer in @agenta/playground-ui (panels/drawer, shadcn, no antd) hosts the playground's own ConfigPanel and the host's run pane:

  • Header: kind, variant name and version (for example "Revision default v3"), previous and next, the host's buttons (Open in playground, Deploy, or Revert), and Test app.
  • Body: the editable config with Commit (the shared commit dialog, with "Commit and deploy" to the app's environments) and the details column. Test widens the drawer and shows the run pane beside the config at desktop widths; on a phone a Configuration / Generations switch shows one pane at a time.
  • Closing, or moving to another revision, with unsaved edits asks "Discard unsaved changes?" first.
  • After a commit the drawer shows the new revision. It switches inside the commit, before the commit clears the old draft; switching later made the form show the old text.
  • The drawer opens on Form, so Deployments no longer lands on an empty JSON view. JSON and YAML show the config.

In /m, VariantsTab and DeploymentsTab open this drawer only when beta developer mode is on (betaDeveloperModeActiveAtom). Without it they render the same read-only RevisionDrawerHost as before, with the same buttons. The other read-only drawer users (app overview, evaluations, evaluators) are untouched. The new host (features/revisions/EditableRevisionDrawerHost.tsx) loads with next/dynamic on the first open, so nothing new enters the app shell or the Registry page chunk.

Smaller moves: clearPlayground moved from web/mobile into @agenta/playground-ui/state so the drawer and the playground pages share it, and @agenta/entity-ui/variant now also exports RevisionDetails for the details column.

Props, for the evaluator create flow

EditableRevisionDrawer from @agenta/playground-ui/panels/drawer:

Prop Meaning
revisionId: string | null The revision to show and edit. A saved id, or an unsaved local one (local-*, for example a template copy). null closes it.
kind: "variant" | "deployment" | "evaluator" Sets the title, the Test label ("Test app" / "Test evaluator") and the details rows. An unsaved evaluator is titled "New evaluator".
onClose() Called after the reader confirmed any unsaved edits are lost.
navigationIds?, onNavigate?(id) Previous and next, in list order. onNavigate is called after the same confirmation.
actions?: ReactNode Header buttons. The host owns those writes (Deploy, Revert).
configActions?: ReactNode Buttons on the config bar before Commit (for example Load preset).
renderRuns(revisionId) The test pane. Drawn only while Test is on.
canCommit? (default true), canDeploy? (default false) Permissions. Without canCommit the config is read only.
onCommitted?(fromId, newId) A commit made a new revision, or Create saved a local one. Commit shows Create for a local revision and uses the shared create path.
onRefinePrompt?(revisionId, promptKey) Shows the wand on prompt sections.
defaultTesting? Open with the test pane on. Use it for evaluators, as /w does.

The drawer puts the revision in the playground state while it is open and clears that state on close, so mount it only on a page that has no playground of its own. For the evaluator seam, renderEditor(revisionId, close) can return <EditableRevisionDrawer revisionId={revisionId} kind="evaluator" onClose={close} defaultTesting renderRuns={...} />, with the app picker and run pane inside renderRuns.

Tests

  • editableRevisionDrawer.render.test.tsx: the drawer on the real workflow molecule, commit atoms and playground controller, with only HTTP mocked. It checks the title (name and version), Test showing the run pane, the exact commit request and the switch to the new revision, the discard question on close (Keep editing keeps the edits, Discard clears the playground and sends nothing), and Next.
  • revisionDrawerGate.render.test.tsx: Registry and Deployments open the read-only drawer without beta developer mode and the editable drawer with it.
  • Related suites pass: deployments tab, variants screen and route, revision drawer host, playground revision actions, selection, snapshot, screen and evaluator.
  • Types pass for @agenta/mobile, @agenta/playground-ui, @agenta/entity-ui and @agenta/oss. /w sees no change: it imports neither new module, and the clearPlayground move only changes /m imports.
  • Live check on a local stack: opened, edited, tested (a run returned "Paris"), committed (the API holds the edited prompt and the drawer shows it as the new version), and checked JSON, Deployments, 390 px, and the discard question. /m with Developer Mode off still opens the read-only drawer.

The per-batch checks (speed check, full suites, /w side by side) run on the integration branch.

Based on main (release/v0.128.8 already merged into it), so the diff is only this change.

What to QA

  • Beta developer mode on, Registry: click a revision. The header shows the variant name and version. Edit the prompt, then Commit. The drawer shows the new version with your edit.
  • Same drawer: click Test app. Config and Generations sit side by side at 1440 px. Run a test case.
  • Deployments: click a history row. It opens on Form with the deployed config, with Open in playground and Test app in the header.
  • Edit, then press Escape. "Discard unsaved changes?" shows. Keep editing keeps the text.
  • At 390 px the drawer is full screen, and Test shows a Configuration / Generations switch.
  • Regression: with Developer Mode off (developer views forced on), Registry and Deployments open the old read-only drawer, unchanged.

… in /m beta developer mode

One shadcn drawer in @agenta/playground-ui hosts the playground config and run panels:
edit the config, Commit or Create through the shared commit dialog, Test beside the
config, Open in playground, and the variant name and version in the header. /m opens it
from Registry and Deployments only in beta developer mode; everyone else keeps the
read-only drawer.

Entire-Checkpoint: 01M6R4TBAR5VFEZ250YT4KJEZG
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Added editable revision drawers for variants and deployments in beta developer mode, with revision details, testing panes, and commit options.
    • Added safeguards for unsaved edits, letting you keep editing or discard changes before closing or switching revisions.
    • Committing a revision now opens the newly created revision.
    • Added deployment and playground actions where available, along with clearer revision names and version information.
    • Playground state is preserved when a revision drawer closes or reopens.
  • Tests
    • Added coverage for editing, committing, navigating revisions, and drawer behavior in beta developer mode.

Adds an editable revision drawer for variants and deployments in beta developer mode. The drawer supports testing, committing, revision navigation, and discard confirmation. Its host synchronizes revision selection with the URL and invalidates queries after commits. Tests cover drawer interactions and mode-based selection.

Changes: Editable revision drawer

Layer / File(s) Summary
Drawer contract and playground session
web/packages/agenta-playground-ui/src/panels/drawer/types.ts, web/packages/agenta-playground-ui/src/panels/drawer/useDrawerPlaygroundSession.ts, web/packages/agenta-playground-ui/src/state/*, web/mobile/src/features/playground/use*PlaygroundSelection.ts
Adds drawer prop types and a hook that synchronizes revisions with playground state. Exports clearPlayground from shared state and updates both selection hooks to import it there.
Drawer editing and commit interactions
web/packages/agenta-playground-ui/src/panels/drawer/*, web/packages/agenta-entity-ui/src/variant/index.ts
Adds the editable drawer, body, title, commit button, and discard confirmation. The drawer tracks unsaved edits and handles close and navigation requests. The variant package exports RevisionDetails.
Mobile host and tab integration
web/mobile/src/features/revisions/EditableRevisionDrawerHost.tsx, web/mobile/src/features/variants/VariantsTab.tsx, web/mobile/src/features/variants/DeploymentsTab.tsx
Adds a host that connects the drawer to URL selection, permissions, runs, prompt refinement, and commit handling. Both tabs render it in beta developer mode and retain the read-only drawer otherwise.
Drawer behavior and mode tests
web/mobile/tests/unit/editableRevisionDrawer.render.test.tsx, web/mobile/tests/unit/revisionDrawerGate.render.test.tsx
Adds tests for rendering, committing, keeping or discarding edits, navigation, playground state, and beta-mode drawer selection.

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

Sequence Diagram(s)

sequenceDiagram
  participant VariantsTab
  participant EditableRevisionDrawerHost
  participant EditableRevisionDrawer
  participant DrawerCommitButton
  VariantsTab->>EditableRevisionDrawerHost: Render when beta developer mode is active
  EditableRevisionDrawerHost->>EditableRevisionDrawer: Pass revision, permissions, and callbacks
  EditableRevisionDrawer->>DrawerCommitButton: Render commit control
  DrawerCommitButton->>EditableRevisionDrawerHost: Return committed revision ID
  EditableRevisionDrawerHost->>EditableRevisionDrawerHost: Invalidate queries and select committed revision
Loading

Possibly related PRs

  • Agenta-AI/agenta#8070: Adds clearPlayground, which this change exports and uses for drawer session cleanup.
  • Agenta-AI/agenta#8075: Adds playground actions to revision drawers, which this change passes to both drawer modes.
  • Agenta-AI/agenta#8012: Adds ConfigPanel and usePlaygroundLeaveGuard, which this change uses in the editable drawer.
Merge Risk: Moderate · up to e5f5c

Under specific navigation history, Back can leave the drawer without warning and lose edits. The drawer can also show the wrong revision after a commit, and slow mounts can disrupt its tests. Resolve these risks before merging unless explicitly accepted.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title identifies the editable revision drawer and its Registry and Deployments scope.
Description check Passed The description covers the drawer, beta developer mode gate, related exports, and tests.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 18 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1943f2f and e5f5c59.

Files selected for processing: 2

  • web/mobile/tests/unit/editableRevisionDrawer.render.test.tsx
  • web/packages/agenta-playground-ui/src/panels/drawer/DrawerTitle.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Website preview

Preview URL: https://pr-8157-agenta-website-preview.mahmoud-637.workers.dev

Built from e5f5c59bb6e559362b9e9c07f62905248b012bc3. This comment updates in place on every push.

@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

Nitpick comments: 5

web/packages/agenta-playground-ui/src/panels/drawer/DrawerCommitButton.tsx: 1

10-10: Trivial · Maintainability & Code Quality · Quick win

Use a relative import for the commit modal.

This file lives in @agenta/playground-ui, but it imports a module of the same package by package name (@agenta/playground-ui/commit). The repository rule requires relative imports inside a package. A package-name self-import also depends on the bundler and tsc supporting package self-reference.

The ./commit export maps to ./src/components/CommitVariantChanges/index.ts. Import that path directly.

♻️ Proposed fix

-    import("@agenta/playground-ui/commit").then((m) => ({default: m.CommitVariantChangesModal})),
+    import("../../components/CommitVariantChanges").then((m) => ({
+        default: m.CommitVariantChangesModal,
+    })),

As per coding guidelines: "Inside a package, use relative imports for the package's own files."

Source: Coding guidelines

web/packages/agenta-playground-ui/src/panels/drawer/EditableRevisionDrawer.tsx: 1

63-63: Trivial · Stability & Availability · Quick win

Move the ref writes out of render.

React Doctor reports shownIdRef.current (Line 63) and currentIdRef.current (Line 67) as mutated during render. React can replay or discard a render, so these writes can leak from a render that never commits. shownIdRef then decides which revision the closing sheet draws. currentIdRef decides whether the commit callback calls setCommittedId.

The component already uses the set-state-during-render pattern for committedId. Use the same pattern for the last shown id. Update currentIdRef in an effect.

♻️ Proposed fix

-    const shownIdRef = useRef(revisionId)
-    if (revisionId) shownIdRef.current = revisionId
-    const shownId = committedId ?? shownIdRef.current
+    const [lastId, setLastId] = useState(revisionId)
+    if (revisionId && revisionId !== lastId) setLastId(revisionId)
+    const shownId = committedId ?? revisionId ?? lastId
     if (committedId && revisionId === committedId) setCommittedId(null)
     const currentIdRef = useRef(shownId)
-    currentIdRef.current = shownId
+    useEffect(() => {
+        currentIdRef.current = shownId
+    }, [shownId])

Also applies to: 67-67

Source: Linters/SAST tools

web/packages/agenta-playground-ui/src/panels/drawer/EditableRevisionDrawerBody.tsx: 1

89-89: Trivial · Stability & Availability · Quick win

Avoid writing shownOnceRef.current during render.

React Doctor reports this ref write as a render-phase mutation. A discarded render can leave the ref true. The skeleton guard at Line 74 would then be skipped for a revision that has not rendered yet.

Use state set during render instead. useState is already declared before the early returns, so hook order stays stable.

♻️ Proposed fix

-    const shownOnceRef = useRef(false)
+    const [shownOnce, setShownOnce] = useState(false)
 ...
-    if (!local && query.isPending && !shownOnceRef.current) {
+    if (!local && query.isPending && !shownOnce) {
 ...
-    shownOnceRef.current = true
+    if (!shownOnce) setShownOnce(true)

Remove useRef from the react import if no other use remains.

Source: Linters/SAST tools

web/mobile/src/features/variants/VariantsTab.tsx: 1

39-40: Trivial · Maintainability & Code Quality · Low value

Shorten this comment to one line.

The repository sets a hard limit of one short line per comment. This comment has two lines of prose. Several other new comments in this PR also break the limit. Examples are the 3-line comments in EditableRevisionDrawer.tsx and EditableRevisionDrawerBody.tsx and the 6-line header in editableRevisionDrawer.render.test.tsx.

♻️ Proposed fix

-// Beta developer mode edits the revision in the drawer, as /w does. The read-only drawer stays for
-// everyone else.
+// Beta developer mode only; everyone else keeps the read-only drawer.

As per coding guidelines: "At most ONE short line per comment. No multi-line blocks narrating why in prose".

Source: Coding guidelines

web/mobile/src/features/variants/DeploymentsTab.tsx: 1

36-37: Trivial · Maintainability & Code Quality · Low value

Shorten this comment to one line.

This comment has two lines of prose. The repository allows one short line per comment.

♻️ Proposed fix

-// Beta developer mode edits the revision in the drawer, as /w does. The read-only drawer stays for
-// everyone else.
+// Beta developer mode only; everyone else keeps the read-only drawer.

As per coding guidelines: "At most ONE short line per comment. No multi-line blocks narrating why in prose".

Source: Coding guidelines

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8d75125 and e056a72.

Files selected for processing: 18

  • web/mobile/src/features/playground/useEvaluatorPlaygroundSelection.ts
  • web/mobile/src/features/playground/usePlaygroundSelection.ts
  • web/mobile/src/features/revisions/EditableRevisionDrawerHost.tsx
  • web/mobile/src/features/variants/DeploymentsTab.tsx
  • web/mobile/src/features/variants/VariantsTab.tsx
  • web/mobile/tests/unit/editableRevisionDrawer.render.test.tsx
  • web/mobile/tests/unit/revisionDrawerGate.render.test.tsx
  • web/packages/agenta-entity-ui/src/variant/index.ts
  • web/packages/agenta-playground-ui/src/panels/drawer/DiscardChangesDialog.tsx
  • web/packages/agenta-playground-ui/src/panels/drawer/DrawerCommitButton.tsx
  • web/packages/agenta-playground-ui/src/panels/drawer/DrawerTitle.tsx
  • web/packages/agenta-playground-ui/src/panels/drawer/EditableRevisionDrawer.tsx
  • web/packages/agenta-playground-ui/src/panels/drawer/EditableRevisionDrawerBody.tsx
  • web/packages/agenta-playground-ui/src/panels/drawer/index.ts
  • web/packages/agenta-playground-ui/src/panels/drawer/types.ts
  • web/packages/agenta-playground-ui/src/panels/drawer/useDrawerPlaygroundSession.ts
  • web/packages/agenta-playground-ui/src/state/clearPlayground.ts
  • web/packages/agenta-playground-ui/src/state/index.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Item Value
Status stopped
Commit e5f5c59bb6e559362b9e9c07f62905248b012bc3
Manual expiry (UTC) Not granted
CI deadline (UTC) Not granted
Workflow https://github.com/Agenta-AI/agenta/actions/runs/42220740744

PR closed or converted to draft. Environment absence verified; retained storage requires separate provider accounting.

Post /preview as a new comment to request a one-hour preview. Repeating it while active does not extend the hour.
Preview data is disposable. Expiry is enforced by the next successful cleanup sweep, not an exact timer.
Environment deletion stops its compute. Provider-retained storage and permanent services may still be billed.

Entire-Checkpoint: 01M6R79T4FVWBMMQN1EGEYJH0S
@mmabrouk

mmabrouk commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: CodeRabbit nitpicks, settled:

  • Relative import of the commit modal: not changed. The package lint bans ../**/components imports from src/panels/**, because some of components/ reaches antd. The @agenta/playground-ui/commit subpath is the antd-free entry, and src/components already self-imports by package name the same way.
  • Ref writes during render: fixed. The commit-callback ref is now written in an effect, and the first-load flag is state set in an effect.
  • Comment length: shortened the new comments in VariantsTab, DeploymentsTab and the drawer. The test file headers keep the format the other render tests use.

…rict mode remount

Entire-Checkpoint: 01M6R7M1RBV7H5ZNRZ61ZM2K37

@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

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e056a72 and aeb44ad.

Files selected for processing: 5

  • web/mobile/src/features/variants/DeploymentsTab.tsx
  • web/mobile/src/features/variants/VariantsTab.tsx
  • web/mobile/tests/unit/editableRevisionDrawer.render.test.tsx
  • web/packages/agenta-playground-ui/src/panels/drawer/EditableRevisionDrawer.tsx
  • web/packages/agenta-playground-ui/src/panels/drawer/EditableRevisionDrawerBody.tsx
Files skipped from review as they are similar to previous changes: 2

  • web/mobile/src/features/variants/VariantsTab.tsx
  • web/mobile/src/features/variants/DeploymentsTab.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.

…nd refresh deploy views after Commit and deploy

Entire-Checkpoint: 01M6R9MZ9KYWD1ZSJ6QJCE3SP0
Agenta Product Agent added 3 commits November 6, 2026 13:07
…f written during render

Entire-Checkpoint: 01M6RC84N4J8MFC6506NV7MRCB
…round nodes, so a connected app stays

Entire-Checkpoint: 01M6RDWKPD3AZ0QP3HHXEFR6H6
…New Evaluator in the revision drawer, as /w does

Entire-Checkpoint: 01M6REEQPB326VCRXJS2YRP5G4

@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

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9ec1132 and 1943f2f.

Files selected for processing: 2

  • web/packages/agenta-playground-ui/src/panels/drawer/EditableRevisionDrawer.tsx
  • web/packages/agenta-playground-ui/src/panels/drawer/useDrawerPlaygroundSession.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

@mmabrouk
mmabrouk changed the base branch from main to release/v0.128.9 November 6, 2026 14:16
@mmabrouk
mmabrouk merged commit 24f9042 into release/v0.128.9 Nov 6, 2026
85 of 90 checks passed
@mmabrouk mmabrouk added the lgtm This PR has been approved by a maintainer label Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant