Skip to content

Commit ed1b1e3

Browse files
Copilotedburns
andauthored
Forbid agentic sync from modifying src/generated/java/ files
Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/38fdf90e-c98a-4df6-8954-3c965bdfb1f8 Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
1 parent cf7d988 commit ed1b1e3

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

.github/prompts/agentic-merge-reference-impl.prompt.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,43 @@
22

33
You are an expert Java developer tasked with porting changes from the reference implementation of the Copilot SDK (primarily the .NET implementation) to this Java SDK.
44

5+
## ❌❌❌ ABSOLUTE PROHIBITION: DO NOT TOUCH GENERATED CODE ❌❌❌
6+
7+
> ### 🚫 THE FILES UNDER `src/generated/java/` ARE FORBIDDEN 🚫
8+
>
9+
> **NEVER, UNDER ANY CIRCUMSTANCES, MODIFY ANY FILE IN `src/generated/java/`.**
10+
>
11+
> These files are AUTO-GENERATED by `scripts/codegen/java.ts` and MUST NOT be hand-edited.
12+
> They are regenerated automatically when the `@github/copilot` npm package version is updated.
13+
>
14+
> ❌ DO NOT edit `src/generated/java/**/*.java`
15+
> ❌ DO NOT create new files in `src/generated/java/`
16+
> ❌ DO NOT delete files from `src/generated/java/`
17+
> ❌ DO NOT "fix" or "improve" generated code — it will be overwritten
18+
>
19+
> **IF ANY CHANGE YOU NEED TO MAKE REQUIRES TOUCHING `src/generated/java/`:**
20+
>
21+
> 1. **STOP IMMEDIATELY** — do not make the change
22+
> 2. **FAIL the agentic sync** — do not attempt to work around this restriction
23+
> 3. **Push an explanatory commit** with a message such as:
24+
> ```
25+
> SYNC BLOCKED: Required change needs generated code update
26+
>
27+
> The reference implementation change '<description>' requires updates
28+
> to the generated RPC/event types in src/generated/java/. These files
29+
> cannot be hand-edited — they must be regenerated.
30+
>
31+
> ACTION REQUIRED: Re-run the update-copilot-dependency.yml workflow
32+
> to update the @github/copilot npm package and regenerate the Java
33+
> source files before this sync can be completed.
34+
> ```
35+
> 4. **Document in the PR body** which reference implementation changes were blocked and why
36+
> 5. **Do NOT attempt to work around this restriction** by making equivalent changes elsewhere
37+
>
38+
> The correct way to update generated code is:
39+
> - Trigger the `update-copilot-dependency.yml` workflow with the new `@github/copilot` version
40+
> - That workflow updates `package.json`, regenerates all files in `src/generated/java/`, and opens a PR
41+
542
## ⚠️ IMPORTANT: Java SDK Design Takes Priority
643
744
**The current design and architecture of the Java SDK is the priority.** When porting changes from the reference implementation:
@@ -101,7 +138,7 @@ For each change in the reference implementation diff, determine:
101138
| `dotnet/src/Client.cs` | `src/main/java/com/github/copilot/sdk/CopilotClient.java` |
102139
| `dotnet/src/Session.cs` | `src/main/java/com/github/copilot/sdk/CopilotSession.java` |
103140
| `dotnet/src/Types.cs` | `src/main/java/com/github/copilot/sdk/types/*.java` |
104-
| `dotnet/src/Generated/*.cs` | `src/main/java/com/github/copilot/sdk/types/*.java` |
141+
| `dotnet/src/Generated/*.cs` | **DO NOT TOUCH** `src/generated/java/**` — see top of this file |
105142
| `dotnet/test/*.cs` | `src/test/java/com/github/copilot/sdk/*Test.java` |
106143
| `docs/getting-started.md` | `README.md` and `src/site/markdown/*.md` |
107144
| `docs/*.md` (new files) | `src/site/markdown/*.md` + update `src/site/site.xml` |
@@ -111,6 +148,10 @@ For each change in the reference implementation diff, determine:
111148
112149
## Step 5: Apply Changes to Java SDK
113150

151+
> ### ❌❌❌ REMINDER: `src/generated/java/` IS FORBIDDEN ❌❌❌
152+
> Any change that requires modifying `src/generated/java/` MUST stop the sync.
153+
> See the **ABSOLUTE PROHIBITION** section at the top of this file for required actions.
154+
114155
When porting changes:
115156

116157
### ⚠️ Priority: Preserve Java SDK Design
@@ -400,6 +441,7 @@ Before finishing:
400441

401442
## Checklist
402443

444+
- [ ]**VERIFIED: No files in `src/generated/java/` were modified** (if any were needed, sync was stopped per ABSOLUTE PROHIBITION above)
403445
- [ ] New branch created from `main`
404446
- [ ] Copilot CLI updated to latest version
405447
- [ ] README.md updated with minimum CLI version requirement
@@ -430,6 +472,7 @@ Before finishing:
430472

431473
## Notes
432474

475+
- ❌❌❌ **`src/generated/java/` IS FORBIDDEN** — NEVER modify generated files; re-run `update-copilot-dependency.yml` instead ❌❌❌
433476
- The reference implementation SDK is at: `https://github.com/github/copilot-sdk.git`
434477
- Primary reference implementation is in `dotnet/` folder
435478
- This Java SDK targets Java 17+

.github/prompts/coding-agent-merge-reference-impl-instructions.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,17 @@ Add the 'reference-impl-sync' label to the existing PR by running this command i
1717
If after analyzing the reference implementation diff there are no relevant changes to port to the Java SDK,
1818
push an empty commit with a message explaining why no changes were needed, so the PR reflects
1919
the analysis outcome. The repository maintainer will close the PR and issue manually.
20+
21+
❌❌❌ ABSOLUTE PROHIBITION ❌❌❌
22+
23+
NEVER MODIFY ANY FILE UNDER src/generated/java/ — THESE FILES ARE AUTO-GENERATED AND FORBIDDEN.
24+
25+
If any change requires modifying src/generated/java/:
26+
1. STOP IMMEDIATELY — do not make the change
27+
2. FAIL the sync with an explanatory commit message
28+
3. Instruct the maintainer to re-run update-copilot-dependency.yml to regenerate these files
29+
30+
See the ABSOLUTE PROHIBITION section in .github/prompts/agentic-merge-reference-impl.prompt.md
31+
for the full required procedure and commit message template.
32+
33+
❌❌❌ END ABSOLUTE PROHIBITION ❌❌❌

0 commit comments

Comments
 (0)