Repository navigation
Commit 782497b
committed
Pin tool wire order so discovery order cannot bust the cache
The serialized tools array is the head of the provider's cached prompt
prefix, ahead of the system prompt. Measured on OpenCode Go Responses, a
warm session holds 99.3% cached and a pure reorder of an unchanged set
drops it to 2.1% — the same full miss a real mount costs. Discovery order
is not stable across turns (MCP connect order, plugin load order, map
iteration), so the wire order is now sorted by name.
updateToolDefinitions logs a digest when the set actually changes, so
prefix churn is countable instead of showing up only as a billing spike.
Drops the assertion that a newly discovered tool must land at the end of
the array. Appending was treated as the cache-preserving position; it is
not — append measures 4.5% cached against prepend's 2.1%, both full
misses.
CL-78681 parent d9ec82c commit 782497b
2 files changed
Lines changed: 92 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
51 | 67 | | |
52 | 68 | | |
53 | 69 | | |
| |||
482 | 498 | | |
483 | 499 | | |
484 | 500 | | |
485 | | - | |
| 501 | + | |
| 502 | + | |
486 | 503 | | |
487 | | - | |
| 504 | + | |
488 | 505 | | |
489 | 506 | | |
490 | 507 | | |
| |||
494 | 511 | | |
495 | 512 | | |
496 | 513 | | |
497 | | - | |
| 514 | + | |
498 | 515 | | |
499 | 516 | | |
500 | 517 | | |
| |||
508 | 525 | | |
509 | 526 | | |
510 | 527 | | |
511 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
512 | 536 | | |
513 | 537 | | |
514 | 538 | | |
| |||
592 | 616 | | |
593 | 617 | | |
594 | 618 | | |
595 | | - | |
| 619 | + | |
596 | 620 | | |
597 | 621 | | |
598 | 622 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1223 | 1223 | | |
1224 | 1224 | | |
1225 | 1225 | | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
1229 | | - | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1230 | 1237 | | |
1231 | 1238 | | |
1232 | 1239 | | |
1233 | 1240 | | |
1234 | 1241 | | |
1235 | | - | |
1236 | | - | |
1237 | | - | |
1238 | 1242 | | |
1239 | 1243 | | |
1240 | 1244 | | |
| |||
1661 | 1665 | | |
1662 | 1666 | | |
1663 | 1667 | | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
0 commit comments