@@ -2,7 +2,12 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test";
22import { mkdtempSync , rmSync } from "node:fs" ;
33import { tmpdir } from "node:os" ;
44import { join } from "node:path" ;
5- import { CODEX_GPT5_IDENTITY_LINE , NEUTRAL_IDENTITY_LINE , neutralizeIdentity } from "../src/adapters/identity" ;
5+ import {
6+ CODEX_GPT5_IDENTITY_LINE ,
7+ CODEX_GPT5_IDENTITY_LINE_AGENT ,
8+ NEUTRAL_IDENTITY_LINE ,
9+ neutralizeIdentity ,
10+ } from "../src/adapters/identity" ;
611import { createGoogleAdapter } from "../src/adapters/google" ;
712import { createKiroAdapter } from "../src/adapters/kiro" ;
813import { createOpenAIChatAdapter } from "../src/adapters/openai-chat" ;
@@ -23,6 +28,12 @@ describe("identity neutralization — central helper", () => {
2328 expect ( neutralizeIdentity ( SYS ) ) . toBe ( NEUTRAL_IDENTITY_LINE ) ;
2429 } ) ;
2530
31+ test ( "replaces the Codex CLI 0.145 'an agent' identity variant (#622)" , ( ) => {
32+ expect ( neutralizeIdentity ( CODEX_GPT5_IDENTITY_LINE_AGENT ) ) . toBe ( NEUTRAL_IDENTITY_LINE ) ;
33+ expect ( neutralizeIdentity ( "You are Codex, an agent based on GPT-5.4." ) ) . toBe ( NEUTRAL_IDENTITY_LINE ) ;
34+ expect ( neutralizeIdentity ( "You are Codex, an agent based on GPT-5.4.1." ) ) . toBe ( NEUTRAL_IDENTITY_LINE ) ;
35+ } ) ;
36+
2637 test ( "never emits the opencodex proxy identity" , ( ) => {
2738 const out = neutralizeIdentity ( `${ SYS } \n\nmore context` ) ;
2839 expect ( out ) . not . toMatch ( / o p e n c o d e x p r o x y / i) ;
@@ -32,6 +43,9 @@ describe("identity neutralization — central helper", () => {
3243
3344 test ( "leaves text without the GPT-5 line unchanged" , ( ) => {
3445 expect ( neutralizeIdentity ( "plain system text" ) ) . toBe ( "plain system text" ) ;
46+ expect ( neutralizeIdentity ( "You are Codex, helpful for reviewing PRs." ) ) . toBe (
47+ "You are Codex, helpful for reviewing PRs." ,
48+ ) ;
3549 } ) ;
3650
3751 test ( "neutral line still forbids GPT-5 / OpenAI self-reporting" , ( ) => {
0 commit comments