Skip to content

Commit df6a925

Browse files
committed
Address very important comment by copilot.
@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.
1 parent e3f246a commit df6a925

File tree

1 file changed

+50
-84
lines changed

1 file changed

+50
-84
lines changed

.github/workflows/weekly-reference-impl-sync.md

Lines changed: 50 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -41,111 +41,77 @@ safe-outputs:
4141
noop:
4242
report-as-issue: false
4343
---
44-
# Weekly Reference Implementation Sync Agentic Workflow
45-
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
4645

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.
4847

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
5049

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:
5251

53-
## Trigger
52+
### Step 1: Read `.lastmerge`
5453

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.
5955

60-
## Workflow Steps
56+
### Step 2: Check for reference implementation changes
6157

62-
### 1. Checkout repository
58+
Clone the reference implementation repository and compare commits:
6359

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)
75-
76-
**Condition:** `has_changes == true`
60+
```bash
61+
LAST_MERGE=$(cat .lastmerge)
62+
git clone --quiet https://github.com/github/copilot-sdk.git /tmp/gh-aw/agent/refererce-impl
63+
cd /tmp/gh-aw/agent/refererce-impl
64+
REFERENCE_IMPL_HEAD=$(git rev-parse HEAD)
65+
```
7766

78-
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.
7968

80-
### 4. Close stale reference-impl-sync issues (when no changes found)
69+
If they differ, count the new commits and generate a summary:
8170

82-
**Condition:** `has_changes == false`
71+
```bash
72+
COMMIT_COUNT=$(git rev-list --count "$LAST_MERGE".."$REFERENCE_IMPL_HEAD")
73+
SUMMARY=$(git log --oneline "$LAST_MERGE".."$REFERENCE_IMPL_HEAD" | head -20)
74+
```
8375

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.
8577

86-
### 5. Create issue and assign to Copilot
78+
### Step 3a: No changes detected
8779

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.
8984

90-
Creates a new GitHub issue with:
85+
### Step 3b: Changes detected
9186

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
9694
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.
9896
99-
### 6. Summary
97+
- **Last merged commit:** [`<LAST_MERGE>`](https://github.com/github/copilot-sdk/commit/<LAST_MERGE>)
98+
- **Reference Implementation HEAD:** [`<REFERENCE_IMPL_HEAD>`](https://github.com/github/copilot-sdk/commit/<REFERENCE_IMPL_HEAD>)
10099
101-
Writes a GitHub Actions step summary with:
100+
### Recent reference implementation commits
102101
103-
- Whether changes were detected
104-
- Commit count and range
105-
- Recent reference implementation commits
106-
- Link to the created issue (if any)
102+
```
103+
<SUMMARY>
104+
```
107105
108-
## Flow Diagram
106+
### Instructions
109107
110-
```
111-
┌─────────────────────┐
112-
│ Schedule / Manual │
113-
└──────────┬──────────┘
114-
115-
116-
┌──────────────────────────┐
117-
│ Read .lastmerge │
118-
│ Clone reference impl SDK │
119-
│ Compare commits │
120-
└──────────┬───────────────┘
121-
122-
┌─────┴─────┐
123-
│ │
124-
changes? no changes
125-
│ │
126-
▼ ▼
127-
┌──────────┐ ┌──────────────────┐
128-
│ Close old│ │ Close stale │
129-
│ issues │ │ issues │
130-
└────┬─────┘ └──────────────────┘
131-
132-
133-
┌──────────────────────────┐
134-
│ Create issue assigned to │
135-
│ copilot │
136-
└──────────────────────────┘
137-
138-
139-
┌──────────────────────────┐
140-
│ Agent follows prompt to │
141-
│ port changes → PR │
142-
└──────────────────────────┘
143-
```
108+
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.
144111
145-
## Related Files
112+
## Important constraints
146113
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

Comments
 (0)