Repository navigation
Description
Summary
remove_endpoint(ref) in src/backend/services/a2a_outbound.py filters out every record whose id or name matches the reference:
keep = [
r for r in records
if str(r.get("id") or "") != wanted
and str(r.get("name") or "").lower() != lowered
]Nothing enforces uniqueness across those two namespaces, and endpoint ids are visible in the admin GET /api/settings/a2a-endpoints response. So an operator who has named one endpoint after another endpoint's id can issue a single-target DELETE /api/settings/a2a-endpoints/{ref} and silently destroy two endpoints — along with their AES-256-GCM-encrypted credentials — while the route's own docstring says "Remove one registered outbound A2A endpoint by id or name" and the function returns a single True.
Context
Found by an /edge-cases sweep of the #736 A2A outbound path. This is the cross-namespace-collision class the tracker has hit before (#1631 operator-queue ids: uniqueness assumed globally but enforced per-agent).
The blast radius is what makes it worth fixing rather than documenting: the destroyed record's credential is a partner secret the operator may not still have a copy of, and the deletion is reported as success, so there is no signal to re-check. The next call against the collaterally-deleted endpoint fails with endpoint_not_found, which reads as a registration problem rather than a deletion.
upsert_endpoint enforces case-insensitive uniqueness on name only; it never checks a proposed name against existing ids, so creating the collision is a normal, permitted operation.
Reproduction
alpha = upsert_endpoint("alpha", url, "alpha-secret") # -> id a2aep_<hex12>
upsert_endpoint("beta", url, "beta-secret")
upsert_endpoint(alpha["id"], url, "gamma-secret") # legal: name == alpha's id
list_oss_endpoints() -> ['alpha', 'beta', 'a2aep_<hex12>'] (3)
remove_endpoint(alpha["id"]) -> True
list_oss_endpoints() -> ['beta'] (1) <-- two gone
Acceptance Criteria
-
remove_endpoint(ref)removes at most one record per call - With an id/name collision present, removing by id removes the id-matched record and leaves the name-matched one intact (resolution order is documented and the delete agrees with
resolve_endpoint, which returns the first match) -
remove_endpointstill returnsFalseon a genuine miss and for an empty/whitespace ref - Removing by name still works for the ordinary no-collision case
- The strict-
xfailontests/unit/test_736_a2a_outbound_edges.py::test_G7_removing_one_endpoint_removes_exactly_one_endpointis removed and the test passes plainly
Technical Notes
Two candidate shapes, and they are not equivalent — pick deliberately:
- Remove the first match only, mirroring
resolve_endpoint's first-match-wins semantics. This keeps delete and resolve consistent: whatever arefresolves to is what it deletes. Preferred. - Refuse an ambiguous ref (400/409, naming both candidates). Safer, but introduces a state the operator can reach and cannot exit without renaming, so it needs a rename path to be usable.
Worth considering alongside: upsert_endpoint could reject a name that collides with an existing id, which removes the ambiguity at the source. That is a separate, additive guard — it does not fix already-stored collisions, so it is not a substitute for fixing the delete.
Related: the same sweep found upsert_endpoint treats a whitespace-only credential as "clear" while None and "" mean "leave unchanged" — filed separately with the other low-severity findings.
Activity
dolho commentedon Aug 14, 2026
/claim — picking this up. Branch:
fix/2174-a2a-delete-one-endpoint.github-actions commentedon Aug 14, 2026
@dolho This issue is already assigned to dolho. Use
/unclaimfirst if you want to take over.dolho commentedon Aug 14, 2026
PR: #2177 (targets
dev).Took Technical Notes option 1 (first-match-wins, shared predicate with
resolve_endpoint) plus the additive create-time guard — a new endpoint may not be named after an existing id (422), create path only so an already-stored collision stays editable and removable.One deviation from the AC worth flagging:
tests/unit/test_736_a2a_outbound_edges.pydoes not exist ondev—git log -Sfinds it in no branch or commit, so the/edge-casessweep's file never landed. There was no strict-xfail to remove; the file is created in this PR withtest_G7_removing_one_endpoint_removes_exactly_one_endpointpassing plainly, plus 16 sibling cases.Verified live: through the real admin API, 3 endpoints + one DELETE left 1 (
gamma-secretdestroyed,{"success": true}); the same store on the branch resolves the ref to alpha, removes alpha only (3 → 2), and the collided record survives with its credential.fix(a2a): delete one endpoint, not two — a ref removes exactly what i…
fix(a2a): converge on the sweep's pinned test; drop the create-time g…