Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Summary

  • add model-scoped section extraction that mirrors the existing mode-specific behavior
  • thread the active model id through system message construction so matching content is emitted
  • document the Model: heading convention and cover it with unit tests

Testing

  • bun test v1.3.1 (89fa0f34)
  • Generated version.ts: v0.5.1-90-gfe3b2519 (fe3b251) at 2025-11-16T21:43:17Z
    [0] bun run node_modules/@typescript/native-preview/bin/tsgo.js --noEmit exited with code 0
    [1] bun run node_modules/@typescript/native-preview/bin/tsgo.js --noEmit -p tsconfig.main.json exited with code 0

_Generated with _

@ammar-agent ammar-agent force-pushed the agents-model-regex-parsing branch from fe3b251 to ae878c3 Compare November 16, 2025 21:46
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

if (customInstructions) {
systemMessage += `\n<custom-instructions>\n${customInstructions}\n</custom-instructions>`;
}

P1 Badge Model-specific instructions leak to every model

Docs now promise that ## Model: <regex> headings are scoped so that “only the content under the first matching heading is injected” (docs/instruction-files.md lines 65‑84), but buildSystemMessage still drops the entire AGENTS.md contents into <custom-instructions> before the model block is appended. Because customInstructions is the raw concatenation of global + workspace instructions, the code at these lines ensures every model still receives all ## Model: sections, even when the regex doesn’t match, making it impossible to write conflicting instructions per model. For example, adding both ## Model: sonnet and ## Model: /openai:.*/ results in the OpenAI run seeing the Sonnet text inside <custom-instructions>. The new feature therefore doesn’t actually scope instructions as documented; the unmatched sections must be removed (or never injected) before adding the model-specific block.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent ammar-agent force-pushed the agents-model-regex-parsing branch from c1edfcb to 91f8d5e Compare November 16, 2025 21:59
@ammario ammario enabled auto-merge November 16, 2025 23:28
@ammar-agent ammar-agent force-pushed the agents-model-regex-parsing branch 2 times, most recently from 0e257d0 to 501d96b Compare November 16, 2025 23:30
@ammario ammario added this pull request to the merge queue Nov 16, 2025
@ammario ammario removed this pull request from the merge queue due to a manual request Nov 16, 2025
@ammar-agent ammar-agent force-pushed the agents-model-regex-parsing branch from 501d96b to 9238822 Compare November 16, 2025 23:57
@ammario ammario merged commit 60b56ab into main Nov 17, 2025
15 checks passed
@ammario ammario deleted the agents-model-regex-parsing branch November 17, 2025 18:32
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.

2 participants