Skip to content

Conversation

@connorads
Copy link

@connorads connorads commented Jan 3, 2026

Fixes #68

The existing code assumed OpenCode would send the base prompt and AGENTS.md content in separate messages, but it turns out OpenCode concatenates everything into a single message. This caused the entire message (including AGENTS.md) to get filtered out.

The fix extracts AGENTS.md content by looking for the "Instructions from:" marker and preserving everything from that point onward as a separate developer message, while filtering out only the OpenCode base prompt.

Tested it locally with global and project AGENTS.md
Screen Shot 2026-01-03 at 1 22 16 PM

This is the behaviour before ❌
Screen Shot 2026-01-03 at 1 39 33 PM

@connorads connorads changed the title Preserve AGENTS.md in context fix: preserve AGENTS.md in context Jan 3, 2026
@connorads connorads marked this pull request as ready for review January 3, 2026 13:25

// Tests for concatenated messages (single message containing both prompt AND AGENTS.md)
// This is how OpenCode actually sends content (as of v1.0.164+).
// The tests above cover separate messages pattern which may also occur.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming that separate messages either used to happen or it was just assumed to happen in the original implementation.

This PR doesn't remove that behaviour. So if the OpenCode implementation does change to separate messages, then it should continue to work. If you don't like that, feel free to change it.

@numman-ali
Copy link
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
If you can, please follow and repost the release update on X: https://x.com/nummanali/status/2007975206711967764

@numman-ali numman-ali closed this Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Request transformer removes ~/.config/opencode/AGENTS.md

2 participants