Commit 80f983b
fix: prevent InternalServerError loop when --update-endpoint fails on create (#304)
* fix: prevent InternalServerError loop when --update-endpoint fails on create
When --update-endpoint fails during the CREATE step (e.g. Azure InternalServerError),
Azure may partially provision the new endpoint. Because BotMessagingEndpoint only updates
on success, all subsequent runs delete the stale old endpoint and attempt to create the
same partially-provisioned endpoint again, hitting InternalServerError on every retry.
Add Step 1.5 in UpdateEndpointAsync: pre-emptively delete the target endpoint name
(derived from newEndpointUrl) before creating it, ensuring a clean slate regardless of
any previous failed run. Only applies when NeedDeployment=false (non-Azure-hosted agents).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Normalize location reuse in endpoint update logic
Refactor UpdateEndpointAsync to normalize location once and reuse
for all endpoint operations, reducing duplication. Add warning
logging if pre-create cleanup does not confirm deletion. Update
unit tests to reflect normalization and endpoint name logic.
Add test to verify both old and target endpoints are deleted
when partially-provisioned endpoints exist.
* Improve logging for endpoint deletion and diagnostics
Enhanced logging for endpoint deletion by:
- Including both endpoint name and source URL in removal logs.
- Promoting endpoint name and agent blueprint ID logs to Information level.
- Logging full delete request payload details (instance name, AppId, TenantId, location, environment).
These changes improve traceability and aid in debugging endpoint deletion issues.
* Fix environment logging to use local config variable
Updated the delete request payload logging to use config.Environment
instead of _config.Environment, ensuring the correct environment
value is logged from the local configuration.
* Improve correlation ID handling and logging in cleanup
Each cleanup and blueprint command now generates and logs its own correlation ID at execution time for better traceability. The correlation ID is propagated through async operations and method calls, improving observability and debugging by ensuring all related logs are tagged with a unique identifier. Method signatures and invocations were updated to support this change.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 495c8ea commit 80f983b
5 files changed
Lines changed: 163 additions & 19 deletions
File tree
- src
- Microsoft.Agents.A365.DevTools.Cli
- Commands
- SetupSubcommands
- Services
- Tests/Microsoft.Agents.A365.DevTools.Cli.Tests
- Commands
- Services/Helpers
Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 43 | | |
47 | 44 | | |
48 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
| |||
Lines changed: 31 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
| 201 | + | |
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| |||
1859 | 1860 | | |
1860 | 1861 | | |
1861 | 1862 | | |
| 1863 | + | |
1862 | 1864 | | |
1863 | 1865 | | |
1864 | 1866 | | |
1865 | 1867 | | |
1866 | 1868 | | |
1867 | 1869 | | |
1868 | | - | |
| 1870 | + | |
| 1871 | + | |
1869 | 1872 | | |
1870 | 1873 | | |
1871 | 1874 | | |
| |||
1887 | 1890 | | |
1888 | 1891 | | |
1889 | 1892 | | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
1890 | 1899 | | |
1891 | 1900 | | |
1892 | 1901 | | |
| |||
1916 | 1925 | | |
1917 | 1926 | | |
1918 | 1927 | | |
1919 | | - | |
1920 | | - | |
1921 | 1928 | | |
1922 | 1929 | | |
1923 | 1930 | | |
1924 | | - | |
| 1931 | + | |
| 1932 | + | |
1925 | 1933 | | |
1926 | 1934 | | |
1927 | 1935 | | |
| |||
1936 | 1944 | | |
1937 | 1945 | | |
1938 | 1946 | | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
1939 | 1964 | | |
1940 | 1965 | | |
1941 | 1966 | | |
1942 | 1967 | | |
1943 | 1968 | | |
1944 | | - | |
| 1969 | + | |
1945 | 1970 | | |
1946 | 1971 | | |
1947 | 1972 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
| 209 | + | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
291 | 297 | | |
292 | 298 | | |
293 | 299 | | |
| |||
Lines changed: 97 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
1462 | 1463 | | |
1463 | 1464 | | |
1464 | 1465 | | |
1465 | | - | |
| 1466 | + | |
1466 | 1467 | | |
1467 | 1468 | | |
1468 | 1469 | | |
| |||
1490 | 1491 | | |
1491 | 1492 | | |
1492 | 1493 | | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
1493 | 1498 | | |
1494 | 1499 | | |
1495 | 1500 | | |
| |||
1503 | 1508 | | |
1504 | 1509 | | |
1505 | 1510 | | |
1506 | | - | |
1507 | | - | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
1508 | 1522 | | |
1509 | 1523 | | |
1510 | | - | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
1511 | 1534 | | |
1512 | | - | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
1513 | 1605 | | |
1514 | 1606 | | |
1515 | 1607 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
168 | 185 | | |
169 | 186 | | |
170 | 187 | | |
| |||
0 commit comments