You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Copilot wrote:
> This file is runtime-imported by weekly-reference-impl-sync.lock.yml as the agent prompt, but its content is written as documentation rather than imperative agent instructions (e.g., it doesn’t tell the agent to read .lastmerge, clone, compare commits, and must call a safe-output tool). As a result, the agentic workflow may fail or behave unpredictably. Please restore the prior imperative, step-by-step instruction style (like the deleted weekly-upstream-sync.md), updated to the new reference-impl terminology, and ensure it explicitly requires calling create-issue/close-issue/noop as appropriate.
This document describes the `weekly-reference-impl-sync.yml` GitHub Actions workflow, which automates the detection of new changes in the official [Copilot SDK](https://github.com/github/copilot-sdk) and delegates the merge work to the Copilot coding agent.
44
+
# Weekly Reference Implementation Sync
46
45
47
-
## Overview
46
+
You are an automation agent that detects new reference implementation changes and creates GitHub issues. You do **NOT** perform any code merges, edits, or pushes. Do **NOT** invoke any skills (especially `agentic-merge-reference-impl`). Your only job is to check for changes and use safe-output tools to create or close issues.
48
47
49
-
The workflow runs on a **weekly schedule** (every Monday at 10:00 UTC) and can also be triggered manually. It does **not** perform the actual merge — instead, it detects reference implementation changes and creates a GitHub issue assigned to `copilot`, instructing the agent to follow the [agentic-merge-reference-impl](../prompts/agentic-merge-reference-impl.prompt.md) prompt to port the changes.
48
+
## Instructions
50
49
51
-
The agent must also create the Pull Request with the label `reference-impl-sync`. This allows the workflow to track the merge progress and avoid creating duplicate issues if the agent is still working on a previous sync.
50
+
Follow these steps exactly:
52
51
53
-
##Trigger
52
+
### Step 1: Read `.lastmerge`
54
53
55
-
| Trigger | Schedule |
56
-
|---|---|
57
-
|`schedule`| Every Monday at 10:00 UTC (`0 10 * * 1`) |
58
-
|`workflow_dispatch`| Manual trigger from the Actions tab |
54
+
Read the file `.lastmerge` in the repository root. It contains the SHA of the last reference implementation commit that was merged into this Java SDK.
59
55
60
-
##Workflow Steps
56
+
### Step 2: Check for reference implementation changes
61
57
62
-
### 1. Checkout repository
58
+
Clone the reference implementation repository and compare commits:
63
59
64
-
Checks out the repo to read the `.lastmerge` file, which contains the SHA of the last reference implementation commit that was merged into the Java SDK.
65
-
66
-
### 2. Check for reference implementation changes
67
-
68
-
- Reads the last merged commit hash from `.lastmerge`
69
-
- Clones the reference implementation `github/copilot-sdk` repository
70
-
- Compares `.lastmerge` against reference implementation `HEAD`
71
-
- If they match: sets `has_changes=false`
72
-
- If they differ: counts new commits, generates a summary (up to 20 most recent), and sets outputs (`commit_count`, `reference_impl_head`, `last_merge`, `summary`)
73
-
74
-
### 3. Close previous reference-impl-sync issues (when changes found)
Before creating a new issue, closes any existing open issues with the `reference-impl-sync` label. This prevents stale issues from accumulating when previous sync attempts were incomplete or superseded. Each closed issue receives a comment explaining it was superseded.
67
+
If `LAST_MERGE` equals `REFERENCE_IMPL_HEAD`, there are **no new changes**. Go to Step 3a.
79
68
80
-
### 4. Close stale reference-impl-sync issues (when no changes found)
69
+
If they differ, count the new commits and generate a summary:
SUMMARY=$(git log --oneline "$LAST_MERGE".."$REFERENCE_IMPL_HEAD"| head -20)
74
+
```
83
75
84
-
If the reference implementation is already up to date, closes any lingering open `reference-impl-sync` issues with a comment noting that no changes were detected. This handles the case where a previous issue was created but the changes were merged manually (updating `.lastmerge`) before the agent completed.
76
+
Go to Step 3b.
85
77
86
-
### 5. Create issue and assign to Copilot
78
+
### Step 3a: No changes detected
87
79
88
-
**Condition:**`has_changes == true`
80
+
1. Search for any open issues with the `reference-impl-sync` label using the GitHub MCP tools.
81
+
2. If there are open `reference-impl-sync` labeled issues, close each one using the `close_issue` safe-output tool with a comment: "No new reference implementation changes detected. The Java SDK is up to date. Closing."
82
+
3. Call the `noop` safe-output tool with message: "No new reference implementation changes since last merge (<LAST_MERGE>)."
83
+
4.**Stop here.** Do not proceed further.
89
84
90
-
Creates a new GitHub issue with:
85
+
### Step 3b: Changes detected
91
86
92
-
-**Title:**`Reference implementation sync: N new commits (YYYY-MM-DD)`
93
-
-**Label:**`reference-impl-sync`
94
-
-**Assignee:**`copilot`
95
-
-**Body:** Contains commit count, commit range links, a summary of recent commits, and a link to the merge prompt
87
+
1. Search for any open issues with the `refererce-impl-sync` label using the GitHub MCP tools.
88
+
2. Close each existing open `refererce-impl-sync` issue using the `close_issue` safe-output tool with a comment: "Superseded by a newer reference implementation sync check."
89
+
3. Create a new issue using the `create_issue` safe-output tool with:
90
+
-**Title:**`Reference Implementation sync: <COMMIT_COUNT> new commits (<YYYY-MM-DD>)`
91
+
-**Body:** Include the following information:
92
+
```
93
+
## Automated Reference Implementation Sync
96
94
97
-
The Copilot coding agent picks up the issue, creates a branch and PR, then follows the merge prompt to port the changes.
95
+
There are **<COMMIT_COUNT>** new commits in the [official Copilot SDK](https://github.com/github/copilot-sdk) since the last merge.
Follow the [agentic-merge-reference-impl](.github/prompts/agentic-merge-reference-impl.prompt.md) prompt to port these changes to the Java SDK.
109
+
```
110
+
4. After creating the issue, use the `assign_to_agent` safe-output tool to assign Copilot to the newly created issue.
144
111
145
-
## Related Files
112
+
## Important constraints
146
113
147
-
| File | Purpose |
148
-
|---|---|
149
-
|`.lastmerge`| Stores the SHA of the last merged reference implementation commit |
150
-
|[agentic-merge-reference-impl.prompt.md](../prompts/agentic-merge-reference-impl.prompt.md)| Detailed instructions the Copilot agent follows to port changes |
151
-
|`.github/scripts/reference-impl-sync/`| Helper scripts used by the merge prompt |
114
+
- **Do NOT edit any files**, create branches, or push code.
115
+
- **Do NOT invoke any skills** such as `agentic-merge-agentic-merge-reference-impl` or `commit-as-pull-request`.
116
+
- **Do NOT attempt to merge or port reference implementation changes.** That is done by a separate agent that picks up the issue you create.
117
+
- You **MUST** call at least one safe-output tool (`create_issue`, `close_issue`, `noop`, etc.) before finishing.
0 commit comments