Integration contract

The porting agent separates trusted authorization and remote effects from model judgment. Lifecycle state, native Work queue state, tracking issues, and remote operation receipts have distinct ownership. Every later remote effect must bind the exact repository identity, contribution revision, Git head, and verified readback.

Intake parses the stable Upstream repository, Packages, Upstream target branch, and Additional notes headings. The request form is language agnostic: Packages is optional and names the packages the project publishes in any ecosystem (PyPI, crates.io, npm, Go modules, Maven, and so on), one per line, kept as written and recorded in the contribution’s distributions field. These names are read from PyPI only to confirm a plan’s decision close, and only a PyPI project that names the upstream repository confirms it. Intake freezes the exact rendered body, SHA-256, parsed notes, and optional target branch into durable contribution state before any issue edit can affect later Work. A refresh from parked starts a new generation on the same target branch, read again from the frozen body; only a request that named none is bound to the upstream default branch of the time, and /upstreaming refresh branch=NAME names another branch for the new generation. When the upstream answers that the target branch does not exist or was renamed, the contribution waits for a human with base_branch_unavailable instead of retrying; a repository that GitHub now names otherwise (renamed or transferred, the same repository id) waits at once with upstream_unavailable; other failed reads are retried, counted at most once per slot (retries.source_unavailable_minutes divided by retries.source_unavailable_reads, measured from the first failure, so ticks that come early, late or in bursts count once per slot), until retries.source_unavailable_minutes minutes passed since the first and retries.source_unavailable_reads reads were counted, the read that meets both counted at once, before the same wait, or the wait upstream_unavailable when most of them could not read the repository itself (no longer readable with the token). A wait that failed reads caused ends on its own once the upstream can be read again, and so does the wait a renamed repository caused once GitHub answers for it under its recorded name again. A base branch renamed while the upstream PR is open is followed without a human once the verified PR targets the new name, and so is a rename before the PR is opened, once the PR targets the name GitHub redirects the base to. Removing the intake label withdraws a request only while it is in queued.idle; a request that already waits for a human (for example in planning.waiting_human because its target branch is unavailable) is withdrawn by parking it and then abandoning it, /upstreaming park revision=N reason="..." followed by /upstreaming abandon revision=N reason="...". Compatibility is limited to two immutable earlier forms, whose package field names PyPI distributions (at least one is required and each is normalized as PEP 503 says), and the proven single-repository freeform request shape; headings of different forms cannot be mixed.

Pull-request validation is read-only. controller.yml runs the controller, and the single Website workflow, website.yml, builds and deploys the whole public site: the docs pages, the status page, and the pull-request previews. The controller observes with the ordinary read token, deterministically stages local records, and only then mints a control-repository App token for one validated plain fast-forward .state/ commit. Issue projection uses a separate issues-scoped control token after state publication. The Pages deploy job has only contents: read, pull-requests: read, pages: write, and id-token: write; a separate preview-comment job has only pull-requests: write. Neither workflow receives a model credential or destination App credential.

Workflow display names are title case without a prefix: Controller, Dispatcher, Planner, Worker, Reproduction Image, Fork Provisioning, Development PR, Publish Retry, Handoff, Agent Validation, and Website. These names are load-bearing: controller.yml subscribes to completed runs of the dispatcher, planner, worker, reproduction image, fork provisioning, development PR, publish retry, and handoff workflows by display name, and the plan comment publisher accepts only runs whose GITHUB_WORKFLOW is Planner, Publish Retry, or Controller. Renaming a workflow therefore updates those references, and the gh-aw locks are recompiled from their Markdown sources. Run discovery and dispatch otherwise address workflows by file name.

The reviewed workflow migration and ownership table is in workflow-migration.json; it maps the workflows of the earlier repository. handoff.yml has no earlier counterpart: it is owned by the handoff operations (building the upstream branch riscv64 from the reviewed series, rerunning interrupted CI on the clean head, and the submission package) described on the transition engine page, and its jobs mint a destination token narrowed to the one recorded fork (contents and workflows write for the branch, actions write in a separate token only when the clean head needs its own CI dispatched, and actions write alone for the rerun) or a control token with issues write for the package, each only after the job has checked that the state it checked out is the head of main and still runs the operation. No job can write a pull request: the development PR is never closed.

