fix: _check_disk_usage_warning runs expensive rglob scan on every terminal call - #22166
fix: _check_disk_usage_warning runs expensive rglob scan on every terminal call#22166amathxbt wants to merge 1 commit into
Conversation
|
Profiling data On a project with a
With the 5-minute TTL, the expensive scan runs at most once every 300 seconds instead of on every terminal command. For a typical agentic session that issues 50+ terminal commands, this eliminates ~100 seconds of unnecessary disk scanning. Additional improvement: On error, the cache timestamp is not updated so the next call retries immediately rather than waiting the full TTL for a result we know is bad. |
|
Thanks for the focused performance investigation. The current-main call path needs re-validation before this cache is salvaged. Problems
Suggested changes
Automated hermes-sweeper review. |
|
Merged via #76951 — thank you @amathxbt. Your commit was cherry-picked, so you remain the author in git history. The fix was correct exactly as written — the O(N) rglob really did run on every terminal command, and your 5-minute advisory cache with the no-cache-on-error retry path is the right shape (behavior-probed before merging: first call scans, repeats within TTL don't touch the filesystem). The only reason for the salvage wrapper was mechanics: your branch's base was too old for current CI's required checks and fork branches can't be updated from our side. No changes to your code. |
No description provided.