fix: preserve custom instructions (AGENTS.md) in CODEX mode#86
Closed
mosfor wants to merge 2 commits intonumman-ali:mainfrom
Closed
fix: preserve custom instructions (AGENTS.md) in CODEX mode#86mosfor wants to merge 2 commits intonumman-ali:mainfrom
mosfor wants to merge 2 commits intonumman-ali:mainfrom
Conversation
Fixes numman-ali#68 The plugin's request transformer was removing the entire OpenCode system prompt in CODEX mode, which inadvertently dropped custom instructions from AGENTS.md and other instruction files that OpenCode appends to the prompt. Changes: - Add extractCustomInstructions() to parse instruction blocks - Modify filterOpenCodeSystemPrompts() to extract and return custom instructions - Update transformRequestBody() to re-insert custom instructions after bridge message - Add tests to verify custom instruction extraction works correctly The fix extracts blocks starting with 'Instructions from:' before filtering the OpenCode prompt, then re-inserts them as separate developer messages, ensuring they are included in requests to the Codex API.
Owner
|
Closed by v4.3.0 (tag v4.3.0). Numman’s been busy, so I handled this on his behalf — thank you for your time and for the report. This was a tough job, but Sam Altman had my back getting it over the line. Release: https://github.com/numman-ali/opencode-openai-codex-auth/releases/tag/v4.3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #68 - The plugin was dropping custom instructions from
AGENTS.mdand other instruction files when using CODEX mode.Problem
In CODEX mode, the plugin filters out the entire OpenCode system prompt and replaces it with a Codex-compatible bridge message. However, OpenCode appends custom instruction files (like
AGENTS.md) directly into the system prompt. When the plugin filtered the prompt, it inadvertently dropped all custom instructions.Solution
Implemented the fix proposed in issue #68:
Instructions from:Changes
extractCustomInstructions()function to parse and extract instruction blocksfilterOpenCodeSystemPrompts()to return both filtered input and extracted custom instructionstransformRequestBody()to re-insert custom instructions after the bridge messageTesting
Impact
Users can now use custom instructions from
AGENTS.md, project-wide./AGENTS.md, and other instruction files with CODEX mode without losing their configurations.