relay agent remove fails for any agent that has sent a message, and surfaces a raw SQL statement as the error.
Reproduce
relay agent register probe-a # capture token
RELAY_AGENT_TOKEN=$TOK relay channel create probe-ch
RELAY_AGENT_TOKEN=$TOK relay message post probe-ch 'hello'
relay agent remove probe-a
Output:
Failed query: delete from "agents" where "agents"."id" = ?
params: 208579108764696576
Exit code is 1 (correct), and the agent is still listed afterwards. An agent that has not sent anything deletes fine — in a two-agent test the receiver was removed and the sender was not, every time.
Two problems
- The delete is blocked, almost certainly by a foreign key from messages/DMs/read receipts onto
agents. Either cascade, soft-delete, or refuse with a real explanation.
- The error leaks internal SQL.
Failed query: delete from "agents" where "agents"."id" = ? plus a raw row id is not an actionable user-facing message, and it exposes schema detail.
Impact
Every verification run leaves undeletable test identities behind. 16 accumulated in the Default workspace during this work and cannot be cleaned up through the CLI. Any workflow that registers disposable agents will grow the roster permanently.
packages/cli/src/cli/commands/agent.ts just calls relay.agents.delete(name), so the fix is server-side.
Related
workflows/verify-features.ts now asserts the agent is actually gone after agent remove, rather than assuming a reported success meant it worked.
Found by workflows/verify-features.ts during a live end-to-end run.
relay agent removefails for any agent that has sent a message, and surfaces a raw SQL statement as the error.Reproduce
Output:
Exit code is 1 (correct), and the agent is still listed afterwards. An agent that has not sent anything deletes fine — in a two-agent test the receiver was removed and the sender was not, every time.
Two problems
agents. Either cascade, soft-delete, or refuse with a real explanation.Failed query: delete from "agents" where "agents"."id" = ?plus a raw row id is not an actionable user-facing message, and it exposes schema detail.Impact
Every verification run leaves undeletable test identities behind. 16 accumulated in the Default workspace during this work and cannot be cleaned up through the CLI. Any workflow that registers disposable agents will grow the roster permanently.
packages/cli/src/cli/commands/agent.tsjust callsrelay.agents.delete(name), so the fix is server-side.Related
workflows/verify-features.tsnow asserts the agent is actually gone afteragent remove, rather than assuming a reported success meant it worked.Found by
workflows/verify-features.tsduring a live end-to-end run.