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
20 changes: 10 additions & 10 deletions .github/workflows/upstreaming-worker.lock.yml

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

21 changes: 14 additions & 7 deletions .github/workflows/upstreaming-worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,13 @@ safe-outputs:
noop:
report-as-issue: false
pre-agent-steps:
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: false
- name: Guard the Actions log from untrusted workflow commands
env:
GH_AW_ACTIONS_DIR: ${{ runner.temp }}/gh-aw/actions
- name: Suspend workflow commands around untrusted agent output
id: suspend_commands
run: |
set -euo pipefail
uv run --no-project python -m upstreaming.gh_aw_log_guard "$GH_AW_ACTIONS_DIR"
token="upstreaming-stop-$(openssl rand -hex 32)"
echo "token=$token" >> "$GITHUB_OUTPUT"
printf '::stop-commands::%s\n' "$token"
- name: Check out the contribution fork at the expected head (read-only)
env:
GH_AW_ACTIONS_DIR: ${{ runner.temp }}/gh-aw/actions
Expand Down Expand Up @@ -120,6 +118,15 @@ pre-agent-steps:
git config user.name "riseproject-upstreaming[bot]"
git config user.email "359135081+riseproject-upstreaming[bot]@users.noreply.github.com"
echo "checked out $(git rev-parse HEAD) into ./fork"
post-steps:
- name: Resume workflow commands after untrusted agent output
if: always()
env:
STOP_COMMANDS_TOKEN: ${{ steps.suspend_commands.outputs.token }}
run: |
set -euo pipefail
test -n "$STOP_COMMANDS_TOKEN"
printf '::%s::\n' "$STOP_COMMANDS_TOKEN"
jobs:
safe_outputs:
pre-steps:
Expand Down
1 change: 1 addition & 0 deletions SESSIONLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
- Added a fast ungrouped controller job that idempotently reacts `+1` to visible `/upstreaming` tracking-issue comments while leaving all parsing, authorization and command effects in serialized reconciliation.
- Aligned the controller's cheap comment filter with first-nonblank-line command parsing so blank-line-prefixed commands are both acknowledged and reconciled.
- Added a hash-pinned gh-aw v1.2.2 console guard that preserves canonical agent evidence while preventing untrusted model or MCP text from being parsed as GitHub Actions workflow commands.
- Replaced console-byte rewriting with GitHub's native stop-commands protocol: trusted pre/post agent steps bracket exact output with a random step-output token and always restore command processing.
12 changes: 7 additions & 5 deletions upstreaming/INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ release-path rehearsal still need live evidence.
- The dispatcher and patch worker stay sandboxed. The worker's native detector
currently uses a provider-specific CLI; Pi-only detection is an unresolved
compatibility limitation and is not silently worked around.
- Before worker model execution, trusted code hash-checks the pinned gh-aw
v1.2.2 process runner and patches only its console-forwarding path. Every
colon byte in untrusted child output gains a following space in the Actions
log, so model and MCP content cannot become `::workflow-command::` syntax,
including across output chunks. Canonical artifact evidence stays unchanged.
- Before worker model execution, a trusted pre-agent step generates a
cryptographically random token, stores it as that trusted step's output, and
emits GitHub's `::stop-commands::` directive. An `if: always()` post-step resumes
command processing with that exact token after the engine exits. Agent and
MCP output therefore stays exact and searchable in both the Actions console
and canonical artifacts without being interpreted as workflow commands. The
random token is not exposed to the model.

## Deployed and observed remotely

Expand Down
83 changes: 0 additions & 83 deletions upstreaming/gh_aw_log_guard.py

This file was deleted.

44 changes: 0 additions & 44 deletions upstreaming/tests/test_gh_aw_log_guard.py

This file was deleted.

14 changes: 14 additions & 0 deletions upstreaming/tests/test_workflow_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ def test_command_acknowledgement_is_fast_idempotent_and_not_serialized(self):
self.assertEqual(reconcile["concurrency"]["group"], "python-wheels-upstreaming-controller")
self.assertFalse(reconcile["concurrency"]["cancel-in-progress"])

def test_worker_brackets_untrusted_output_with_stop_commands(self):
worker = source("upstreaming-worker")
before = worker["pre-agent-steps"][0]
self.assertIn("openssl rand -hex 32", before["run"])
self.assertEqual(before["id"], "suspend_commands")
self.assertIn('echo "token=$token" >> "$GITHUB_OUTPUT"', before["run"])
self.assertIn("::stop-commands::%s", before["run"])
after = worker["post-steps"][0]
self.assertEqual(after["if"], "always()")
self.assertEqual(after["env"]["STOP_COMMANDS_TOKEN"],
"${{ steps.suspend_commands.outputs.token }}")
self.assertIn("printf '::%s::", after["run"])
self.assertNotIn("gh_aw_log_guard", (WF / "upstreaming-worker.md").read_text())

def test_worker_forbids_unrelated_fork_ci_debug_changes(self):
worker = source("upstreaming-worker")
self.assertNotIn("github", worker["tools"])
Expand Down