Skip to content

Conversation

@jpshackelford
Copy link
Contributor

@jpshackelford jpshackelford commented Jan 20, 2026

Summary

Adds a convention and automation for PR-specific artifacts (design docs, analysis notes, etc.) that should not be merged to main.

Closes #1763

Changes

  1. GitHub Actions workflow (.github/workflows/pr-artifacts.yml):

    • Posts a single notification comment when .pr/ directory is detected
    • Auto-removes .pr/ directory when a reviewer approves (non-fork PRs)
    • Check passes (green ✅) during development - no blocking errors
  2. AGENTS.md documentation for the .pr/ directory convention

Convention

Use a .pr/ directory at the repository root for PR-specific artifacts:

.pr/
├── design.md
├── analysis.md
└── notes.md

How It Works

Step What Happens
PR created with .pr/ Notification comment posted, checks pass (green)
PR approved .pr/ directory auto-removed via commit
PR merged Clean - no .pr/ artifacts in main

Fork PR Handling

PR Type On Approval Notes
Internal (same repo) Auto-removes .pr/ Fully automated
Fork Skips (no push access) Manual removal required

Benefits

  • Clear convention for PR-specific artifacts
  • Non-blocking workflow - checks stay green during development
  • Single notification comment (not spammy)
  • Automatic cleanup for internal PRs
  • Graceful fallback for forks

Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:1cac8fc-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-1cac8fc-python \
  ghcr.io/openhands/agent-server:1cac8fc-python

All tags pushed for this build

ghcr.io/openhands/agent-server:1cac8fc-golang-amd64
ghcr.io/openhands/agent-server:1cac8fc-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:1cac8fc-golang-arm64
ghcr.io/openhands/agent-server:1cac8fc-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:1cac8fc-java-amd64
ghcr.io/openhands/agent-server:1cac8fc-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:1cac8fc-java-arm64
ghcr.io/openhands/agent-server:1cac8fc-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:1cac8fc-python-amd64
ghcr.io/openhands/agent-server:1cac8fc-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:1cac8fc-python-arm64
ghcr.io/openhands/agent-server:1cac8fc-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:1cac8fc-golang
ghcr.io/openhands/agent-server:1cac8fc-java
ghcr.io/openhands/agent-server:1cac8fc-python

About Multi-Architecture Support

  • Each variant tag (e.g., 1cac8fc-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 1cac8fc-python-amd64) are also available if needed

Adds a GitHub Actions workflow that:
1. Auto-removes .pr/ directory when a reviewer approves (non-fork PRs)
2. Blocks merge if .pr/ directory still exists (catches fork PRs)

This establishes a convention for PR-specific artifacts (design docs,
analysis notes) that should not be merged to main.

Closes #1763

Co-authored-by: openhands <[email protected]>
- Add workflow_dispatch trigger for manual testing
- Add .pr/test-artifact.md to verify blocking behavior

Co-authored-by: openhands <[email protected]>
@jpshackelford jpshackelford marked this pull request as ready for review January 20, 2026 14:45
Copy link
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found several issues that should be addressed before merging. Most importantly: missing concurrency control and the test artifact will block merge until approval.

jpshackelford and others added 3 commits January 20, 2026 09:53
Document the .pr/ directory convention for storing PR-specific
design docs and analysis notes that should not be merged to main.

Co-authored-by: openhands <[email protected]>
@jpshackelford
Copy link
Contributor Author

Just realized this will mark every commit with failing check just because we have .pr and that isn't nice. Looking into merge queue or just adding notation as warning instead...

@jpshackelford jpshackelford marked this pull request as draft January 20, 2026 15:11
- Rename job to check-pr-artifacts
- Emit warning instead of error when .pr/ exists
- Remove exit 1 so checks pass (green) during development
- Trust auto-cleanup on approval to remove .pr/ before merge

Co-authored-by: openhands <[email protected]>
- Posts a comment to the PR conversation when .pr/ exists
- Uses a hidden marker to ensure only ONE comment is ever created
- Subsequent runs skip if comment already exists
- Added pull-requests: write permission for commenting

Co-authored-by: openhands <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

PR Artifacts Cleaned Up

The .pr/ directory has been automatically removed.

- Add 'How It Works' section explaining the 3-step flow
- Clarify that checks pass (green) during development
- Remove reference to blocking check

Co-authored-by: openhands <[email protected]>
@jpshackelford jpshackelford force-pushed the feat/pr-artifacts-workflow branch from 922a71b to 91cc45b Compare January 20, 2026 15:21
@jpshackelford jpshackelford marked this pull request as ready for review January 20, 2026 15:22
Copy link
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found several critical inconsistencies between the PR description and actual implementation. The workflow does not block merges as claimed.

openhands-agent and others added 6 commits January 20, 2026 15:31
- After auto-cleanup, update the notice comment to show cleanup completed
- Change icon from 📁 to ✅ and update message
- Added pull-requests: write permission to cleanup job

