Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/upstreaming-investigator.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion .github/workflows/upstreaming-investigator.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ pre-agent-steps:
git config user.email "noreply@riseproject.dev"
echo "checked out $(git rev-parse HEAD) into ./fork"
jobs:
safe_outputs:
pre-steps:
- name: Check out trusted native artifact compatibility patch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false
path: native-artifact-compat
sparse-checkout: upstreaming
- name: Apply hash-pinned gh-aw v1.2.2 native artifact fix
run: python3 native-artifact-compat/upstreaming/gh_aw_compat.py "$RUNNER_TEMP/gh-aw/actions"
record:
# Ordinary trusted job, not a safe output. An investigation never pushes,
# so there is no fork token and no environment: this job only checks the
Expand Down Expand Up @@ -166,7 +177,8 @@ one Claim; use its `handle` as `claim_handle` on every safe output and on

Write these files into `upstreaming-out/` at the top of the workspace (next
to `fork/`, not inside it) and upload them with a single `upload_artifact`
call: `{"path": "upstreaming-out", "name": "upstreaming-proposal"}`:
call: `{"path": "upstreaming-out"}` (the native handler names the artifact
`claim-<hash>-upstreaming-out`):

- `dossier.json`: the facts a human needs to approve the contribution's
scope, each with exact file paths or URLs as evidence:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/upstreaming-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
- name: Unit and acceptance tests
run: uv run --no-project --with-requirements upstreaming/requirements.txt python -m unittest discover -s upstreaming/tests -t . -v

- name: Native artifact compatibility regression tests (pinned gh-aw v1.2.2)
run: sh upstreaming/gh-aw-compat/check.sh

- name: Validate committed state
run: uv run --no-project --with-requirements upstreaming/requirements.txt python -m upstreaming validate-state

Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/upstreaming-worker.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion .github/workflows/upstreaming-worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ pre-agent-steps:
git config user.email "noreply@riseproject.dev"
echo "checked out $(git rev-parse HEAD) into ./fork"
jobs:
safe_outputs:
pre-steps:
- name: Check out trusted native artifact compatibility patch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false
path: native-artifact-compat
sparse-checkout: upstreaming
- name: Apply hash-pinned gh-aw v1.2.2 native artifact fix
run: python3 native-artifact-compat/upstreaming/gh_aw_compat.py "$RUNNER_TEMP/gh-aw/actions"
publish:
# Ordinary trusted job, not a safe output. Gated on the compiled
# safe_outputs outcome, then on the exact Claim's verified Result as
Expand Down Expand Up @@ -214,7 +225,8 @@ one Claim; use its `handle` as `claim_handle` on every safe output and on

Write these files into `upstreaming-out/` at the top of the workspace (next
to `fork/`, not inside it) and upload them with a single `upload_artifact`
call: `{"path": "upstreaming-out", "name": "upstreaming-proposal"}`:
call: `{"path": "upstreaming-out"}` (the native handler names the artifact
`claim-<hash>-upstreaming-out`):

- `proposal.json`: a JSON object matching
`upstreaming/schemas/proposal.schema.json` in the control repository.
Expand Down
21 changes: 21 additions & 0 deletions upstreaming/gh-aw-compat/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright GitHub, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
79 changes: 79 additions & 0 deletions upstreaming/gh-aw-compat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Native artifact compatibility patch for gh-aw v1.2.2

Approved by the operator after investigator run 44415024119 failed native
artifact delivery. Base source: github/gh-aw tag v1.2.2, commit
`399a445fe2d8926c616b54b1b82a16b5b2be4445`.

## Why

`upload_artifact.cjs` constructs a target containing the native repository
ID and worker run ID, then authorizes it as an ordinary resource effect.
Ordinary targets require matching run IDs in immutable Work selectors.
The dispatcher cannot know a future worker run ID when admitting Work.

