fix agent delete#466
Conversation
PR Summary by QodoAdd delete options payload to agent deletion request Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. Nested delete options body
|
| * @param {import('$agentTypes').AgentDeleteOptions | null} options | ||
| */ | ||
| export async function deleteAgent(agentId) { | ||
| export async function deleteAgent(agentId, options = null) { | ||
| let url = endpoints.agentDetailUrl.replace("{id}", agentId); | ||
| await axios.delete(url); | ||
| await axios.delete(url, { data: options ? { options } : {} }); |
There was a problem hiding this comment.
1. Nested delete options body 🐞 Bug ≡ Correctness
deleteAgent() sends the provided delete flags as a nested body { options: AgentDeleteOptions },
not as the AgentDeleteOptions object itself, which is inconsistent with other DELETE requests in
this repo that place request fields directly under data. If the backend expects top-level
delete_role_agents/delete_user_agents fields, the flags will be ignored and deletion behavior
will be wrong.
Agent Prompt
### Issue description
`deleteAgent()` currently wraps the passed `AgentDeleteOptions` object under an extra `options` key in the DELETE request body (`{ data: { options } }`). This makes the wire format differ from what many DELETE endpoints in this repo do (placing fields directly under `data`) and can easily mismatch the backend contract.
### Issue Context
This PR introduces `AgentDeleteOptions` and threads it into `deleteAgent()`. Other DELETE calls (e.g., knowledge-base deletes) send their request fields directly in `data` without an extra wrapper object.
### Fix Focus Areas
- src/lib/services/agent-service.js[73-76]
### Suggested fix
Pick one approach and make types/docs match the actual wire format:
1) If backend expects top-level fields: change to `await axios.delete(url, { data: options ?? {} });`
2) If backend expects `{ options: ... }`: keep the request body as-is, but update the JSDoc to reflect the real request shape (e.g., accept `optionsWrapper` of type `{ options: AgentDeleteOptions }`) and/or define an `AgentDeleteRequestModel` type with an `options` property.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.