Commit f02b1c9
fix(azure.ai.agents): doctor checks 5-6 — 3-of-3 review fix-ups (skip-cascade + production-equivalent YAML validation)
Two MEDIUM findings, 3-of-3 reviewer consensus across Opus xhigh, Sonnet 4.6, and GPT-5.5.
Finding A (skip-cascade propagation):
priorFailed only matched StatusFail, not StatusSkip. When local.azure-yaml
failed, its dependents (env-selected, agent-service-detected) skipped — but
THEIR dependents (project-endpoint-set, agent-yaml-valid) saw the upstream
as Skip-not-Fail and ran anyway. Concrete user impact in the "wrong
directory" scenario: 1 real failure (check 2: azure.yaml) + 1 misleading
failure (check 5: "Run azd provision") + 1 duplicate failure (check 6:
same error as check 2). Worse: with a stale .env, check 5 could PASS with
a stale endpoint and hide the broken project.
Fix: rename priorFailed -> priorBlocked and treat both Fail and Skip as
blocking. Updated skip messages on checks 5 and 6 to say "failed or
skipped" / "or upstream check blocked" so users know the root cause is
earlier in the chain. Added regression tests for the Skip-state predecessor
path on both checks; updated TestPriorBlocked to cover the new contract
(including the "matching skip" case that previously asserted false).
Finding B (YAML validation gap):
GPT identified that check 6 used bare yaml.Unmarshal into ContainerAgent,
which is decode-permissive — silently accepts manifests with missing kind,
invalid kind (e.g. "nonsense"), missing name, or DNS-invalid name (e.g.
"My_Agent"). Production deploy uses agent_yaml.ValidateAgentDefinition
which rejects all of these.
Opus additionally identified that the doctor's "gopkg.in/yaml.v3" import
was the wrong library entirely — agent_yaml's custom UnmarshalYAML methods
(PropertySchema.UnmarshalYAML at yaml.go:374) bind to *go.yaml.in/yaml/v3.
Node, not gopkg.in/yaml.v3.Node. Go method dispatch is by exact parameter
type, so the doctor was silently skipping every custom unmarshaler in
agent_yaml. Production loads via go.yaml.in (helpers.go:28,772).
Sonnet confirmed both at HIGH (doctor's whole purpose is to surface deploy
blockers pre-flight) and recommended the bundled fix.
3/3 bundling consensus: replace the bare unmarshal with a single call to
agent_yaml.ValidateAgentDefinition(data). Opus verified the library
transitively resolves — parse.go imports go.yaml.in/yaml/v3, so once the
gopkg.in/yaml.v3 call is removed the file's wrong-library import goes with
it (Go compile error otherwise). One function body changed.
This also fixes Opus's wording caveat: REPLACE, do not AUGMENT — a naive
"call Validate THEN keep the existing Unmarshal" would have preserved the
library mismatch.
Test changes:
- Existing valid-YAML fixtures gain "kind: hosted" (required field).
- 3 new failure tests: MissingKind, InvalidKind, InvalidName — locking
in that doctor surfaces the same errors deploy would surface.
Pre-flight: gofmt, vet, build, doctor 6.7s + full extension suite 24s on
cmd / 9.5s on agent_api / etc — all green. golangci-lint 0 issues. cspell
0 issues.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent ae4dd4b commit f02b1c9
2 files changed
Lines changed: 170 additions & 24 deletions
File tree
- cli/azd/extensions/azure.ai.agents/internal/cmd/doctor
Lines changed: 21 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
| 45 | + | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| |||
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
118 | | - | |
119 | | - | |
| 117 | + | |
| 118 | + | |
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
| |||
173 | 172 | | |
174 | 173 | | |
175 | 174 | | |
176 | | - | |
177 | | - | |
| 175 | + | |
| 176 | + | |
178 | 177 | | |
179 | 178 | | |
180 | 179 | | |
| |||
251 | 250 | | |
252 | 251 | | |
253 | 252 | | |
254 | | - | |
255 | | - | |
256 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
261 | 263 | | |
262 | | - | |
263 | | - | |
264 | | - | |
| 264 | + | |
| 265 | + | |
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
273 | 277 | | |
274 | | - | |
| 278 | + | |
275 | 279 | | |
276 | 280 | | |
277 | 281 | | |
| |||
Lines changed: 149 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
182 | 204 | | |
183 | 205 | | |
184 | 206 | | |
| |||
287 | 309 | | |
288 | 310 | | |
289 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
290 | 332 | | |
291 | 333 | | |
292 | 334 | | |
| |||
321 | 363 | | |
322 | 364 | | |
323 | 365 | | |
| 366 | + | |
324 | 367 | | |
325 | 368 | | |
326 | 369 | | |
| |||
352 | 395 | | |
353 | 396 | | |
354 | 397 | | |
355 | | - | |
| 398 | + | |
356 | 399 | | |
357 | 400 | | |
358 | 401 | | |
| |||
438 | 481 | | |
439 | 482 | | |
440 | 483 | | |
441 | | - | |
| 484 | + | |
442 | 485 | | |
443 | 486 | | |
444 | 487 | | |
| |||
471 | 514 | | |
472 | 515 | | |
473 | 516 | | |
474 | | - | |
| 517 | + | |
475 | 518 | | |
476 | | - | |
| 519 | + | |
477 | 520 | | |
478 | 521 | | |
479 | 522 | | |
| |||
485 | 528 | | |
486 | 529 | | |
487 | 530 | | |
488 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
489 | 534 | | |
490 | 535 | | |
491 | | - | |
| 536 | + | |
| 537 | + | |
492 | 538 | | |
493 | 539 | | |
494 | 540 | | |
495 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
496 | 547 | | |
497 | 548 | | |
498 | 549 | | |
499 | | - | |
| 550 | + | |
500 | 551 | | |
501 | 552 | | |
502 | 553 | | |
503 | 554 | | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
504 | 646 | | |
505 | 647 | | |
506 | 648 | | |
| |||
0 commit comments