fix(codex): omit discovery and delegation guidance for empty tool allowlists (#160840)

This commit is contained in:
Peter Steinberger 2026-09-28 17:59:52 -07:00 • committed by GitHub
parent a6bc0f03b3
commit 2b8bee9583
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -153,6 +153,15 @@ describe("buildDeveloperInstructions credential routing", () => {
});
describe("buildDeveloperInstructions delegation guidance", () => {
it("omits discovery and delegation guidance for an explicitly empty tool allowlist", () => {
const params = createParams({ toolsAllow: [] });
const instructions = buildDeveloperInstructions(params);
expect(instructions).not.toContain("ALL_TOOLS");
expect(instructions).not.toContain("spawn_agent");
expect(buildDeveloperInstructions({ ...params, toolsAllow: undefined })).toContain("ALL_TOOLS");
});
it("shares the visible-session delegation policy with a canonical main session", () => {
const instructions = buildInstructions();

View file

@ -96,6 +96,7 @@ export function buildDeveloperInstructions(
}).join("\n");
const delegationGuidanceAvailable =
params.disableTools !== true &&
params.toolsAllow?.length !== 0 &&
params.delegationCapability !== "report_only" &&
!isMessageOnlyCodexSourceReply(params);
const nativeDelegationAvailable =