Repository navigation
Commit 48fd634
fix(skills/bounding-heavy-commands): stop the suggested budget from counting file cache (#67)
* fix(skills/bounding-heavy-commands): stop the suggested budget from counting file cache
The suggested budget came from memory.peak of the command's cgroup, which counts the page cache that the kernel takes back under the cap. A command that writes many files, such as a development server with a build cache, got a budget near the whole queue.
While a capped command runs, the one sampler now also reads memory.stat and keeps the peak of the memory that the kernel cannot take back at once: anon, shmem, kernel (or its parts on an older kernel), and dirty and writeback file pages. The suggested budget is that peak with the margin for a sample, at least a quarter of memory.peak with its margin as a floor for the cache that a command reads again, and never more than the budget from memory.peak. Without a cgroup the budget is as before.
The row line gains held=<n>M after peak= (held=- without the cap), and the summary line names both peaks.
Fixes #59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(skills/bounding-heavy-commands): count page tables and vmalloc in the held memory of an older kernel
A kernel with a 'kernel' line in memory.stat counts page tables and vmalloc memory in it. On an older kernel the wrapper added the parts of kernel memory itself but left out pagetables, sec_pagetables, and vmalloc, so the same command reported less held memory there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(skills/bounding-heavy-commands): double the cap after a capped measurement, and stop calling the budget the peak
The suggested budget can now be far below the cap that stopped a run, so "two times the budget that the wrapper printed" could retry below the failed cap. The rule now names the budget of the cap in the summary line. A Red Flags row still said that the budget is the measured peak plus a margin.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(skills/bounding-heavy-commands): show held=- in the fixed form of the row line
The wrapper prints held=- when it has no sample of the held memory, and the prose says so, but the fixed form in the skill showed only a number. It now shows both, as the usage text does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(skills/bounding-heavy-commands): leave the reclaimable slab out of the held memory on a newer kernel
The 'kernel' line of memory.stat includes slab_reclaimable, the cache of file names and inodes, which the kernel can take back under the cap. The held memory counted it, so a command that walks many files got a larger held peak than it needs. The wrapper now subtracts slab_reclaimable from the kernel line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(skills/bounding-heavy-commands): change a row when the suggested budget moves, not only the peak
Under the hard cap the suggested budget follows the held memory, so it can change while the full peak stays the same. The record rule changed a row only when the peak moved, so an agent kept a budget that the wrapper no longer suggested.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent fce95a1 commit 48fd634
3 files changed
Lines changed: 194 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| 98 | + | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| |||
841 | 844 | | |
842 | 845 | | |
843 | 846 | | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
844 | 874 | | |
845 | 875 | | |
846 | 876 | | |
| |||
868 | 898 | | |
869 | 899 | | |
870 | 900 | | |
871 | | - | |
| 901 | + | |
872 | 902 | | |
873 | | - | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
874 | 928 | | |
875 | 929 | | |
876 | 930 | | |
877 | | - | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
878 | 940 | | |
879 | 941 | | |
| 942 | + | |
880 | 943 | | |
881 | 944 | | |
| 945 | + | |
882 | 946 | | |
883 | 947 | | |
884 | 948 | | |
| |||
888 | 952 | | |
889 | 953 | | |
890 | 954 | | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
897 | 958 | | |
898 | 959 | | |
899 | 960 | | |
| |||
1263 | 1324 | | |
1264 | 1325 | | |
1265 | 1326 | | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
1266 | 1331 | | |
1267 | 1332 | | |
1268 | 1333 | | |
1269 | 1334 | | |
| 1335 | + | |
1270 | 1336 | | |
1271 | | - | |
| 1337 | + | |
1272 | 1338 | | |
1273 | 1339 | | |
1274 | 1340 | | |
| |||
1303 | 1369 | | |
1304 | 1370 | | |
1305 | 1371 | | |
| 1372 | + | |
1306 | 1373 | | |
1307 | 1374 | | |
1308 | 1375 | | |
| |||
1311 | 1378 | | |
1312 | 1379 | | |
1313 | 1380 | | |
1314 | | - | |
| 1381 | + | |
| 1382 | + | |
1315 | 1383 | | |
1316 | 1384 | | |
1317 | | - | |
| 1385 | + | |
1318 | 1386 | | |
1319 | 1387 | | |
1320 | | - | |
1321 | | - | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
1322 | 1391 | | |
1323 | 1392 | | |
1324 | 1393 | | |
| |||
0 commit comments