Development happens on riscv64-dev: fork provisioning creates it from the frozen base, worker Work and its publication, the development PR, its CI, and head observation use it, and nothing changes it for upstreaming. The upstream PR comes from riscv64, which only the handoff writes: at submit-upstream an uncredentialed rewrite Work reshapes the non-debug commits of the approved riscv64-dev series after the plan’s commit conventions and writes the pull request title and description after the project’s template and contributing instructions; trusted code checks every commit, the same final tree, the attribution trailers, the measurable rules, and the template sections without a token; a separate uncredentialed review Work, in a fresh context, reviews exactly that series and text against the template, the contributing instructions, the commit conventions, and the reviewers’ expectations and blocks the submission on failure; then handoff.yml creates or replaces riscv64 from the series under an exact-head lease, never while a pull request is open from it. When the rebuilt head has another tree than the candidate head, the same trusted job dispatches the project’s required CI workflow on riscv64 if it accepts workflow_dispatch (with a separate token of actions: write on the one fork, minted only for that attempt), and the CI wait asks a human when that CI cannot run or does not complete within a bounded wait. A retraction leaves riscv64 as it is. No workflow holds a credential that can write an upstream repository. A runtime workflow is added only together with its reviewed ownership entry, and an agentic Markdown workflow must be committed with exactly one generated .lock.yml file. The dispatcher, planner, and worker locks remain exact normalized gh-aw v1.2.2 output. The worker model remains uncredentialed; only its separate trusted publish job may mint a destination token narrowed to one independently verified fork after exact Result, scope, history, and head validation.

The worker follows the project’s contribution guidelines that the verified plan records: the contributing instructions take precedence over the pipeline’s instructions to the worker, and the commits follow the measured commit conventions and the expectations of the reviewers of the changed paths. The Work payload carries the plan’s measurable commit rules as context.commit_rules, taken by the trusted planner from the committed plan evidence; a plan of schema version 1 records none. Before any token, the trusted worker gate checks every non-debug commit of the proposed series against them (title length, literal title prefixes, capitalization, trailing period, required body, body wrap width, and a required Signed-off-by: trailer) and rejects the series with the rule each commit breaks. It also rejects any attribution trailer (Signed-off-by:, Co-authored-by:, Reviewed-by:, and every other *-by: line, the title included and under Unicode lookalikes of its key and colon) that does not name the App’s commit identity, and any attribution trailer continued on a line that starts with white space: the worker commits as the App and attributes work to nobody else. The number of commits is checked at submission, where the review may squash. Work that answers unmet series requirements of the plan carries them as context.series_requirements, and the gate rejects a patch of that Work whose non-debug commits change no file matching one of the paths of each requirement.

Every patch, repair, revision, submission rewrite, and submission review Work also uploads report.json in its porting-out artifact (schemas/worker_report.schema.json, at most 32 KiB): what the worker attempted and why, each approach and its outcome, what failed with its evidence, what remains open, and the verification done. The worker gate and the submission checks (--report) require it, naming the contribution, revision, task, and the digest of the history the Work carried, whenever the payload carries context.history; the publish job and the publish-only retry pass it on in porting-publication. The reconciler stores it as worker_report evidence only when the Result is accepted by a success row, checking the bytes of the file as the gate did; a success Result of Work that carries a history whose report cannot be stored pauses that one contribution (pause_on_processing_error, naming the Work and the reason; it never stops the tick for the others) instead of being folded without it. A Result that arrives late although its push landed stores its report too, so the repair of a failing head reads what was tried on it. The report of a failed, rejected, or blocked worker is discarded. Every Work payload, planning included, carries context.history: the repository, the pinned control commit, the path (.state/evidence/history-<32 hex>.json), the SHA-256 and the evidence id of the work_history evidence the controller recorded when it allocated the Work. A trusted pre-agent step fetches it at that commit, verifies it, and writes /tmp/gh-aw/agent/history.json. It holds the owner’s steering (human_steering evidence of the tracking issue description edits and comments and the development and upstream PR reviews and comments by accounts in the command authority, plus the reviews of upstream maintainers as feedback) and the chronological reports, CI outcomes, reviews, and submission verdicts of the contribution. All of it is untrusted data: redacted, bounded, never rendered on the tracking issue or the status page, and unable to widen any path, operation, or credential.

