Skip to content

rpc: avoid blocking startup on an undetermined Contacts permission #186

Description

@markxiong0122

imsg rpc initializes Contacts before starting the JSON-RPC server:

  • RpcCommand.swift calls await ContactResolver.create()
  • the default policy is .requestIfNeeded
  • .notDetermined then awaits CNContactStore.requestAccess

In a headless Aqua-domain LaunchAgent, that authorization request can remain pending indefinitely. The process stays alive but accepts no JSON-RPC requests, so unrelated methods such as chats.list, messages.history, and send.rich all hang before the server starts. We reproduced this on macOS with imsg 0.12.3 and verified the same call path on current main.

ContactResolver already supports the right fail-open-for-metadata behavior: .skipIfNotDetermined returns NoOpContactResolver(contactsUnavailable: true). Could the RPC entrypoint use:

let contacts = await ContactResolver.create(accessPolicy: .skipIfNotDetermined)

Interactive CLI commands can keep the existing default. RPC callers can then start reliably without Contacts display-name resolution, while authorized installations continue loading contacts normally.

A downstream watchdog now bounds requests, but fixing the RPC startup policy avoids the native wedge itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:crash-loopThis issue is about crashes, hangs, restart loops, or process-level availability.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions