This repository was archived by the owner on Aug 6, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
packages/agent/src/adapters/codex-app-server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,20 @@ describe("buildAppServerArgs", () => {
4242 ) ;
4343 } ) ;
4444
45+ it ( "lets a caller override the reviewer pin without emitting a shadowed duplicate" , ( ) => {
46+ const args = buildAppServerArgs ( {
47+ binaryPath : "/bundle/codex" ,
48+ apiBaseUrl : "https://gateway.example/v1" ,
49+ configOverrides : { approvals_reviewer : "auto_review" } ,
50+ } ) ;
51+
52+ // codex's `-c` is last-wins, so the default pin must not be emitted alongside
53+ // the caller's value — exactly one reviewer entry, and it's the caller's.
54+ expect ( args . filter ( ( arg ) => arg . startsWith ( "approvals_reviewer=" ) ) ) . toEqual (
55+ [ 'approvals_reviewer="auto_review"' ] ,
56+ ) ;
57+ } ) ;
58+
4559 it ( "forwards http headers as a quoted TOML inline table on the posthog provider" , ( ) => {
4660 const args = buildAppServerArgs ( {
4761 binaryPath : "/bundle/codex" ,
Original file line number Diff line number Diff line change @@ -126,9 +126,13 @@ export function buildAppServerArgs(
126126 // The host owns approvals (surfaced via approvals.ts → requestPermission). Codex's
127127 // guardian reviewer is enabled by default and routes approvals to its dedicated
128128 // `codex-auto-review` model, which our gateway's posthog_code allowlist doesn't
129- // serve — so every command review 403s. Pin codex's own default `user` reviewer
130- // so approval decisions stay with the host.
131- args . push ( "-c" , `approvals_reviewer="user"` ) ;
129+ // serve — so every command review 403s. Default codex's own `user` reviewer so
130+ // approval decisions stay with the host. Skipped when a caller sets the reviewer
131+ // via configOverrides (appended last, and codex's `-c` is last-wins) so we never
132+ // emit a conflicting duplicate that could shadow the pin back to the auto reviewer.
133+ if ( options . configOverrides ?. approvals_reviewer === undefined ) {
134+ args . push ( "-c" , `approvals_reviewer="user"` ) ;
135+ }
132136
133137 // Disable the user's ambient ~/.codex MCP servers so the adapter only exposes
134138 // MCP servers PostHog injects per-thread; otherwise codex fails connecting to them.
You can’t perform that action at this time.
0 commit comments