SIGN IN SIGN UP

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

0 0 73 Python

fix(frontend/builder): open publish dialog scoped to current agent (#13140)

### Why / What / How

**Why:** Clicking **Publish** from the builder opened the generic
publish flow with the agent picker — even though the builder already
knows the agent the user is editing. Users had to re-pick the same agent
before reaching the listing form.
([SECRT-2361](https://linear.app/autogpt/issue/SECRT-2361))

**What:** Pre-scope the publish dialog to the current agent (`graphID` +
`graphVersion`) and skip the picker step when launched from the builder.
Library and Dashboard entry points still open with the picker as before.

**How:** The `PublishAgentModal` already supports a scoped mode —
Library uses it today by opening at `step: "info"` with
`preSelectedAgentId` + `preSelectedAgentVersion`. The builder simply
wasn't passing the version through and was opening at `step: "select"`.
Threaded `flowVersion` through `BuilderActions → PublishToMarketplace →
usePublishToMarketplace`, and opened the modal at the listing step. As a
defensive fix in `usePublishAgentModal.handleBack`, scoped opens (any
caller passing `preSelectedAgentId`) now close the modal on Back instead
of surfacing the picker the caller intentionally skipped — this also
fixes the same latent issue in the Library entry point.

### Changes 🏗️

- `BuilderActions.tsx` — read `flowVersion` from `useQueryStates` and
pass it to `PublishToMarketplace`.
- `PublishToMarketplace.tsx` — accept `flowVersion`, forward to the
hook, pass `preSelectedAgentVersion` to the modal, disable the trigger
if either id or version is missing. Switched to a function declaration
with `interface Props`.
- `usePublishToMarketplace.ts` — guard on both `flowID` and
`flowVersion`; open the modal at `step: "info"` instead of `"select"`.
- `usePublishAgentModal.ts` — in `handleBack`, when `step === "info"`
and `preSelectedAgentId` is set, call `handleClose()` instead of
returning to the picker.
- New integration test:
`PublishToMarketplace/__tests__/PublishToMarketplace.test.tsx` (Vitest +
RTL + MSW).

No backend changes.

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [ ] I have tested my changes according to the test plan:
- [ ] From the builder, click **Publish** → the listing form opens
pre-filled with the current agent (no picker shown).
- [ ] Click **Back** from the listing form (scoped open) → modal closes
(does not surface picker).
- [ ] From **Library** → publish an agent → still opens scoped on that
agent; Back closes.
- [ ] From **Dashboard / Become a Creator** → publish → picker still
shows; selecting an agent advances to the listing step as before.
- [ ] Submit a listing end-to-end from the builder entry point → review
step renders.
- [ ] Open builder URL without `flowVersion` query param → Publish
button is disabled.
- [ ] New integration test passes: `pnpm test:unit
src/app/\(platform\)/build/components/BuilderActions/components/PublishToMarketplace/__tests__/PublishToMarketplace.test.tsx`
A
Abhimanyu Yadav committed
5b1317f0f8f593a2c471ef3b2cd104437a62d480
Parent: 2e3750b
Committed by GitHub <noreply@github.com> on 5/18/2026, 7:50:59 AM