-
Notifications
You must be signed in to change notification settings - Fork 49
fix: minimal system prompt sanitization #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: minimal system prompt sanitization #34
Conversation
Instead of replacing all OpenCode/opencode references in system prompts, only replace the specific blocked string 'You are OpenCode, the best coding agent on the planet.' with the Claude Code equivalent. This is a more targeted fix as the API only checks for that specific identity string, not all mentions of OpenCode.
…m-prompt-sanitization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes critical authentication issues (issues #33, #32, #12) where Anthropic began blocking requests with "credential only authorized for Claude Code" errors. The fix changes the system prompt sanitization from broad regex replacements to a minimal, targeted string replacement to avoid detection.
Changes:
- Replaced broad regex replacements (
/OpenCode/g,/opencode/gi) with a single specific string replacement to minimize detection surface - Bumped version from 0.0.13 to 0.0.14
- Added AGENTS.md documentation with plugin testing instructions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| package.json | Version bump to 0.0.14 |
| index.mjs | Changed system prompt sanitization from broad regex to targeted string replacement |
| AGENTS.md | New documentation file with testing instructions and feature list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
before merge: #33 (comment) |
|
have you tested this? I just tried this and this doesn't patch the issue. This PR is a moot |
|
Did you follow instructions in AGENTS.md? @coleleavitt |
I found the proper fix to this. I got a custom fork with a variety of features in addition to the upstream version |
|
This works. Since the "You are Claude Code, Anthropic's official CLI for Claude." spoof is automatically injected by OpenCode itself, the simpler solution is to do nothing. |
Followed the guide, got error. |
Fixes the plugin by only replacing the specific OpenCode identity string instead of broader replacements that were causing Anthropic to block requests.
Also adds AGENTS.md with plugin testing instructions.
Fixes #33, fixes #32, fixes #12