Co-authored-by: openhands <[email protected]>
Co-authored-by: OpenHands Bot <[email protected]>
xingyaoww
xingyaoww previously approved these changes Jan 20, 2026
@openhands-ai
Copy link

openhands-ai bot commented Jan 20, 2026

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • PR Artifacts

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #1764 at branch `feat/pr-artifacts-workflow`

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

@jpshackelford
Copy link
Contributor Author

@OpenHands -- looks like maybe we have bug in our GitHub workflow... Lets fix the workflow itself and test again with another approval rather than resolving the issue manually.

Run if [ -d ".pr" ]; then
rm '.pr/test-artifact.md'
[detached HEAD 31f5ef8] chore: Remove PR-only artifacts [automated]
1 file changed, 13 deletions(-)
delete mode 100644 .pr/test-artifact.md
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use

git push origin HEAD:<name-of-remote-branch>

Error: Failed to push cleanup commit. Check branch protection rules.
Error: Process completed with exit code 1.

@openhands-ai
Copy link

openhands-ai bot commented Jan 20, 2026

I'm on it! jpshackelford can track my progress at all-hands.dev

The workflow was checking out the PR head SHA which puts Git in a
detached HEAD state. This caused 'git push' to fail with:
  fatal: You are not currently on a branch.

Changed to checkout the branch ref instead, which allows normal
git push operations.

Co-authored-by: openhands <[email protected]>
@openhands-ai
Copy link

openhands-ai bot commented Jan 20, 2026

Summary

I fixed the bug in the PR artifacts workflow that was causing the push to fail with "fatal: You are not currently on a branch."

Root Cause

The workflow was checking out the PR head SHA (github.event.pull_request.head.sha), which puts Git in a detached HEAD state. When in detached HEAD, git push doesn't know which branch to push to.

Fix

Changed the checkout to use the branch ref instead (github.event.pull_request.head.ref):

-                  ref: ${{ github.event.pull_request.head.sha }}
+                  ref: ${{ github.event.pull_request.head.ref }}

This ensures Git is on the actual branch, allowing normal git push operations.

Checklist

  • Fixed the workflow bug as requested
  • Change is minimal and focused (1 line change)
  • Committed and pushed to feat/pr-artifacts-workflow branch

The PR is now ready for another approval to test the fix.

View full conversation

@jpshackelford jpshackelford dismissed xingyaoww’s stale review January 20, 2026 19:10

Retest the approval flow automation

xingyaoww
xingyaoww previously approved these changes Jan 20, 2026
github-actions bot and others added 5 commits January 20, 2026 19:19
Commits made with GITHUB_TOKEN don't trigger subsequent workflow runs
(to prevent infinite loops). This caused the PR checks UI to get stuck
showing only the Vercel check after the automated cleanup commit.

Switch to ALLHANDS_BOT_GITHUB_PAT (already used in todo-management.yml)
so that the cleanup commit properly triggers pre-commit, tests, and
other CI workflows.

Co-authored-by: openhands <[email protected]>
Since the PR is already approved when cleanup runs, there's no need
to re-run CI checks. Using [skip ci] in the commit message:

1. Skips all GitHub Actions workflows for the cleanup commit
2. Avoids the 'stuck checks' UI issue (no pending checks to wait for)
3. Doesn't require a PAT (simpler, more secure)
4. Is the standard convention supported by GitHub Actions

Co-authored-by: openhands <[email protected]>
The Vercel GitHub App creates check suites for this repo even though
there's nothing to deploy. These checks get stuck in 'queued' forever.

With [skip ci], GitHub Actions are skipped but Vercel still creates
its stuck check, which blocks merging.

Using the PAT triggers real CI workflows that complete successfully,
which satisfies branch protection requirements regardless of Vercel.

Note: The Vercel integration should be reconfigured at the org level
to exclude this repo, but that's outside the scope of this workflow.

Co-authored-by: openhands <[email protected]>
Adding back the test artifact so the workflow can be properly tested
when the PR receives another approval.

Co-authored-by: openhands <[email protected]>
@jpshackelford jpshackelford dismissed xingyaoww’s stale review January 20, 2026 19:51

We need to test automation again.

Copy link
Collaborator

@enyst enyst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this!

I suggested to add temporary scripts to it, but it's not a big deal if you feel there are concerns with it. It's because quite many times, I've done something like
"pick x example that is closest to the PR fix, modify a bit to show our fix, then run it, let's see"

That made edits into the examples files themselves, that were not meant for merge.

Maybe instead this allows something like "make a script in .pr like x example that is closest... etc"

@jpshackelford jpshackelford enabled auto-merge (squash) January 20, 2026 20:35
@jpshackelford jpshackelford merged commit b471909 into main Jan 20, 2026
18 checks passed
@jpshackelford jpshackelford deleted the feat/pr-artifacts-workflow branch January 20, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add .pr/ directory convention and auto-cleanup workflow

6 participants