Skip to content

Conversation

@xinquiry
Copy link
Collaborator

@xinquiry xinquiry commented Jan 21, 2026

Summary

  • Update publish validation to check graph_config instead of prompt
  • Aligns with the architectural decision to use graph_config as the source of truth for agent configuration
  • Update validation messages across all supported languages (en, ja, zh)

Test plan

  • Create an agent with graph_config and verify publishing works
  • Create an agent without graph_config and verify publish button is disabled
  • Verify tooltip shows correct message when hovering disabled publish button

🤖 Generated with Claude Code

Summary by Sourcery

更新 marketplace 发布流程,将发布前置条件从“需要提示词(prompt)”改为“需要代理图配置(agent graph configuration)”。

Bug Fixes:

  • 当代理缺少图配置时,阻止其发布到 marketplace,并在前端与后端之间统一校验逻辑。

Enhancements:

  • 在发布弹窗中传递图配置,并更新发布按钮的可用状态和提示信息,以体现新的配置要求。
  • 在所有支持的语言(en、ja、zh)中刷新 marketplace 和代理相关的校验文案,将“prompt”统一替换为“configuration”。
Original summary in English

Summary by Sourcery

Update marketplace publishing flow to require an agent graph configuration instead of a prompt as the prerequisite for publishing.

Bug Fixes:

  • Prevent publishing agents to the marketplace when they lack a graph configuration, aligning validation across frontend and backend.

Enhancements:

  • Pass graph configuration through publish modals and update publish button enablement and tooltips to reflect the new requirement.
  • Refresh marketplace and agent-related validation copy across supported locales (en, ja, zh) to refer to configuration instead of prompt.

Update publish validation to check graph_config instead of prompt,
aligning with the architectural decision to use graph_config as
the source of truth for agent configuration.

- Backend: validate graph_config presence before publishing
- Frontend: update canPublish logic and disabled states
- i18n: update validation messages across all languages

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 21, 2026 07:48
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 21, 2026

审阅者指南(在小型 PR 上折叠显示)

审阅者指南

此 PR 将应用市场(marketplace)发布校验从“要求有 agent prompt”切换为“要求有 graph_config”,并在发布弹窗、agent/工作流设置 UI、后端 API 校验以及所有支持语言的本地化文案中串联这一新要求。

需要 graph_config 的应用市场发布流程顺序图

sequenceDiagram
  actor User
  participant AgentSettingsModal
  participant WorkflowEditor
  participant PublishAgentModal
  participant MarketplaceApi

  User->>AgentSettingsModal: Open agent settings
  AgentSettingsModal->>AgentSettingsModal: Check agent.graph_config
  AgentSettingsModal-->>User: Enable or disable publish button

  User->>WorkflowEditor: Open workflow editor
  WorkflowEditor->>WorkflowEditor: Check agentToEdit.graph_config
  WorkflowEditor-->>User: Enable or disable publish button

  User->>AgentSettingsModal: Click publish (enabled)
  AgentSettingsModal->>PublishAgentModal: Open with graphConfig
  User->>PublishAgentModal: Enter commit message and confirm publish
  PublishAgentModal->>PublishAgentModal: Validate commitMessage and graphConfig
  PublishAgentModal->>MarketplaceApi: POST publish_agent
  MarketplaceApi->>MarketplaceApi: Validate agent.graph_config
  MarketplaceApi-->>PublishAgentModal: Success or error
  PublishAgentModal-->>User: Show publish result
Loading

Agent 配置与发布弹窗 props 的类图

classDiagram
  class Agent {
    +string id
    +string name
    +string description
    +string prompt
    +Record_string_unknown graph_config
  }

  class PublishAgentModalProps {
    +boolean open
    +function onOpenChange(isOpen boolean)
    +string agentId
    +string agentName
    +string agentDescription
    +string agentPrompt
    +Record_string_unknown graphConfig
    +Array_McpServer mcpServers
    +KnowledgeSetInfo knowledgeSetInfo
    +boolean isPublished
  }

  class PublishAgentModal {
    +PublishAgentModal(props PublishAgentModalProps)
    -string commitMessage
    -boolean canPublish
  }

  class AgentSettingsModal {
    -Agent agent
    -boolean showPublishModal
  }

  class WorkflowEditor {
    -Agent agentToEdit
    -boolean showPublishModal
  }

  class McpServer {
    +string id
    +string name
    +string description
  }

  class KnowledgeSetInfo {
    +string name
    +number file_count
  }

  AgentSettingsModal --> Agent : uses
  WorkflowEditor --> Agent : edits
  AgentSettingsModal --> PublishAgentModal : opens
  WorkflowEditor --> PublishAgentModal : opens
  PublishAgentModalProps --> PublishAgentModal : configures
  PublishAgentModalProps --> McpServer : contains
  PublishAgentModalProps --> KnowledgeSetInfo : contains
  Agent --> PublishAgentModalProps : graph_config passed as graphConfig
