Skip to content

fix(macos): resume concurrent location permission requests - #116183

Merged
vincentkoc merged 1 commit into
mainfrom
perf-macos-runtime-profile-v16
Jul 30, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
perf-macos-runtime-profile-v16

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where concurrent macOS location permission requests could overwrite the single pending continuation, leaving an earlier caller suspended forever. A cancelled timeout could also act on a newer request and open Settings or complete the wrong waiter.

Why This Change Was Made

Location permission requests now use one coordinator that coalesces all concurrent waiters, resumes them together, and owns one cancellation-aware timeout per request generation. An Always request can still escalate an active prompt once without replacing existing waiters.

User Impact

Concurrent location checks no longer hang indefinitely, and stale timeout work cannot interfere with a later permission request.

Evidence

  • Exact head e0d6fc01704: PermissionManagerLocationTests passed 3 tests, including concurrent waiter completion
  • Configured SwiftLint: 0 violations
  • Blacksmith Testbox changed gate: passed, including 211 relevant tests with 37 skipped and the native schema guard
  • Fresh exact-head autoreview: no accepted or actionable findings

@vincentkoc vincentkoc self-assigned this Jul 30, 2026
@openclaw-barnacle openclaw-barnacle Bot added the app: macos App: macos label Jul 30, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review July 30, 2026 02:33
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 30, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 10:37 PM ET / July 30, 2026, 02:37 UTC.

ClawSweeper review

What this changes

The PR replaces the macOS location permission requester's single waiter with a coordinator that coalesces concurrent callers, resumes all waiters together, and prevents cancelled timeout work from affecting a later request.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep this PR open for explicit macOS-owner review. It targets a concrete suspended-caller failure in the native permission path, and the provided evidence shows focused coverage plus a changed-gate run; the maintainer label and in-progress macOS checks mean it is not eligible for automated cleanup or closure. Likely related people: vincentkoc is the visible recent contributor for this permission-coordination change (medium confidence).

Priority: P2
Reviewed head: e0d6fc017044f56693def298fe4004bdce8d1789
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR presents a focused concurrency repair with useful automated evidence, but the supplied material does not independently establish device-level Core Location and timeout behavior.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This is a repository-member PR, so the external-contributor real-behavior-proof gate does not apply; the body nevertheless provides focused test and changed-gate evidence.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a repository-member PR, so the external-contributor real-behavior-proof gate does not apply; the body nevertheless provides focused test and changed-gate evidence.
Evidence reviewed 4 items PR change surface: The proposed head replaces the lone pending continuation with a request coordinator and adds generation-aware timeout state in the macOS location permission requester; the focused test adds concurrent-waiter completion coverage.
Focused regression coverage: The branch adds a serialized main-actor test that enqueues two waiters, finishes with a denied status, and asserts both callers resume and the queue is emptied.
Provided validation evidence: The PR body reports PermissionManagerLocationTests passing three tests, SwiftLint with zero violations, and a Blacksmith Testbox changed gate covering 211 relevant tests; macOS-native CI remains in progress in the supplied check state.
Findings None None.
Security None None.

How this fits together

The macOS app asks Core Location for authorization when a feature needs location access. Permission requests enter the native requester, which waits for the Core Location delegate result or a timeout, then returns authorization status to every requesting caller.

flowchart TD
  A[macOS feature requests location access] --> B[Location permission requester]
  B --> C{Authorization already decided?}
  C -- Yes --> D[Return current status]
  C -- No --> E[Request coordinator]
  E --> F[Core Location prompt and delegate result]
  F --> G[Resume all waiting callers]
  E --> H[Generation-bound timeout]
  H --> G
Loading

Decision needed

Question Recommendation
Does the macOS owner approve the new shared-waiter and generation-bound timeout semantics after reviewing actual Core Location prompt behavior and the completed native checks? Approve after native verification: Review the completed macOS checks and a concise real prompt/cancellation verification, then merge the coordinator as the canonical owner of concurrent waiters.

Why: This changes continuation ownership around an OS-managed authorization prompt; focused unit coverage is useful but cannot by itself establish all device-level delegate and Settings-launch behavior.

Before merge

  • Resolve merge risk (P2) - The coordinator changes main-actor continuation and timeout ownership in a permission flow; the supplied focused test proves waiter fan-out but does not independently demonstrate a real Core Location prompt, Always escalation, and stale-timeout interaction on macOS.
  • Resolve merge risk (P1) - Required macOS-native checks were still in progress in the supplied PR state, so the final platform build and test result should be reviewed before merge.
  • Complete next step (P2) - The protected maintainer label and OS-level concurrency semantics require normal human macOS review rather than an automated repair or cleanup lane.
Agent review details

Security

None.

PR surface

Docs +1, Other +68. Total +69 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 2 89 21 +68
Total 3 90 21 +69

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: apps/macos/Tests/OpenClawIPCTests/PermissionManagerLocationTests.swift. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify device-level permission flow before merge (recommended)
    Keep the coordinator design, but require the completed native checks and a focused macOS prompt/cancellation verification because a mistake here can leave permission callers suspended.
  2. Accept focused-test coverage
    Merge based on the coordinator test and changed-gate evidence while accepting that OS-prompt timing and Settings behavior were not independently demonstrated in the supplied material.

Technical review

Best possible solution:

