Skip to content

fix(plugins): keep root help responsive#1935

Open
stephenlclarke wants to merge 3 commits into
apple:mainfrom
stephenlclarke:fix-help-plugin-discovery-timeout-v2
Open

fix(plugins): keep root help responsive#1935
stephenlclarke wants to merge 3 commits into
apple:mainfrom
stephenlclarke:fix-help-plugin-discovery-timeout-v2

Conversation

@stephenlclarke

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Root help currently performs daemon-backed plugin discovery before it can print. If the API service is registered but not replying, container --help, container help, and bare container can appear to hang.

Related to #1459. Supersedes #1838, whose fork branch was deleted after the PR was closed.

This PR is intentionally stacked on #1862:

What Changed

  • Makes XPC response timeouts and caller cancellation return promptly through the cancellable request handling from fix: reply to unknown XPC routes and make request timeout cancellable #1862.
  • Returns invalidArgument for unknown XPC routes instead of leaving clients waiting.
  • Uses a one-second API health deadline for root help plugin discovery.
  • Preserves the existing ten-second health deadline for real plugin dispatch.
  • Falls back to built-in help when the API service is unavailable.
  • Covers container --help, container help, and bare container in integration tests.
  • Avoids process-global stdout redirection in unit tests.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

Validation:

  • make all
  • make test
  • make swift-fmt-check
  • swift test --disable-automatic-resolution --filter 'ApplicationPluginDiscoveryTests|XPCClientTests': 8 tests passed
  • Focused coverage: XPCReplyBox.swift reached 100% line, function, and region coverage; every new help-policy branch was executed
  • Targeted CLI integration: container --help, container help, bare container, and container --debug help passed
  • Full integration at width 4 exercised the new help paths successfully

The full integration matrix also exposed repository-baseline failures unrelated to this diff:

  • Three serial .dockerignore tests failed with four assertions.

  • The same three tests fail identically from a clean worktree at unmodified Apple main (5f277a9).

  • The default 18-way run also saturated host forwarding; all 32 tests in the affected run-command suite passed when rerun serially.

  • git diff --check origin/main..HEAD

radheradhe01 and others added 3 commits July 11, 2026 18:08
Import apple#1862 unchanged on top of current Apple main, preserving the original author and implementation.
Exercise the timeout, caller-cancellation, late-reply, client-reuse, and unknown-route paths introduced by apple#1862.
Use a one-second API health deadline for container --help, container help, and bare container while preserving the normal ten-second plugin dispatch deadline. Fall back to built-in help when the daemon is unavailable.

Depends on the cancellable XPC request handling from apple#1862 and supersedes apple#1838 for apple#1459.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants