fix: dead regex in quotaResetDelay, write_count race, env info lock#6684
Open
aaronlab wants to merge 1 commit into
Open
fix: dead regex in quotaResetDelay, write_count race, env info lock#6684aaronlab wants to merge 1 commit into
aaronlab wants to merge 1 commit into
Conversation
1. run_agent.py: Fix double-escaped \d in quotaResetDelay regex that caused it to never match (dead code since introduction). The sec_match fallback regex on line 2320 uses \d correctly. 2. hermes_state.py: Move _write_count increment inside self._lock to prevent concurrent _execute_write callers from racing on the counter and skipping/doubling WAL checkpoints. 3. tools/terminal_tool.py: Acquire _env_lock in get_active_environments_info before reading _active_environments. Without the lock, a concurrent cleanup_vm() call can modify the dict mid-iteration, raising RuntimeError: dictionary changed size during iteration. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Collaborator
|
Related to #6655 — overlapping fix for _env_lock in terminal tool shared dict accesses. |
1 similar comment
Collaborator
|
Related to #6655 — overlapping fix for _env_lock in terminal tool shared dict accesses. |
This was referenced Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
\dinquotaResetDelayregex (line 2313) — the pattern\\din a raw string matches a literal backslash+d, never matching actual digits. This makes rate-limit reset time extraction dead code. The companionsec_matchregex (line 2320) uses\dcorrectly, confirming this is a bug, not a style choice._write_count += 1insideself._lockto prevent concurrent_execute_writecallers from racing on the counter, which could skip or double WAL checkpoints._env_lockinget_active_environments_info()before reading_active_environments. Without the lock, a concurrentcleanup_vm()call can modify the dict mid-iteration, raisingRuntimeError: dictionary changed size during iteration.Test plan
_extract_api_error_contextcorrectly parsesquotaResetDelay: 30000msfrom Gemini API errorsget_active_environments_info()no longer raises under concurrent environment cleanup🤖 Generated with Claude Code