microsoft / microsoft/Power-CAT-Copilot-Studio-Kit
Bug: "Agent Compliance | Delete Case" always fails - Get_Agent looks up Agent Details by primary key using the bot id (404)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 450
- Forks
- 95
- Avg merge
- 26m
- Merged PRs (30d)
- 5
Description
The Delete enforcement action never completes. Every Delete agent from case ends with the note "The agent was scheduled to be deleted but automation failed." and the agent is not deleted.
Root cause is in the Agent Compliance | Delete Case flow (AgentComplianceDeleteCase). The Get_Agent step retrieves from the cat_agentdetailses (Agent Details) elastic table using Get a row by ID (GetItem), passing the bot id as recordId:
operationId: GetItem
entityName : cat_agentdetailses
recordId : @outputs('Get_Case')?['body/cat_agentid']
But the bot id is stored in the cat_agentid column, not the table's primary key (cat_agentdetailsid). Inventory creates Agent Details rows with an auto-generated primary key and writes the bot id only into the cat_agentid column (AgentInventoryAgentsDataLoadChild → Add_agent: item/cat_agentid = ). The compliance case likewise stores the bot id in cat_agentid (CreateCaseChild → Add_Case).
So Get_Agent asks for a record whose primary key equals the bot id — which never matches — and returns 404. Because Delete_Agent depends on Get_Agent's output (organization = @outputs('Get_Agent')?'body/cat_environmenturl'] for the cross-environment PvaDeleteBot call), the flow fails in the Try scope before any deletion occurs, and the Catch scope writes the generic failure note.
Fix: Get_Agent should query Agent Details by the cat_agentid column, not by record id — e.g. List rows with filter cat_agentid eq , then first(...), and repoint Delete_Agent's organization to that result's cat_environmenturl.
Steps to reproduce
- Install the Copilot Studio Kit and configure the Compliance Hub (Agent Inventory installed and scanned).
- Open a compliance case and the Agent Compliance | Delete Case flow run history.
Expected behavior
Get_Agent returns the Agent Details row for the bot, Delete_Agent invokes PvaDeleteBot in the agent's home environment, the agent is deleted, the case is marked succeeded, and the "Agent deleted" note is added.
Actual behavior
Get_Agent fails with HTTP 404 (Could not find item ''), Delete_Agent never runs, the case is marked failed, and the note "The agent was scheduled to be deleted but automation failed." is written. The agent is not deleted. This happens for every Delete agent action.
Environment
Environment
- Copilot Studio Kit solution: CopilotAgentKit version 20260608.1 (managed)
- Affected flow: Agent Compliance | Delete Case (AgentComplianceDeleteCase)
- Affected table: cat_agentdetails (Agent Details — Dataverse elastic table, served by the NonRelational/Cosmos data provider)
- Power Platform / Dataverse (Copilot Studio agents in one or more home environments referenced by cat_environmenturl)
- Tenant type: commercial
Additional context or logs
Get_Agent action error:
{
"error": {
"code": "0x80048d02",
"message": "The HTTP status code of the response was not expected (404).\nStatus: 404\nResponse: {"error":{"message":"Could not find item
'43167a0e-de4a-423b-a3f6-dba96c694e1c'.","details":[{"message":"Errors : [ \"Resource Not Found. Learn more: https://aka.ms/cosmosdb-tsg-not-found\" ]"}]}}",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionSourceKey": "Plugin/Microsoft.Xrm.DataProvider.NonRelational.Plugins.RetrievePlugin",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionMessageName": "IsvAbortedNotFound",
"@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionHttpStatusCode": "404"
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.