-
Notifications
You must be signed in to change notification settings - Fork 4
fix: require graph_config for marketplace publishing #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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>
审阅者指南(在小型 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
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
文件级变更
技巧与命令与 Sourcery 交互
自定义你的体验前往你的控制面板 来:
获得帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideThis 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_configsequenceDiagram
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
Class diagram for agent configuration and publish modal propsclassDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this 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>帮我变得更有用!请对每条评论点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English
Hey - I've found 1 issue, and left some high level feedback:
- In
PublishAgentModal,canPublishnow resolves tographConfig(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). PublishAgentModalstill accepts and is passedagentPrompt, but it no longer appears to be used after switching tographConfig; consider removing this prop and its call-site wiring to keep the interface minimal and avoid confusion.- The frontend uses truthiness of
graph_configwhile the backend checksif not agent.graph_config; if an empty config is possible, confirm that both sides treat it consistently (e.g. explicitly checking fornull/undefinedvs 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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this 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_configinstead ofpromptbefore allowing marketplace publishing - Updated frontend UI to disable publish buttons and show appropriate tooltips based on
graph_configpresence - 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 |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
| <div className="space-y-6 py-4"> | ||
| {/* Validation Alert */} | ||
| {!agentPrompt && ( | ||
| {!graphConfig && ( |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
service/app/api/v1/marketplace.py
Outdated
| 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", | ||
| ) |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
| }; | ||
|
|
||
| const canPublish = commitMessage.trim().length > 0 && agentPrompt; | ||
| const canPublish = commitMessage.trim().length > 0 && graphConfig; |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
| const canPublish = commitMessage.trim().length > 0 && graphConfig; | |
| const hasGraphConfig = | |
| graphConfig != null && Object.keys(graphConfig).length > 0; | |
| const canPublish = commitMessage.trim().length > 0 && hasGraphConfig; |
| type="button" | ||
| onClick={() => setShowPublishModal(true)} | ||
| disabled={!agentToEdit.prompt} | ||
| disabled={!agentToEdit.graph_config} |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
| 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 |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
| variant="outline" | ||
| onClick={() => setShowPublishModal(true)} | ||
| disabled={!agent.prompt} | ||
| disabled={!agent.graph_config} |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
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.
- 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>
## [1.0.1](v1.0.0...v1.0.1) (2026-01-21) ### 🐛 Bug Fixes * require graph_config for marketplace publishing ([#188](#188)) ([cf31d1e](cf31d1e))
|
🎉 This PR is included in version 1.0.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
graph_configinstead ofpromptgraph_configas the source of truth for agent configurationTest plan
🤖 Generated with Claude Code
Summary by Sourcery
更新 marketplace 发布流程,将发布前置条件从“需要提示词(prompt)”改为“需要代理图配置(agent graph configuration)”。
Bug Fixes:
Enhancements:
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:
Enhancements: