Commit d68b9ff
authored
fix(inference): bound Spark llama.cpp request bodies (#9669)
Part of #9592. Production enforcement depends on #9600.
## Summary
- cap the Muse Glimmer Spark llama.cpp recipe at 16 KiB and the Nemotron
Spark recipe at 32 KiB
- add an exact-size request-body qualification probe: the declared
boundary must succeed, 50,000 bytes must return a structured 413, and
immediate health plus a normal completion must still succeed
- update the owned llama.cpp image to revision
`8e7f22b67ef4667b4ddd50230771287f328cfb3f`, already declared by the Muse
recipe, and permit its `--jinja` / `--chat-template-kwargs` launch
arguments through the request guard
- refresh the Ubuntu curl package pins from `.11` to the currently
published `.12` build so the owned image remains reproducible
## Root cause and impact
On DGX Spark, llama.cpp can terminate while handling an authenticated
request far below the configured context window. The raw Muse runtime
closed an exact 50,000-byte request, incremented Docker RestartCount,
and reloaded the model. This was not an OOM.
Hardware testing also disproved the initial 32 KiB candidate for Muse:
an exact 32,768-byte request made the child upstream unavailable and
left immediate health and continuation at 502. A conservative 16 KiB
Muse boundary passed. Nemotron remains safe at 32 KiB.
## DGX Spark evidence
Host: NVIDIA GB10, Ubuntu 24.04.4 LTS arm64, driver 580.159.03, Docker
29.2.1.
Locally built owned image:
`sha256:d1cce88e51c33a3de634caaef421cf4268a7e00ca0580260dad809cb22c13a48`
| Model | Accepted request | Oversized request | RestartCount |
Immediate health | Continuation |
| --- | ---: | ---: | ---: | ---: | ---: |
| Muse Glimmer | 16,384 bytes → 200 | 50,000 bytes → 413
`request_body_too_large` | 0 → 0 | 200 in 6 ms | 200 |
| Nemotron 3 Nano | 32,768 bytes → 200 | 50,000 bytes → 413
`request_body_too_large` | 0 → 0 | 200 in 8 ms | 200 |
The original raw Muse reproduction used the recipe-pinned image and
exact 50,000-byte body: curl exit 52 / HTTP 000, RestartCount 0 → 1,
OOMKilled false, and health returned after 5,745 ms.
## Validation
- `npm run checks:repository`
- `npm run typecheck:cli`
- `npm --prefix nemoclaw run typecheck`
- `npm run format:check`
- 150 focused integration tests
- 29 host-local runtime tests
- complete request-guard Go test suite
- pre-commit catalog, repository, hadolint, gitleaks, source-shape, and
growth checks
- native ARM64 CUDA image build and live Muse/Nemotron hardware
qualification
## Scope boundary
This change establishes model-specific safe request boundaries and
qualifies the owned guard path. It does not resolve #9600: the
production managed launch path still bypasses the request guard, so
#9600 remains the production-enforcement dependency.
Signed-off-by: Prekshi Vyas
<34834085+prekshivyas@users.noreply.github.com>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added validation for request body size limits, including accepted and
oversized request scenarios.
* Oversized requests now return a clear HTTP 413 error while subsequent
health and completion requests continue normally.
* Added support for additional llama.cpp configuration options,
including chat template parameters and Jinja templating.
* **Bug Fixes**
* Reduced configured request body limits to improve protection against
oversized payloads.
* Updated llama.cpp and runtime components for improved reliability and
compatibility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 6fe1ed0 commit d68b9ff
10 files changed
Lines changed: 270 additions & 29 deletions
File tree
- managed-inference
- images/llama-cpp
- request-guard
- recipes
- scripts/checks
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
92 | | - | |
93 | | - | |
| 93 | + | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
Lines changed: 23 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
Lines changed: 124 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
167 | 213 | | |
168 | 214 | | |
169 | 215 | | |
| |||
727 | 773 | | |
728 | 774 | | |
729 | 775 | | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
730 | 843 | | |
731 | 844 | | |
732 | 845 | | |
| |||
914 | 1027 | | |
915 | 1028 | | |
916 | 1029 | | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
917 | 1041 | | |
918 | 1042 | | |
919 | 1043 | | |
| |||
Lines changed: 53 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
469 | 471 | | |
470 | 472 | | |
471 | 473 | | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
472 | 485 | | |
473 | 486 | | |
474 | 487 | | |
| |||
1341 | 1354 | | |
1342 | 1355 | | |
1343 | 1356 | | |
| 1357 | + | |
1344 | 1358 | | |
1345 | 1359 | | |
1346 | 1360 | | |
| |||
1799 | 1813 | | |
1800 | 1814 | | |
1801 | 1815 | | |
| 1816 | + | |
1802 | 1817 | | |
1803 | 1818 | | |
1804 | 1819 | | |
| |||
1909 | 1924 | | |
1910 | 1925 | | |
1911 | 1926 | | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
1912 | 1943 | | |
1913 | 1944 | | |
1914 | 1945 | | |
| |||
1973 | 2004 | | |
1974 | 2005 | | |
1975 | 2006 | | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
1976 | 2016 | | |
1977 | 2017 | | |
1978 | 2018 | | |
| |||
2049 | 2089 | | |
2050 | 2090 | | |
2051 | 2091 | | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
2052 | 2103 | | |
2053 | 2104 | | |
2054 | 2105 | | |
| |||
0 commit comments