GitHub App integration
GitHub support is opt-in per connected Harnessa repository. App configuration stores only public IDs and opaque secret references. Private key and webhook secret values must remain in deployment-managed environment variables; the worker and API resolve a reference through GITHUB_SECRET_REFERENCES_JSON and never return the resolved value.
Configure the deployment
Set GITHUB_SECRET_REFERENCES_JSON to a JSON object mapping opaque references to the deployment environment variable names GITHUB_APP_PRIVATE_KEY and GITHUB_WEBHOOK_SECRET, for example {"harnessa-github-private-key":"GITHUB_APP_PRIVATE_KEY","harnessa-github-webhook":"GITHUB_WEBHOOK_SECRET"}. Set those variables through the API and worker secret stores; the Compose file forwards only these GitHub secrets into those trusted services. Set GITHUB_API_URL only to an HTTPS GitHub API origin/prefix. The webhook body limit defaults to 256 KiB and the retry limit to 12.
Create a GitHub App with Checks: read, Contents: write, Issues: write, Pull requests: write, and Commit statuses: write permissions. Harnessa requests narrower repository-scoped installation tokens per operation (for example, checks read for check polling, pull requests read for PR/review reads, contents plus pull requests write for publication, and statuses write only for commit-status effects). Subscribe to installation, installation_repositories, issues, issue_comment, pull_request, pull_request_review, check_run, and check_suite. Configure the webhook URL as /webhooks/github and use the deployment secret mapped above. The app must be installed with repository selection enabled; Harnessa still requires an explicit repository opt-in.
Register its App ID, webhook ID, and secret references as an organization administrator through POST /github/apps. Register the installation through POST /github/installations, then verify it with POST /github/installations/{installation_uuid}/refresh. The refresh reports missing permissions and suspension. Opt a connected Harnessa repository into one matching GitHub repository with POST /projects/{project_id}/repositories/{repository_id}/github; the request must include the installation UUID, GitHub numeric repository ID, one or more required check names, and the issue topic label. archive_policy accepts pre_merge (the default, which includes the prepared OpenSpec archive in the implementation PR) or post_merge (which creates a separate archive PR after the implementation merge). GitHub repository name and ID are checked before the link is stored.
Map GitHub numeric user IDs to active organization users through POST /github/actors. A mapping does not grant additional Harnessa roles: interview creation and answers still pass through the existing project authorization checks. Topic issues need the configured label. A bounded five-minute scan pages through open issues carrying that label; it reads each current issue snapshot and recovers an authorized mapped creator's issue even when its opened webhook was lost. The page checkpoint is stored on the opted-in repository link and rate limits defer that link until its retry time. If an edit webhook arrives before its opened webhook, Harnessa fetches the issue through the repository-scoped installation token and creates the interview from that current snapshot only when the edit sender is mapped; a later stale opened payload replays against the existing issue mapping. Tracked issue edits also compare current GitHub state with the synchronized title/body baseline and surface conflicts without overwriting either side. Clarification comments must use /harnessa answer <question-uuid> r<revision>: <answer> and be authored by a mapped user with the existing project operator permission.
Delivery and repair
The webhook route verifies X-Hub-Signature-256 against the raw request bytes, then stores the payload, payload digest, delivery identity, and processing intent in one PostgreSQL transaction. PostgreSQL uniqueness on App configuration and delivery ID is authoritative. The worker claims durable processing intents with leases and retries; Redis is not the source of webhook durability. The authenticated GET /github/status endpoint reports connection state, delivery counters, and recent delivery errors without returning webhook payloads or secret values. Organization administrators can retry failed or ignored deliveries with POST /github/deliveries/{delivery-row-uuid}/retry and a reason.
Repository opt-out disables further inbound processing for that link. Installation removal or suspension revokes linked repository setup state. Refresh permissions and explicitly opt the repository in again after recovering installation access.
Read the durable integration and post-integration step state through GET /tasks/{task_id}/integration-evidence. For a post-merge archive PR that was closed without merging or drifted, an authorized project administrator/operator can request a retry with PUT /integration-evidence/{integration_id}/steps/archive and {"status":"pending","error":"retry rationale"}. This reopens only the Harnessa-owned maintenance PR; the API cannot mark that post-merge archive successful. Only a current required-check set and verified GitHub merge event can complete it.
Current implementation boundary
Issue opening, structured clarification answers, authoritative issue edit reconciliation (including edit-before-open ordering), bounded periodic recovery of missed topic-issue webhooks, webhook deduplication, delivery repair, durable outbound issue creation/comments/commit statuses, and exact-base review-branch/PR publication are implemented. A bounded five-minute poll refreshes tracked PR state, required checks, mapped review changes, installation permissions, and opted-in repository access. It scans a persisted issue page cursor per opted-in repository and imports only current open topic issues whose creators map to active users with existing project permission. It records exact-head merge evidence only when current required checks and mapped approvals pass, and queues bounded recovery for failed checks, head/base drift, or closed-unmerged PRs. Rate-limit responses honor GitHub's Retry-After or reset headers and persist a bounded retry time for the affected PR, installation, or repository. post_merge archive policy creates a separate tracked maintenance PR, and the task remains in LEARNING until the required checks and verified PR merge complete. Local fake-backed acceptance covers the full issue-to-DONE lifecycle; live GitHub App and real-repository acceptance require an operator-provisioned App, installation, secrets, and explicit repository authorization. Do not treat a webhook receipt or issue flow as full M10 acceptance.