Skip to content

fix(scan): use the registered scan ID in agent prompts - #296

Closed
dipeshbabu wants to merge 5 commits into
openai:mainfrom
dipeshbabu:agent/use-registered-scan-id
Closed

fix(scan): use the registered scan ID in agent prompts#296
dipeshbabu wants to merge 5 commits into
openai:mainfrom
dipeshbabu:agent/use-registered-scan-id

Conversation

@dipeshbabu

Copy link
Copy Markdown
Contributor

Fixes #290
Fixes #292

Summary

  • Build the agent prompt only after the workbench returns the authoritative scan ID.
  • Embed that ID directly in standard-scan artifact guidance and deep-scan MCP arguments.
  • Keep the corrected prompt when false-positive feedback is appended.
  • Cover standard and deep modes with and without feedback.

Root cause

The prompt was created before scan registration and referred to $CODEX_SECURITY_SCAN_ID. That placeholder is not expanded inside structured MCP arguments or agent-authored artifacts, so deep scans could send an invalid literal ID and standard scans could write a different UUID that finalization rejected.

Impact

Deep scans now call start_codex_security_deep_scan with the registered UUID, and all scan modes instruct the agent to use that same UUID in canonical artifacts.

Validation

  • pnpm dlx bun test --timeout 30000 ./tests-ts/api.test.ts --test-name-pattern "uses the registered scan ID in standard and deep prompts|encodes valid Unicode Git refs as data before sending the scan prompt|provides only reviewed false positives" — 3 passed
  • pnpm exec tsc --noEmit
  • pnpm exec prettier --check src/api.ts tests-ts/api.test.ts
  • git diff --check

The complete API test file reached 80 passing tests; its remaining nine tests are blocked in this local Windows environment by the existing credential-home ancestor ACL check.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator

Thanks for tracking this down and contributing the fix, @dipeshbabu, and thanks to @charle-z for the earlier investigation. I carried your original commits into #354, merged current main, preserved both contributors' credit, and added a small regression for scan-skill preflight. Our maintainer tooling cannot push directly to personal forks, so the follow-up lets the normal CI run without losing your work or authorship.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator

Thank you again for tracking this down and contributing the fix, @dipeshbabu! Your original commits and authorship were preserved in #354, which has now merged and resolved both linked issues. I am closing this PR because your fix has already landed through that contributor-preserving follow-up. We really appreciate your help improving Codex Security!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants