Commit b1d4efd
perf(codex): skip out-of-range date directories when --since/--until is set
Previously, loadTokenUsageEvents() always globbed **/*.jsonl across the
entire sessions directory tree, which reads all historical data regardless
of the requested date range. On large installations (35 GB+, 12 000+
files) this caused the process to be OOM-killed by the OS before producing
any output.
Sessions are stored as YYYY/MM/DD/*.jsonl. When --since or --until is
provided, enumerate the year/month/day directories and prune entire
subtrees that fall outside the range instead of performing a full recursive
glob. Fall back to the recursive glob when no date filters are specified to
preserve existing behaviour.
Thread the since/until values from each command (daily, monthly, session)
into loadTokenUsageEvents() so the directory-level filter is applied.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 0adbb4f commit b1d4efd
File tree
4 files changed
+75
-8
lines changed- apps/codex/src
- commands
4 files changed
+75
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
180 | 182 | | |
181 | 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 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
182 | 251 | | |
183 | 252 | | |
184 | 253 | | |
185 | 254 | | |
186 | 255 | | |
187 | 256 | | |
| 257 | + | |
188 | 258 | | |
189 | 259 | | |
190 | 260 | | |
| |||
216 | 286 | | |
217 | 287 | | |
218 | 288 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 289 | + | |
223 | 290 | | |
224 | 291 | | |
225 | 292 | | |
| |||
0 commit comments