Support Codex pre-tool-use targets#1016
Conversation
|
Someone is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes Codex
PreToolUseenrichment so Codex-native tool payloads can produce file-scoped memory context instead of falling through the Claude-only tool-name filter.What changed
Edit/Read/Grepbehavior unchanged.apply_patch, parsing*** Add/Update/Delete File:patch headers fromtool_input.command(the shape observed from Codex Desktop),patch, orinput.exec_command/shell_command/Bash, parsing only simple single-command read/search/list forms.hooks.codex.jsonso Codex-native tool names route toPreToolUse.Why
The Codex plugin currently registers
PreToolUse, but the hook script only recognizes Claude-style tool names (edit,write,read,glob,grep). In a live Codex Desktop session,apply_patcharrived as:{ "tool_name": "apply_patch", "tool_input": { "command": "*** Begin Patch\n*** Update File: ..." } }That meant the hook exited before
/agentmemory/enrich, so file-scoped context injection was effectively inert for Codex patch edits.Validation
npm run buildnpx vitest run test/context-injection.test.ts test/codex-plugin.test.ts test/codex-connect-hooks.test.tsapply_patchevent recordedfiles: ["/tmp/agentmemory-pretool-live-proof.txt"],wouldInject: true,filteredWouldInject: true,exitCode: 0exec_commandpayload recordedfiles: ["/tmp/agentmemory-pretool-live-proof.txt"],terms: ["command-shape"],wouldInject: true,filteredWouldInject: true,exitCode: 0I also ran
npm test; it reached 1408 passing tests but failed on pre-existing/environment-sensitive cases unrelated to this change:hook-projecttests expecting the checkout basename to be exactlyagentmemorywhile this local clone resolved asagentmemory-upstream