Skip to content

Commit 7fa76cf

Browse files
authored
Merge pull request #148 from github/edburns/remind-agent-to-stick-to-prompt
Add guardrails to prevent reference-impl-sync agent from skipping deterministic scripts
2 parents f88b8a0 + 1c6f97d commit 7fa76cf

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

.github/workflows/build-test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,39 @@ jobs:
8989
COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.path }}
9090
run: mvn verify
9191

92+
- name: Validate reference-impl-sync completeness
93+
if: >-
94+
github.event_name == 'pull_request' &&
95+
contains(github.event.pull_request.labels.*.name, 'reference-impl-sync')
96+
run: |
97+
git fetch origin main --depth=1
98+
CHANGED=$(git diff --name-only origin/main...HEAD)
99+
100+
# 1. .lastmerge must be updated (proves finish script ran)
101+
if echo "$CHANGED" | grep -q '^\\.lastmerge$'; then
102+
echo "✅ .lastmerge was updated (finish script ran)"
103+
else
104+
echo "❌ .lastmerge was not updated. The merge-reference-impl-finish.sh script"
105+
echo " must be run before this PR can merge. This script updates .lastmerge,"
106+
echo " syncs the CLI version in pom.xml, and syncs scripts/codegen/package.json."
107+
exit 1
108+
fi
109+
110+
# 2. If codegen inputs changed, generated output must also have changed
111+
if echo "$CHANGED" | grep -q '^scripts/codegen/'; then
112+
if echo "$CHANGED" | grep -q '^src/generated/java/'; then
113+
echo "✅ Codegen inputs changed and generated files were regenerated"
114+
else
115+
echo "❌ scripts/codegen/ was updated but src/generated/java/ has no changes."
116+
echo " The Codegen Check workflow should regenerate these files automatically."
117+
echo " If it hasn't run yet, wait for it to complete and push regenerated files."
118+
echo " Or run manually: cd scripts/codegen && npm ci && npm run generate"
119+
exit 1
120+
fi
121+
else
122+
echo "✅ No codegen input changes — regeneration not needed"
123+
fi
124+
92125
- name: Upload test results for site generation
93126
if: success() && github.ref == 'refs/heads/main'
94127
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,13 @@ Go to Step 3b.
104104
105105
### Instructions
106106
107-
Follow the [agentic-merge-reference-impl](.github/prompts/agentic-merge-reference-impl.prompt.md) prompt to port these changes to the Java SDK.
107+
**You MUST follow these steps in order. Do NOT improvise or skip scripts.**
108+
109+
1. ✅✅Read [.github/prompts/agentic-merge-reference-impl.prompt.md](.github/prompts/agentic-merge-reference-impl.prompt.md) in full before starting✅✅
110+
111+
❌❌Do NOT clone the reference implementation manually — the start script does this.❌❌
112+
❌❌Do NOT update .lastmerge manually — the finish script does this.❌❌
113+
❌❌Do NOT skip the finish script — it syncs codegen versions and updates .lastmerge.❌❌
108114
```
109115
4. After creating the issue, use the `assign_to_agent` safe-output tool to assign Copilot to the newly created issue.
110116

0 commit comments

Comments
 (0)