The handler already resolves the native repository via the GitHub API.
The patch wraps the native upload in `withClaimResourceEffects`, gh-aw's
existing protected native-target frame. That frame authenticates the Claim,
checks immutable repository selectors and the exact original dispatch/run
binding, and authorizes the concrete target before calling the artifact client.
It does not change general resource-scope validation.

Unchanged: durable Completion requirement, original Claim and factory fences,
repository-ID checks, immutable Work scope, original native run binding,
closed effect channels, private in-process delivery receipt, independent
artifact ID/name/run/digest/size readback, and verified Result publication.
No credentials, scheduler changes, generic artifact fallback, or direct pushes.

## Installation

The worker and investigator use `jobs.safe_outputs.pre-steps`, a supported
compiler hook, immediately after runtime setup and before artifact downloads
or handler loading. They check out trusted code at `github.sha` with no persisted
credentials and run `upstreaming/gh_aw_compat.py` against the flat runtime modules.
The installer checks the original handler SHA-256, applies only
`native-artifact.patch`, and checks the exact resulting SHA-256. Unknown source,
symlink, failed application or unexpected output aborts the job. Reapplication
of the exact patched file is idempotent.

Compiler-generated lock files are never edited by hand. The gh-aw release,
setup action and CLI stay pinned to v1.2.2.

## Tests

```sh
python3 -m unittest upstreaming.tests.test_gh_aw_compat
sh upstreaming/gh-aw-compat/check.sh
```

The second command fetches the pinned source and locked test dependencies,
applies the exact runtime patch, and runs upstream's native upload and
resource-scope tests. All native upload tests now use an immutable repository
selector without a future run ID. Additional tests reject a mismatched
repository ID, explicit foreign run selector and changed runtime run ID before
upload. Existing tests reject foreign Claims, cancelled Claims, reused factories,
closed channels and every altered artifact metadata field. All APIs and uploads
are mocked. No remote state is changed.

Local result: 109 tests pass (30 artifact tests, 79 resource-scope tests).
Live end-to-end validation is still required; this result alone does not prove
that the pipeline publishes or that numpy CI runs.

Two companion integration corrections use the actual v1.2.2 behavior:

- The validating CLI replay emits JSON on stderr. The reader accepts one complete
projection from stdout or stderr only after a successful exit.
- The native safe-output tool takes `path`, not a name override. The verified
artifact suffix is `upstreaming-out`, matching the uploaded directory. The
exact artifact ID, Claim/run binding and digest checks are unchanged.

The old failed Work has Completion but no Result and a pending delivery barrier.
This patch does not rewrite that history or authorize replay of its effects.
Recovery must use supported queue operations and independently verified state,
not fabricated receipts or a reset queue.

## Licensing

The patch, upstream handler fixture, and adapted upstream regression test are
based on GitHub's MIT-licensed source. Its copyright and license are retained
in `LICENSE`. No upstream issue or PR has been opened; that is a separate remote
action requiring authorization.
20 changes: 20 additions & 0 deletions upstreaming/gh-aw-compat/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
# Reproduce the native handler tests against the exact v1.2.2 source.
# No GitHub writes, artifact uploads, credentials or live API calls.
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
git clone --quiet --depth 1 --branch v1.2.2 --filter=blob:none --sparse \
https://github.com/github/gh-aw.git "$tmp/source"
[ "$(git -C "$tmp/source" rev-parse HEAD)" = 399a445fe2d8926c616b54b1b82a16b5b2be4445 ]
git -C "$tmp/source" sparse-checkout set actions/setup/js specs/work-queue
python3 "$root/upstreaming/gh_aw_compat.py" "$tmp/source/actions/setup/js"
cp "$root/upstreaming/gh-aw-compat/tests/upload_artifact_work_queue.test.cjs" \
"$tmp/source/actions/setup/js/upload_artifact_work_queue.test.cjs"
cd "$tmp/source/actions/setup/js"
npm ci --ignore-scripts --no-audit --no-fund
npx --no-install vitest run --no-file-parallelism \
upload_artifact_work_queue.test.cjs work_queue_resource_scope.test.cjs
Loading
Loading