Loading

文件级变更

Change Details Files
在 PublishAgentModal 和相关 UI 流程中,使用 graph_config 而不是 prompt 来决定是否具备发布资格。
  • 扩展 PublishAgentModal 的 props,使其接受可选的 graphConfig,并从调用方进行传递。
  • 修改 canPublish 的计算逻辑,要求同时具备非空的提交信息(commit message)和存在的 graphConfig,而不是 prompt。
  • 更新校验提示的触发条件,在缺少 graphConfig 时触发,并将 i18n key 从 noPrompt 切换为 noConfig。
web/src/components/features/PublishAgentModal.tsx
更新 agent 设置和工作流编辑器中的发布按钮,使其依赖 graph_config,并将其传递到发布弹窗。
  • 将发布按钮的禁用条件改为检查 agent.graph_config / agentToEdit.graph_config,而不是 prompt。
  • 更新按钮标题逻辑,根据 graph_config 是否存在进行分支,同时复用现有的 tooltip key。
  • 将 agent.graph_config / agentToEdit.graph_config 作为 graphConfig 传入 PublishAgentModal。
web/src/components/modals/AgentSettingsModal.tsx
web/src/components/modals/editSession/WorkflowEditor.tsx
将后端应用市场发布校验与 graph_config 要求对齐,并更新错误信息。
  • 将服务器端的发布前校验从检查 agent.prompt 改为检查 agent.graph_config。
  • 将 HTTP 400 错误信息更新为说明:在发布到应用市场之前,agent 必须先拥有配置。
service/app/api/v1/marketplace.py
调整所有支持语言中的本地化字符串,使其在应用市场发布校验中引用“配置”而不是“prompt”。
  • 更新英文 agents 和 marketplace 的本地化条目,使用新的 noConfig key/message。
  • 更新日文 agents 和 marketplace 的本地化条目,使其反映基于配置的校验逻辑。
  • 更新中文 agents 和 marketplace 的本地化条目,使其反映基于配置的校验逻辑。
web/src/i18n/locales/en/agents.json
web/src/i18n/locales/en/marketplace.json
web/src/i18n/locales/ja/agents.json
web/src/i18n/locales/ja/marketplace.json
web/src/i18n/locales/zh/agents.json
web/src/i18n/locales/zh/marketplace.json

技巧与命令

