Repository navigation
Commit 7f085ab
committed
Address review: keep the discovery attempt open across cancellation
prepareRequest set modelDiscoveryAttempted before awaiting getModels, so
a caller cancellation that interrupted discovery left the flag set and
every later request on the same handler skipped discovery and kept the
fallback model metadata. The catch now resets the flag only when the
failure is a cancellation (isRequestAborted against the caller's
signal); ordinary discovery failures keep the one-attempt behavior.
New test aborts during getModels, then makes a second request on the
same handler and asserts discovery runs again (negative control
verified: removing the reset fails the test; the test is order-
independent - the fetch stub is installed before handler construction
because the SDK binds globalThis.fetch at construction).
Verification at this head: 25/25 green in kimi-code.spec.ts (isolated
run of the new test also green); tsc --noEmit 0 errors; eslint
--max-warnings=0 clean on touched files; prettier clean.1 parent e12539a commit 7f085ab
2 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
355 | 387 | | |
356 | 388 | | |
357 | 389 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
| |||
0 commit comments