The public site is built from docs/ with the Just the Docs theme, and the status page at /porting-agent/status/ is generated from committed .state/ on every build. Every build also renders a preview for each open pull request from a branch of this repository that changes docs/, served at /porting-agent/pr/<number>/, and deploys the combined site once; a closed pull request’s preview is dropped on the next deploy. Preview builds use pull_request_target so the deployment runs in the base-branch context, but pull-request code is never checked out or executed: the trusted main commit runs every script, the pull-request docs/ tree is extracted as data without symlinks, and it is rendered by the GitHub Pages Jekyll image in safe mode without a token. Each preview carries the same generated status page as the main site. Pull requests from forks get no preview.

Pages publication performs bounded exact-run artifact discovery before deployment. If the first official deploy action loses the newly uploaded artifact to eventual consistency, the workflow re-verifies the exact artifact ID/name/run and retries deployment once; duplicate, expired, foreign-run, or persistently absent artifacts fail closed without requiring a manual rerun.

The unsandboxed worker uses a hash-pinned gh-aw v1.2.2 Pi provider patch: the extension captures ANTHROPIC_API_KEY into the registered provider configuration, immediately deletes it from process.env, and only then exposes tools. Pi can authenticate, while bash, Docker, and gh-act cannot inherit the provider key. A custom engine wrapper separately strips and verifies all GitHub, App, destination, Actions, cloud, and SSH credentials. The authenticated read-only GitHub MCP remains a separate trusted process.

Worker reproduction evidence: every patch, repair, and revision Result carries a reproduction with the exact image digest, riscv64, the exact commands, their exit statuses and log digests, and the enforced limits. The trusted worker gate accepts a patch or no_change outcome only with at least one passing direct docker run --platform linux/riscv64 command of the exact image reference. gh act is an optional aid, installed best effort and hash-pinned by a separate pre-agent step that records available or unavailable in /tmp/gh-aw/agent/gh-act-status and never fails the run; its workflow, job, and runner-mapping evidence (reproduction.workflows) is recorded only when the worker used it, and then in full. A gh act failure (capacity class act_unsupported, advisory per capacity.blocks_outcome) never blocks an outcome whose direct commands passed, and a blocked Result in a reproduction-image-infrastructure cluster whose only failed commands are gh act is refused as a validation failure, with its reason fed back, instead of counted as an infrastructure blocker. Stored proposals and evidence with workflows and runner_mappings stay valid.

A dispatcher workflow may conclude failure after gh-aw reports recovery_required even when the native workflow dispatch was accepted. Run 44982720398 is the demonstrated case: the durable ledger recorded one accepted worker launch while one earlier control intent remained blocked, so safe-output processing failed closed and the worker still started. This is expected self-healing evidence, not proof of nonlaunch. Controller replay treats a live Claim as authoritative and neither releases nor duplicates it; explicit continuation and schedule fallback reconcile the terminal result.

State publication never force-pushes, deletes, merges, or uses a ruleset bypass. On a moving main tip it fetches, rechecks stale revision preconditions, rebuilds on the new tip, validates the complete candidate tree, and retries with a fixed bound. Human-facing ledger entries, failure replies, and terminal reactions scan durable state and hidden markers so a failure after the state commit is repaired by a later tick without duplicate comments.

The one-time canonical ciso8601 repair is intentionally narrower than general issue editing. It requires the exact issue ID, title, incomplete body digest, contribution ID, revision 0 state, verified upstream identity/base, and undispatched Work fields committed by run 44970094370. The first state commit records a deterministic issue_body_repair intent. Only then may trusted code PATCH issue #1 to the reviewed fixture. A separate GET must match the exact expected bytes before a second state-only commit confirms the operation, restores the frozen intake, clears only the undispatched request, and appends recovery events. A lost PATCH response is discovered by GET on a later tick without replay; every other body or state fails closed.