You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(frontend): editable revision drawer in /m Registry and Deployments - #8157
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).
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
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.
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.
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: 5
Check name
Status
Explanation
Title check
The title identifies the editable revision drawer and its Registry and Deployments scope.
Description check
The description covers the drawer, beta developer mode gate, related exports, and tests.
Docstring Coverage
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.
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.
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.
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.
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".
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".
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.
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.
🤖 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.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 0 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ownConfigPaneland the host's run pane:In /m,
VariantsTabandDeploymentsTabopen this drawer only when beta developer mode is on (betaDeveloperModeActiveAtom). Without it they render the same read-onlyRevisionDrawerHostas 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 withnext/dynamicon the first open, so nothing new enters the app shell or the Registry page chunk.Smaller moves:
clearPlaygroundmoved fromweb/mobileinto@agenta/playground-ui/stateso the drawer and the playground pages share it, and@agenta/entity-ui/variantnow also exportsRevisionDetailsfor the details column.Props, for the evaluator create flow
EditableRevisionDrawerfrom@agenta/playground-ui/panels/drawer:revisionId: string | nulllocal-*, for example a template copy).nullcloses it.kind: "variant" | "deployment" | "evaluator"onClose()navigationIds?,onNavigate?(id)onNavigateis called after the same confirmation.actions?: ReactNodeconfigActions?: ReactNoderenderRuns(revisionId)canCommit?(default true),canDeploy?(default false)canCommitthe config is read only.onCommitted?(fromId, newId)onRefinePrompt?(revisionId, promptKey)defaultTesting?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 insiderenderRuns.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.@agenta/mobile,@agenta/playground-ui,@agenta/entity-uiand@agenta/oss. /w sees no change: it imports neither new module, and theclearPlaygroundmove only changes /m imports.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