与 Sourcery 交互

  • 触发新的审查: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 在某条审查评论下回复,要求 Sourcery 基于该评论创建一个 issue。你也可以直接回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写上 @sourcery-ai,即可在任意时间生成标题。你也可以在 pull request 上评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文的任意位置写上 @sourcery-ai summary,即可在你希望的位置生成 PR 摘要。你也可以在 pull request 上评论 @sourcery-ai summary 来在任意时间(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 上评论 @sourcery-ai guide,即可在任意时间(重新)生成审阅者指南。
  • 一次性解决所有 Sourcery 评论: 在 pull request 上评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 批量撤销所有 Sourcery 审查: 在 pull request 上评论 @sourcery-ai dismiss,即可撤销所有现有的 Sourcery 审查。特别适用于你想从头开始新的审查——别忘了再评论 @sourcery-ai review 来触发新一轮审查!

自定义你的体验

前往你的控制面板 来:

  • 启用或停用审查功能,例如 Sourcery 生成的 pull request 摘要、审阅者指南等。
  • 更改审查所使用的语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查相关设置。

获得帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR switches marketplace publish validation from requiring an agent prompt to requiring a graph_config, wiring the new requirement through the publish modal, agent/workflow settings UIs, backend API validation, and localized copy in all supported languages.

Sequence diagram for marketplace publish flow requiring graph_config

sequenceDiagram
  actor User
  participant AgentSettingsModal
  participant WorkflowEditor
  participant PublishAgentModal
  participant MarketplaceApi

  User->>AgentSettingsModal: Open agent settings
  AgentSettingsModal->>AgentSettingsModal: Check agent.graph_config
  AgentSettingsModal-->>User: Enable or disable publish button

  User->>WorkflowEditor: Open workflow editor
  WorkflowEditor->>WorkflowEditor: Check agentToEdit.graph_config
  WorkflowEditor-->>User: Enable or disable publish button

  User->>AgentSettingsModal: Click publish (enabled)
  AgentSettingsModal->>PublishAgentModal: Open with graphConfig
  User->>PublishAgentModal: Enter commit message and confirm publish
  PublishAgentModal->>PublishAgentModal: Validate commitMessage and graphConfig
  PublishAgentModal->>MarketplaceApi: POST publish_agent
  MarketplaceApi->>MarketplaceApi: Validate agent.graph_config
  MarketplaceApi-->>PublishAgentModal: Success or error
  PublishAgentModal-->>User: Show publish result
Loading

Class diagram for agent configuration and publish modal props

classDiagram
  class Agent {
    +string id
    +string name
    +string description
    +string prompt
    +Record_string_unknown graph_config
  }

  class PublishAgentModalProps {
    +boolean open
    +function onOpenChange(isOpen boolean)
    +string agentId
    +string agentName
    +string agentDescription
    +string agentPrompt
    +Record_string_unknown graphConfig
    +Array_McpServer mcpServers
    +KnowledgeSetInfo knowledgeSetInfo
    +boolean isPublished
  }

  class PublishAgentModal {
    +PublishAgentModal(props PublishAgentModalProps)
    -string commitMessage
    -boolean canPublish
  }

  class AgentSettingsModal {
    -Agent agent
    -boolean showPublishModal
  }

  class WorkflowEditor {
    -Agent agentToEdit
    -boolean showPublishModal
  }

  class McpServer {
    +string id
    +string name
    +string description
  }

  class KnowledgeSetInfo {
    +string name
    +number file_count
  }

  AgentSettingsModal --> Agent : uses
  WorkflowEditor --> Agent : edits
  AgentSettingsModal --> PublishAgentModal : opens
  WorkflowEditor --> PublishAgentModal : opens
  PublishAgentModalProps --> PublishAgentModal : configures
  PublishAgentModalProps --> McpServer : contains
  PublishAgentModalProps --> KnowledgeSetInfo : contains
  Agent --> PublishAgentModalProps : graph_config passed as graphConfig
Loading

File-Level Changes

Change Details Files
Use graph_config instead of prompt for determining publish eligibility in the PublishAgentModal and related UI flows.
  • Extend PublishAgentModal props to accept an optional graphConfig and pass it through from callers.
  • Change canPublish computation to require a non-empty commit message and presence of graphConfig instead of prompt.
  • Update validation alert condition to trigger when graphConfig is missing and swap the i18n key from noPrompt to noConfig.
web/src/components/features/PublishAgentModal.tsx
Update agent settings and workflow editor publish buttons to depend on graph_config and propagate it into the publish modal.
  • Change publish button disabled condition to check agent.graph_config / agentToEdit.graph_config instead of prompt.
  • Update button title logic to branch on presence of graph_config while reusing existing tooltip keys.
  • Pass agent.graph_config / agentToEdit.graph_config into PublishAgentModal as graphConfig.
web/src/components/modals/AgentSettingsModal.tsx
web/src/components/modals/editSession/WorkflowEditor.tsx
Align backend marketplace publish validation with graph_config requirement and update error messaging.
  • Replace server-side validation check from agent.prompt to agent.graph_config before allowing publish.
  • Update HTTP 400 error message to state that the agent must have a configuration before publishing to the marketplace.
service/app/api/v1/marketplace.py
Adjust localization strings to reference configuration instead of prompt for marketplace publish validation in all supported languages.
  • Update English agents and marketplace locale entries to use the new noConfig key/message.
  • Update Japanese agents and marketplace locale entries to reflect configuration-based validation.
  • Update Chinese agents and marketplace locale entries to reflect configuration-based validation.
web/src/i18n/locales/en/agents.json
web/src/i18n/locales/en/marketplace.json
web/src/i18n/locales/ja/agents.json
web/src/i18n/locales/ja/marketplace.json
web/src/i18n/locales/zh/agents.json
web/src/i18n/locales/zh/marketplace.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
service/app/api/v1/marketplace.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我发现了 1 个问题,并留下了一些总体反馈:

  • PublishAgentModal 中,canPublish 现在变成解析为 graphConfig(一个对象/null),而不再是布尔值,这可能会导致 TypeScript 类型问题,并让逻辑变得不够明确;建议将其强制转换为布尔值(例如:const canPublish = commitMessage.trim().length > 0 && !!graphConfig)。
  • PublishAgentModal 仍然接收并传递 agentPrompt,但在切换到 graphConfig 之后似乎已经不再使用了;建议移除这个 prop 以及相关调用处的连接,以保持接口精简并避免混淆。
  • 前端是通过 graph_config 的真值来判断,而后端则使用 if not agent.graph_config;如果可能存在空配置,建议确认前后端对其的处理保持一致(例如明确检查 null/undefined 与空对象),以避免 UI 和 API 在「是否可发布」上出现不一致。
给 AI Agents 的提示词(Prompt)
Please address the comments from this code review:

## Overall Comments
-`PublishAgentModal` 中,`canPublish` 现在变成解析为 `graphConfig`(一个对象/null),而不再是布尔值,这可能会导致 TypeScript 类型问题,并让逻辑变得不够明确;建议将其强制转换为布尔值(例如:`const canPublish = commitMessage.trim().length > 0 && !!graphConfig`)。
- `PublishAgentModal` 仍然接收并传递 `agentPrompt`,但在切换到 `graphConfig` 之后似乎已经不再使用了;建议移除这个 prop 以及相关调用处的连接,以保持接口精简并避免混淆。
- 前端是通过 `graph_config` 的真值来判断,而后端则使用 `if not agent.graph_config`;如果可能存在空配置,建议确认前后端对其的处理保持一致(例如明确检查 `null`/`undefined` 与空对象),以避免 UI 和 API 在「是否可发布」上出现不一致。

## Individual Comments

### Comment 1
<location> `service/app/api/v1/marketplace.py:141` </location>
<code_context>
         agent = await auth_service.authorize_agent_write(request.agent_id, user_id)

         # Validate that agent has required fields
-        if not agent.prompt:
+        if not agent.graph_config:
             raise HTTPException(
                 status_code=400,
</code_context>

<issue_to_address>
**suggestion (bug_risk):** 明确「配置」的最小要求,以避免出现意外的发布

现在这里只检查 `agent.graph_config` 的真值,因此一个空字典或默认占位内容也可能通过,从而允许发布一个不可用的 agent。建议校验其最小必需结构/字段,或者至少确保配置不是空的。
</issue_to_address>

Sourcery 对开源项目免费 —— 如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请对每条评论点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • In PublishAgentModal, canPublish now resolves to graphConfig (an object/null) rather than a boolean, which can cause TypeScript typing issues and less explicit logic; consider coercing to a boolean (e.g. const canPublish = commitMessage.trim().length > 0 && !!graphConfig).
  • PublishAgentModal still accepts and is passed agentPrompt, but it no longer appears to be used after switching to graphConfig; consider removing this prop and its call-site wiring to keep the interface minimal and avoid confusion.
  • The frontend uses truthiness of graph_config while the backend checks if not agent.graph_config; if an empty config is possible, confirm that both sides treat it consistently (e.g. explicitly checking for null/undefined vs empty object) to avoid mismatched publishability between UI and API.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `PublishAgentModal`, `canPublish` now resolves to `graphConfig` (an object/null) rather than a boolean, which can cause TypeScript typing issues and less explicit logic; consider coercing to a boolean (e.g. `const canPublish = commitMessage.trim().length > 0 && !!graphConfig`).
- `PublishAgentModal` still accepts and is passed `agentPrompt`, but it no longer appears to be used after switching to `graphConfig`; consider removing this prop and its call-site wiring to keep the interface minimal and avoid confusion.
- The frontend uses truthiness of `graph_config` while the backend checks `if not agent.graph_config`; if an empty config is possible, confirm that both sides treat it consistently (e.g. explicitly checking for `null`/`undefined` vs empty object) to avoid mismatched publishability between UI and API.

## Individual Comments

### Comment 1
<location> `service/app/api/v1/marketplace.py:141` </location>
<code_context>
         agent = await auth_service.authorize_agent_write(request.agent_id, user_id)

         # Validate that agent has required fields
-        if not agent.prompt:
+        if not agent.graph_config:
             raise HTTPException(
                 status_code=400,
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Clarify what "configuration" minimally entails to avoid unexpected publishes

This now only checks `agent.graph_config` for truthiness, so an empty dict or default placeholder could pass and allow publishing an unusable agent. Consider validating a minimal required shape/fields or at least enforcing that the config is non-empty.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the marketplace publishing validation to require graph_config instead of prompt, aligning with the architectural decision to use graph_config as the source of truth for agent configuration.

Changes:

  • Updated backend validation to check for graph_config instead of prompt before allowing marketplace publishing
  • Updated frontend UI to disable publish buttons and show appropriate tooltips based on graph_config presence
  • Updated validation messages across all three supported languages (English, Japanese, Chinese)

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
service/app/api/v1/marketplace.py Changed validation from agent.prompt to agent.graph_config and updated error message
web/src/components/modals/editSession/WorkflowEditor.tsx Updated publish button disable logic and tooltip condition, passed graphConfig prop to modal
web/src/components/modals/AgentSettingsModal.tsx Updated publish button disable logic and tooltip condition, passed graphConfig prop to modal
web/src/components/features/PublishAgentModal.tsx Added graphConfig prop, updated validation checks from agentPrompt to graphConfig
web/src/i18n/locales/en/marketplace.json Changed validation message from "must have a prompt" to "must have a configuration"
web/src/i18n/locales/en/agents.json Changed tooltip from "Add a prompt" to "Configure agent"
web/src/i18n/locales/ja/marketplace.json Updated Japanese translation for validation message
web/src/i18n/locales/ja/agents.json Updated Japanese translation for tooltip
web/src/i18n/locales/zh/marketplace.json Updated Chinese translation for validation message
web/src/i18n/locales/zh/agents.json Updated Chinese translation for tooltip

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

className="w-full gap-2 h-10 text-purple-700 border-purple-200 hover:bg-purple-50 dark:text-purple-300 dark:border-purple-800 dark:hover:bg-purple-900/20"
title={
!agent.prompt
!agent.graph_config
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The validation logic here is inconsistent with the backend. In JavaScript, an empty object evaluates to truthy, so agent.graph_config being {} would pass this check. However, the backend validation at service/app/api/v1/marketplace.py:141 uses if not agent.graph_config:, which in Python will reject both None and empty dictionaries. This means the tooltip could show the wrong message for an agent with an empty graph_config object. Consider using a more robust check like agent.graph_config && Object.keys(agent.graph_config).length > 0 to match the backend behavior.

Copilot uses AI. Check for mistakes.
<div className="space-y-6 py-4">
{/* Validation Alert */}
{!agentPrompt && (
{!graphConfig && (
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The validation logic here is inconsistent with the backend. In JavaScript, an empty object evaluates to truthy, so graphConfig being {} would pass this check and hide the validation alert. However, the backend validation at service/app/api/v1/marketplace.py:141 uses if not agent.graph_config:, which in Python will reject both None and empty dictionaries. This means the validation alert could be hidden incorrectly for an agent with an empty graph_config object. Consider using a more robust check like graphConfig && Object.keys(graphConfig).length > 0 to match the backend behavior.

Copilot uses AI. Check for mistakes.
Comment on lines 141 to 145
if not agent.graph_config:
raise HTTPException(
status_code=400,
detail="Agent must have a prompt before publishing to marketplace",
detail="Agent must have a configuration before publishing to marketplace",
)
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

This validation change will break existing tests. The tests in test_marketplace_readme.py and test_marketplace_features.py create agents with only a prompt field but no graph_config. These tests will now fail with a 400 error when attempting to publish. The test data needs to be updated to include graph_config in the AgentCreate objects.

Copilot uses AI. Check for mistakes.
};

const canPublish = commitMessage.trim().length > 0 && agentPrompt;
const canPublish = commitMessage.trim().length > 0 && graphConfig;
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The validation logic here is inconsistent with the backend. In JavaScript, an empty object evaluates to truthy, so graphConfig being {} would pass this check. However, the backend validation at service/app/api/v1/marketplace.py:141 uses if not agent.graph_config:, which in Python will reject both None and empty dictionaries. This means the frontend could enable publishing for an agent with an empty graph_config object, but the backend would reject it with a 400 error. Consider using a more robust check like graphConfig && Object.keys(graphConfig).length > 0 to match the backend behavior.

Suggested change
const canPublish = commitMessage.trim().length > 0 && graphConfig;
const hasGraphConfig =
graphConfig != null && Object.keys(graphConfig).length > 0;
const canPublish = commitMessage.trim().length > 0 && hasGraphConfig;

Copilot uses AI. Check for mistakes.
type="button"
onClick={() => setShowPublishModal(true)}
disabled={!agentToEdit.prompt}
disabled={!agentToEdit.graph_config}
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The validation logic here is inconsistent with the backend. In JavaScript, an empty object evaluates to truthy, so agentToEdit.graph_config being {} would pass this check and enable the publish button. However, the backend validation at service/app/api/v1/marketplace.py:141 uses if not agent.graph_config:, which in Python will reject both None and empty dictionaries. This means the publish button could be enabled for an agent with an empty graph_config object, but the backend would reject it with a 400 error. Consider using a more robust check like agentToEdit.graph_config && Object.keys(agentToEdit.graph_config).length > 0 to match the backend behavior.

Copilot uses AI. Check for mistakes.
className="inline-flex items-center gap-2 rounded-md bg-purple-100 py-2 px-4 text-sm font-medium text-purple-700 hover:bg-purple-200 disabled:opacity-50 disabled:cursor-not-allowed dark:bg-purple-900/30 dark:text-purple-300 dark:hover:bg-purple-900/50 transition-colors"
title={
!agentToEdit.prompt
!agentToEdit.graph_config
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The validation logic here is inconsistent with the backend. In JavaScript, an empty object evaluates to truthy, so agentToEdit.graph_config being {} would pass this check. However, the backend validation at service/app/api/v1/marketplace.py:141 uses if not agent.graph_config:, which in Python will reject both None and empty dictionaries. This means the tooltip could show the wrong message for an agent with an empty graph_config object. Consider using a more robust check like agentToEdit.graph_config && Object.keys(agentToEdit.graph_config).length > 0 to match the backend behavior.

Copilot uses AI. Check for mistakes.
variant="outline"
onClick={() => setShowPublishModal(true)}
disabled={!agent.prompt}
disabled={!agent.graph_config}
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The validation logic here is inconsistent with the backend. In JavaScript, an empty object evaluates to truthy, so agent.graph_config being {} would pass this check and enable the publish button. However, the backend validation at service/app/api/v1/marketplace.py:141 uses if not agent.graph_config:, which in Python will reject both None and empty dictionaries. This means the publish button could be enabled for an agent with an empty graph_config object, but the backend would reject it with a 400 error. Consider using a more robust check like agent.graph_config && Object.keys(agent.graph_config).length > 0 to match the backend behavior.

Copilot uses AI. Check for mistakes.
xinquiry and others added 2 commits January 21, 2026 15:58
- Use explicit boolean coercion and check for non-empty object in frontend
- Add isinstance check in backend for type safety
- Add JSDoc comment clarifying agentPrompt is kept for preview display
- Align frontend/backend behavior for empty objects (JS {} is truthy, Python {} is falsy)

Co-Authored-By: Claude <noreply@anthropic.com>
@Mile-Away Mile-Away merged commit cf31d1e into main Jan 21, 2026
5 of 7 checks passed
@Mile-Away Mile-Away deleted the fix/graph-publish branch January 21, 2026 08:17
Mile-Away pushed a commit that referenced this pull request Jan 21, 2026
## [1.0.1](v1.0.0...v1.0.1) (2026-01-21)

### 🐛 Bug Fixes

* require graph_config for marketplace publishing ([#188](#188)) ([cf31d1e](cf31d1e))
@Mile-Away
Copy link
Contributor

🎉 This PR is included in version 1.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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.

3 participants