Gate automated GitHub issue imports before public pushes
Automated issue imports can write untrusted issue and comment text into a public tracker. This change adds pm github gate and pm github import --gate, then uses them in one reusable sync workflow before any commit, push or review-PR write.
The gate detects GitHub, npm, AWS, Slack, OpenAI and Anthropic credentials, bearer values, private-key blocks and high-entropy secret assignments; personal email/contact numbers; and POSIX/Windows host paths. Reports expose the item, field, rule and SHA256 content hash without echoing the matched value. Exact content-hash allowlisting requires a written justification; it cannot widen to a pattern.
Gated imports read the complete PM corpus and fetch the full requested upstream issue/comment plan, account for every fetched issue exactly once, require unique provenance before mutation, scan rendered candidate values, verify persisted identities, and scan the resulting tracker changes. Staged, unstaged and untracked changes are covered separately, including staged sensitive text removed from the working copy. Binary or invalid UTF-8, unreadable Git/PM input, malformed/truncated diffs, malformed allowlists, failed comment reads and unexpected scanner errors all refuse the operation. Untracked operational directories are excluded; explicitly staged operational files remain in scope.
The reusable .github/workflows/pm-github-sync.yml performs checkout → pinned extension install → access validation → complete preview → gated import → byte-identical repeat → strict health → leased branch push → create/update a review PR. Every changed PM item receives a permanent blob/main/.agents/pm/<folder>/<id>.toon link. Actions use immutable SHAs; callers retain scheduling and the required contents: write, pull-requests: write, issues: read permissions.
Caller example (replace both release placeholders after publication):
name: Sync GitHub issues to pm
on:
schedule:
- cron: "17 2 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
issues: read
concurrency:
group: pm-github-sync
cancel-in-progress: false
jobs:
gated-sync:
uses: unbraind/pm-github/.github/workflows/pm-github-sync.yml@RELEASE_COMMIT_SHA
with:
pm-github-version: "RELEASE_VERSION"
The caller needs the pinned host CLI in its package graph and a committed .agents/pm tracker. No downstream caller was enabled or dispatched.
Validation on frozen implementation 5ed8c47 (Node 24.19.0, npm 11.17.0, Bun 1.3.5):
| Check | Result |
|---|---|
| Coverage before | 97.59% lines/statements, 89.24% branches, 100% functions |
| Coverage after | 100/100/100/100 (8,398 lines/statements, 2,220 branches in the final fixture run, 208 functions); 487 passing, zero failures/skips |
| Source inventory | All 12 authored TS/JS modules, including operational scripts; unchanged exact thresholds and no source ignores |
| Full release commands | npm run release:check PASS; bun run release:check PASS (487 tests each, no skips) |
| Native Bun suites | npm run test:bun PASS: 487/487 across all 30 files, command exit zero |
| Adversarial executable workflow | Nine independent malicious body/comment, email, contact-number, secret-assignment and host-path fixtures refuse before item writes; real disposable Git/bare-remote refs unchanged and no PR writer call |
| Clean executable workflow | Real bare-remote branch push, idempotent repeat, linked PR creation and update at the local GitHub writer boundary |
| Packed public acceptance | Previously recorded three-issue public-data import; fresh paginated public pm-todos snapshot since 2026-10-01 imports one non-PR issue through the packed HTTP/CLI boundary, privacy PASS, byte-identical Node repeat, strict health PASS, no remote |
| Native installed Bun repeats | Three fresh public-snapshot repeats after the transport fix in 6.06, 8.16 and 4.80 seconds; durable bytes unchanged; separate synthetic packed repeat battery passes |
| PM tracker | Pinned CLI strict health with required merge drivers PASS; linked planner and watchdog tests PASS |
Native Bun exposed a deterministic transport timeout defect: ClientRequest.setTimeout(30000) did not reject a real silent local server before the existing 45-second test deadline. The client now uses an explicit 30-second wall-clock deadline and rejects before destroying the request; Bun can otherwise emit completion synchronously and resolve a truncated partial body. Real silent-header and never-ending-body fixtures now reject in about 30.02 seconds under both Node and Bun, without raising a timeout. Full release checks were restarted after the fix.
The historical intermittent 45-second Bun timeout did not reproduce in fresh packed runs. A separate deterministic dangling comment-lock symlink exposed an infinite exclusive-create/stat retry loop; the fix sleeps and honors the existing wait budget. Installed acceptance retains its original 45-second deadline, sends SIGTERM to the process group and forces SIGKILL after a five-second cleanup window. A real spinning child that resists SIGTERM verifies timeout rejection and unchanged fixture bytes. The historical timeout's original cause remains unestablished; the lock defect is not presented as that cause. Real SDK comment writes/deduplication pass; no deterministic comment-add flakiness reproduced.
Reachable coverage gaps now have real PM/Git/HTTP cases. Removed branches are proved unreachable by validated input/caller invariants, documented in the coverage PM item and docs/coverage-gap-inventory.md; no ignores or reduced thresholds were used. The shell changelog-date verifier is tested separately and is outside the V8 denominator. The inherited, exact provenance-verified fake-key Git-object fixture exemption remains separate from the import content-hash allowlist.
PM evidence and follow-ups:
- Import privacy gate and shared workflow
- Exact all-source coverage and removal proofs
- Installed Bun timeout investigation and bounded acceptance
- Stale completed SDK import journals
- Released caller rollout
Items remain open for orchestrator verification. The candidate is unreleased, release pins remain placeholders, CI/reviewer approval is separate from local acceptance, and this PR authorizes no merge or fleet rollout. The newer global PM CLI reports extension-host version skew; the package-pinned CLI and packed pinned-host acceptance pass. This existing PR remains draft pending review.
Final receipt and portable-fixture commit: 54a9c3d; authored production sources are byte-identical to the validated implementation. Post-commit Git-object privacy, pinned strict health and lint pass.