Skip to content

feat(agent): keep the agent id on import and report an existing agent - #495

Open
yileicn wants to merge 1 commit into
SciSharp:mainfrom
yileicn:features/agent-import-keep-id
Open

yileicn wants to merge 1 commit into
SciSharp:mainfrom
yileicn:features/agent-import-keep-id

Conversation

@yileicn

@yileicn yileicn commented Nov 3, 2026

Copy link
Copy Markdown
Member

Send the exported id when importing so the agent keeps it, and show that the agent already exists when the backend answers 409.

Send the exported id when importing so the agent keeps it, and show that
the agent already exists when the backend answers 409.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qodo-code-review

qodo-code-review Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider

Sorry, something went wrong

We weren't able to complete the code review on our side. Please try again manually by commenting /agentic_review on this PR.

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Preserve agent IDs on import and explain duplicate-agent conflicts

✨ Enhancement 🕐 Less than 10 minutes

Grey Divider

AI Description

• Send the exported agent ID when creating an imported agent so its identity is preserved.
• Show the agent’s name and ID when the backend reports a duplicate.
Diagram

graph TD
  File["Exported JSON"] --> Import["Import handler"] --> Create["Create API"]
  Create -->|success| Save["Save details"] --> Page["Agent page"]
  Create -->|409| Error["Existing agent modal"]
  Import -->|other error| Error
  Save -->|error| Error
Loading
High-Level Assessment

Keep the existing create-then-save import flow and rely on the backend’s 409 response for duplicate detection. A client-side lookup would add a request without preventing conflicts between lookup and creation.

Files changed (1) +11 / -4

Enhancement (1) +11 / -4
+page.sveltePreserve imported IDs and identify duplicate agents +11/-4

Preserve imported IDs and identify duplicate agents

• Includes the exported ID in the agent creation request. Retains parsed export data for error handling and displays the agent name and ID when the backend returns 409, while preserving the generic message for other failures.

src/routes/page/agent/+page.svelte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant