Repository navigation
fix(macos): back off approval socket retries - #116125
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 7:48 PM ET / 23:48 UTC. ClawSweeper reviewWhat this changesThis PR changes the native macOS execution-approval prompt server from fixed one-second socket-start retries to capped exponential backoff and adds deterministic coverage for the retry schedule. Merge readinessThis remains a focused, apparently correct P2 macOS runtime fix: it replaces an unbounded one-second retry loop with a bounded retry policy while retaining immediate first attempts and immediate recovery after an active listener stops. The PR is authored by a repository member and carries the protected Priority: P2 Review scores
Verification
How this fits togetherThe native macOS app starts a local Unix-socket server to receive execution-approval prompts. Startup resolves approval credentials and binds the socket; this change controls how the server retries after that startup path fails so overlapping app processes do not repeatedly reopen the approvals store and rebind the same path. flowchart LR
A[macOS app startup] --> B[Approval prompt server]
B --> C[Resolve approval credentials]
C --> D[Bind local approval socket]
D -->|start succeeds| E[Receive approval prompts]
D -->|start fails| F[Bounded retry backoff]
F --> C
E -->|listener stops unexpectedly| B
Decision needed
Why: The patch intentionally trades faster repeated recovery attempts for reduced CPU and filesystem pressure when overlapping processes contend for the same socket; the acceptable recovery latency is a product and platform-owner judgment. Before merge
Agent review detailsSecurityNone. PR surfaceOther +37. Total +37 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the bounded retry policy if the macOS owner accepts the 30-second cap for persistent bind failures, preserving the existing immediate initial attempt and immediate active-listener recovery behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source and the supplied profiler evidence: two overlapping native macOS processes contend for the execution-approval Unix socket, causing the existing fixed one-second retry path to repeat credential resolution and socket binding. The submitted focused Swift tests also cover the new retry-policy and lifecycle paths, although this review did not independently run a macOS process reproduction. Is this the best way to solve the issue? Yes. Keeping retry policy inside the existing prompt-server startup lifecycle is narrower and more maintainable than adding configuration or a separate contention mechanism; it preserves immediate first attempts and listener-stop recovery while bounding repeated failures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 73ab157e6fb0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Maintainer decision for reviewed head
This resolves the ClawSweeper availability tradeoff and maintainer-handling items. |
…id-retention * origin/main: (83 commits) refactor(channels): own account config mutations (openclaw#115970) fix(discord): keep activity receipts in adopted threads (openclaw#116119) fix(feishu): preserve card actions through mention gating (openclaw#116105) perf(gateway): cache lazy server methods import (openclaw#116060) refactor: keep update timing constants private fix: reject stale update reconciliation refactor: keep update status response private fix: bound update status reconciliation fix: preserve uncertain update outcomes refactor: keep update reconciliation within size budgets fix: release update reconciliation on access loss docs: note control ui update reconciliation test: cover both managed update response orders fix: reconcile ambiguous gateway updates fix(codex): prevent approval promotion from blocking unattended runs (openclaw#116117) fix(daemon): require system-scope ownership before removing the user unit fix(daemon): only treat same-canonical-name user+system units as dueling fix(daemon): detect and resolve dueling user+system systemd gateway units fix(macos): back off approval socket retries (openclaw#116125) test: add stalled provider response body timeout coverage ...
* origin/main: (23 commits) refactor(channels): own account config mutations (openclaw#115970) fix(discord): keep activity receipts in adopted threads (openclaw#116119) fix(feishu): preserve card actions through mention gating (openclaw#116105) perf(gateway): cache lazy server methods import (openclaw#116060) refactor: keep update timing constants private fix: reject stale update reconciliation refactor: keep update status response private fix: bound update status reconciliation fix: preserve uncertain update outcomes refactor: keep update reconciliation within size budgets fix: release update reconciliation on access loss docs: note control ui update reconciliation test: cover both managed update response orders fix: reconcile ambiguous gateway updates fix(codex): prevent approval promotion from blocking unattended runs (openclaw#116117) fix(daemon): require system-scope ownership before removing the user unit fix(daemon): only treat same-canonical-name user+system units as dueling fix(daemon): detect and resolve dueling user+system systemd gateway units fix(macos): back off approval socket retries (openclaw#116125) test: add stalled provider response body timeout coverage ...
What Problem This Solves
Fixes an issue where users with overlapping native macOS app processes could see recurring CPU and filesystem spikes while both processes competed for the exec-approvals Unix socket.
A 15-second sample of the blocked process caught
ExecApprovalsStore.resolve(agentId:)inside the prompt-server retry loop, while one-second process sampling observed bursts up to 9.4% CPU. The loop retried the SQLite credential read and socket bind every second indefinitely.Why This Change Was Made
The prompt server now applies bounded exponential backoff after startup failures: 1, 2, 4, 8, 16, then 30 seconds. The first startup attempt remains immediate, and a listener that later stops unexpectedly starts a fresh immediate recovery cycle.
The retry policy is isolated and deterministic so its growth and cap can be tested without timing-sensitive assertions.
User Impact
Duplicate or briefly overlapping macOS app processes no longer keep reopening the approvals store and rebinding the same socket every second. Normal single-app startup and transient recovery behavior are unchanged.
Evidence
ExecApprovalsPromptServer.start()->ExecApprovalsStore.resolve(agentId:)during recurring CPU bursts.swift test --package-path apps/macos --build-path apps/macos/.build-local --filter ExecApprovalsPromptServerTestsswiftformat --lint ... --config config/swiftformat: clean.swiftlint lint --strict --config config/swiftlint.yml ...: 0 violations.git diff --check: clean.Maintainer Decision
0b30b7b8fdfc4a7873d2dd84b633059c84614cf7.mainatcdab1764841a369951c6b525719ec6e11983956a; the clean three-way merge produced treeab07bf9896f43be65e11d5a1d07397cd8a6d40c3.stop()cancels and retires the current retry task, repeatedstart()calls cannot create a second task, and an unexpected active-listener stop callsstart()with a fresh immediate attempt.AI-assisted: yes. The implementation, tests, and profiler evidence were reviewed and verified by the maintainer.