Classify GitHub HTTP failures as expected refusals
Fixes #289
PM item pm-github-github-ee4d59c27b67-289.
Behavior
The packed pm host reproduced PM-CLI-42 with GraphQL POST 405 and 404 and REST timeline GET 403. Each response made the original handler run twice and surfaced as extension_command_handler_failed.
The shared HTTP transport now throws an SDK expected error with github_api_http_<status>, a recovery hint, and structured status, method and pathname. The host shows the code in JSON and in the TOON-mode diagnostic. Provider response bodies and URL query strings stay out of that diagnostic. Retry scheduling and attempt counts are preserved. Initial REST import 404 and an inaccessible repository in validate retain exit 3. Closeout and webhook reconciliation carry command-level HTTP refusals to the host while retaining their per-PR evidence and pending delivery handling. Sync and export keep their batch results and show the code in per-item diagnostics.
Projects push coordination
This branch leaves the Projects handlers and tests intact. PR #305 adds a server-error retry guard for non-idempotent writes. Where the transport edits meet, keep that guard and use the SDK refusal's details.status for the Projects delivery classification.
No matching host-handler crash was verified in another component.
Verification
- The 64 referenced test files produced 1,755 distinct passing checks across the interrupted run, its resumed files, and the corrected assertions. The selected-import rerun passed 27/27 and the PM-linked HTTP suite passed 60/60.
- The restored packed npm/Node and Bun host matrix and retry boundary passed 20/20 on the final base. The packed check on the declared minimum SDK passed 1/1.
- Restoring only the plain throw failed 20/20 and restored the handler-failure classification on the original import path. Bypassing only retry failed 1/1 by stopping at HTTP 503.
- Typecheck, build, test build, lint, documentation, ownership inventory, commit identity, tracker history and changelog checks completed locally. PR CI owns coverage and the npm release check. The full Bun release check has no PR trigger.
- The unchanged privacy gate passed in a clean candidate clone with 4,803 Git objects audited. The shared object store contains two unrelated unreferenced commits with identity findings.
Summary by cubic
Classifies non-retryable GitHub HTTP errors as expected refusals so the pm host reports them as refused commands instead of re-running the handler and surfacing extension_command_handler_failed.
Fixes #289.
- Adds
github_api_http_<status>codes with a recovery hint and status, method, and path details; response bodies, headers, and query strings stay out of diagnostics. - Preserves retry scheduling, exit 3 for initial REST import 404s and inaccessible repos in validate, and batch behavior for sync and export.
- Closeout and webhook reconciliation carry command-level refusals to the host while keeping closeout's original failure message, per-PR evidence, and pending delivery handling.
- Rate-limit 403s, 429s, and 5xx responses keep existing backoff behavior.
Summary by Sourcery
Surface non-retryable GitHub HTTP failures as structured expected refusals across all affected commands while retaining existing retries and workflow semantics.
Bug Fixes:
- Classify terminal GitHub HTTP responses as expected refusals instead of handler failures, preventing duplicate command execution and preserving command-specific exit behavior.
- Propagate typed HTTP refusals through closeout and webhook reconciliation while retaining batch results, pending deliveries, and per-item diagnostics.
Enhancements:
- Add stable github_api_http_ diagnostics with recovery guidance and structured status, method, and path details while excluding provider response bodies and URL query strings.
- Preserve existing retry behavior for rate limits and transient server errors, including retry scheduling and attempt counts.
Documentation:
- Document GitHub HTTP refusal codes, diagnostics, exit statuses, retry behavior, and command-specific handling.
Tests:
- Add packed npm and Bun host coverage for JSON and TOON refusal diagnostics, retry boundaries, command exit codes, and sensitive-data exclusion.
- Expand command and transport tests for imports, validation, closeout, sync, export, and webhook reconciliation.
Chores:
- Record the PM issue and project history metadata.