fix(whatsapp): retry bridge spawn without CREATE_BREAKAWAY_FROM_JOB on access-denied - #87777
Open
Aperk357 wants to merge 1 commit into
Open
fix(whatsapp): retry bridge spawn without CREATE_BREAKAWAY_FROM_JOB on access-denied#87777Aperk357 wants to merge 1 commit into
Aperk357 wants to merge 1 commit into
Conversation
…n access-denied The WhatsApp bridge's subprocess.Popen call used windows_detach_popen_kwargs() unconditionally, which sets CREATE_BREAKAWAY_FROM_JOB. When the parent Electron process's job object doesn't allow breakaway, CreateProcess fails with ERROR_ACCESS_DENIED (PermissionError: [WinError 5] Access is denied), and the bridge never started. Every other detached-spawn call site in this codebase already retries without the breakaway flag on OSError (see gateway_windows.py::_spawn_detached); the WhatsApp adapter's Popen call was missing that fallback, causing the failure to repeat every ~5 minutes indefinitely (1,271+ occurrences in gateway.log). Mirrors _spawn_detached's exact pattern: wrap the Popen call in try/except OSError and retry with windows_detach_flags_without_breakaway() on Windows. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
fix(whatsapp): retry bridge spawn without CREATE_BREAKAWAY_FROM_JOB on access-denied
|
Collaborator
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
plugins/platforms/whatsapp/adapter.py'ssubprocess.Popencall for the WhatsApp bridge usedwindows_detach_popen_kwargs()unconditionally, which setsCREATE_BREAKAWAY_FROM_JOB.CreateProcessfails withERROR_ACCESS_DENIED, surfaced asPermissionError: [WinError 5] Access is denied— observed 1,271+ times ingateway.log, recurring every ~5 minutes.OSError(canonical pattern:hermes_cli/gateway_windows.py::_spawn_detached). The WhatsApp bridge's Popen call was the one site missing this fallback._spawn_detached's exact pattern: wrap the Popen call intry/except OSErrorand retry withwindows_detach_flags_without_breakaway()on Windows; re-raise unchanged on non-Windows (where there's no breakaway flag to strip).Test plan
tests/gateway/test_whatsapp_connect.pysuite passes unchanged (11 passed, 1 skipped pre-existing).TestBridgePopenBreakawayFallbackwith two new tests:test_retries_without_breakaway_on_permission_error: mockssubprocess.Popento raisePermissionErroron the first call, verifies a second call is made withcreationflagsthat excludeCREATE_BREAKAWAY_FROM_JOB(0x01000000), and thatconnect()succeeds using the retried process.test_does_not_retry_on_non_windows: verifies the retry path is skipped on non-Windows and the originalOSErrorbehavior (single Popen call) is preserved.python -m pytest tests/gateway/test_whatsapp_connect.py -q→ 13 passed, 1 skipped.🤖 Generated with Claude Code