Land a single-owner coordinator only after the macOS owner confirms real authorization-prompt behavior for concurrent When-In-Use and Always requests, including cancellation and timeout behavior, and the native checks finish successfully.

Do we have a high-confidence way to reproduce the issue?

No high-confidence live reproduction was independently run in this review. The reported failure is source-reproducible from the former single stored continuation and the new focused test's two-waiter scenario, but Core Location device behavior was not observed here.

Is this the best way to solve the issue?

Unclear. A single coordinator is the maintainable ownership boundary for coalescing waiters, but the complete delegate, escalation, and timeout implementation needs macOS-owner confirmation before this can be called the best fix.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5128df0cdd97.

Labels

Label changes:

  • add P2: This is a bounded native-app reliability fix for concurrent location authorization callers, with no evidence of a cross-platform outage or emergency regression.
  • add merge-risk: 🚨 availability: The patch changes continuation, timeout, and delegate-result coordination in a permission flow where a regression could leave macOS callers waiting indefinitely.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a repository-member PR, so the external-contributor real-behavior-proof gate does not apply; the body nevertheless provides focused test and changed-gate evidence.

Label justifications:

  • P2: This is a bounded native-app reliability fix for concurrent location authorization callers, with no evidence of a cross-platform outage or emergency regression.
  • merge-risk: 🚨 availability: The patch changes continuation, timeout, and delegate-result coordination in a permission flow where a regression could leave macOS callers waiting indefinitely.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a repository-member PR, so the external-contributor real-behavior-proof gate does not apply; the body nevertheless provides focused test and changed-gate evidence.

Evidence

What I checked:

  • PR change surface: The proposed head replaces the lone pending continuation with a request coordinator and adds generation-aware timeout state in the macOS location permission requester; the focused test adds concurrent-waiter completion coverage. (apps/macos/Sources/OpenClaw/PermissionManager.swift:300, e0d6fc017044)
  • Focused regression coverage: The branch adds a serialized main-actor test that enqueues two waiters, finishes with a denied status, and asserts both callers resume and the queue is emptied. (apps/macos/Tests/OpenClawIPCTests/PermissionManagerLocationTests.swift:7, e0d6fc017044)
  • Provided validation evidence: The PR body reports PermissionManagerLocationTests passing three tests, SwiftLint with zero violations, and a Blacksmith Testbox changed gate covering 211 relevant tests; macOS-native CI remains in progress in the supplied check state. (e0d6fc017044)
  • Current ownership signal: The PR is opened by a repository MEMBER, is self-assigned, and carries the protected maintainer label, so repository policy requires explicit maintainer handling rather than automated closure. (e0d6fc017044)

Likely related people:

  • vincentkoc: Opened, self-assigned, and authored the sole commit for this native macOS permission-coordination change; no deeper local history inspection was available in the read-only execution environment. (role: recent area contributor; confidence: medium; commits: e0d6fc017044; files: apps/macos/Sources/OpenClaw/PermissionManager.swift, apps/macos/Tests/OpenClawIPCTests/PermissionManagerLocationTests.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the completed macOS-native checks on the exact head.
  • Add or link a redacted runtime verification of concurrent prompt, escalation, and stale-timeout behavior if available.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc

Copy link
Copy Markdown
Member Author

Final exact-head maintainer review for e0d6fc01704:

  • All PR checks passed: 26 passing, 0 failing, 0 pending.
  • macos-swift, macOS dead-code, and openclaw/ci-gate are green.
  • The coordinator is the canonical owner boundary: it fans one OS prompt result out to all current waiters and binds timeout work to the active request generation.
  • A live prompt/escalation run is intentionally skipped because it would alter the operator's real macOS location-permission state and may open System Settings in the active app. The source-level overwrite is deterministic, and the focused concurrent-waiter test directly proves both callers resume.
  • ClawSweeper's stored-data-model note is a false positive: @Suite(.serialized) controls Swift test scheduling and does not add or migrate persistent state.

Provenance: the single stored continuation and cancellation-swallowing timeout were introduced in commit cc72498b46f8 on January 27, 2026; no associated pull request is traceable through GitHub's commit-to-PR API.

@vincentkoc
vincentkoc merged commit 859280e into main Jul 30, 2026
94 of 107 checks passed
@vincentkoc
vincentkoc deleted the perf-macos-runtime-profile-v16 branch July 30, 2026 02:41
vincentkoc added a commit to zhangguiping-xydt/openclaw that referenced this pull request Jul 30, 2026
* origin/main:
  fix(macos): stop canceled voice wake timers (openclaw#116189)
  fix(macos): coalesce location permission requests (openclaw#116183)
  fix(macos): guard remote tunnel restart ownership (openclaw#116172)
  fix(agents): throw CompactionError when summarization fails (openclaw#115500)
  fix(test): isolate ACP startup output stream (openclaw#116076)
  fix(agents): deny all tools when scheduled authority names a removed account (openclaw#115932)
  fix(test): stop collecting Vydra test helpers (openclaw#116139)
  fix(discord): preserve webhook deadline errors (openclaw#116155)
  fix(test): isolate Google embedding batch timeout (openclaw#116161)
  fix(cron): stop replaying old schedule slots after a cron job is edited (openclaw#115779)
  fix(plugins): report request timeouts for stalled response bodies (openclaw#116166)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant