core-agent-ide/codex-cli
Michael Bolin fb6f798671
Removes computeAutoApproval() and tightens up canAutoApprove() as the source of truth (#126)
Previously, `parseToolCall()` was using `computeAutoApproval()`, which
was a somewhat parallel implementation of `canAutoApprove()` in order to
get `SafeCommandReason` metadata for presenting information to the user.
The only function that was using `SafeCommandReason` was
`useMessageGrouping()`, but it turns out that function was unused, so
this PR removes `computeAutoApproval()` and all code related to it.

More importantly, I believe this fixes
https://github.com/openai/codex/issues/87 because
`computeAutoApproval()` was calling `parse()` from `shell-quote` without
wrapping it in a try-catch. This PR updates `canAutoApprove()` to use a
tighter try-catch block that is specific to `parse()` and returns an
appropriate `SafetyAssessment` in the event of an error, based on the
`ApprovalPolicy`.

Signed-off-by: Michael Bolin <mbolin@openai.com>
2025-04-16 15:39:41 -07:00
..
examples Initial commit 2025-04-16 12:56:08 -04:00
scripts (fix) update Docker container scripts (#47) 2025-04-16 12:02:41 -07:00
src Removes computeAutoApproval() and tightens up canAutoApprove() as the source of truth (#126) 2025-04-16 15:39:41 -07:00
tests Back out @lib indirection in tsconfig.json (#111) 2025-04-16 14:16:53 -07:00
.dockerignore (fix) update Docker container scripts (#47) 2025-04-16 12:02:41 -07:00
.editorconfig Initial commit 2025-04-16 12:56:08 -04:00
.eslintrc.cjs Initial commit 2025-04-16 12:56:08 -04:00
build.mjs Initial commit 2025-04-16 12:56:08 -04:00
Dockerfile (fix) update Docker container scripts (#47) 2025-04-16 12:02:41 -07:00
ignore-react-devtools-plugin.js Initial commit 2025-04-16 12:56:08 -04:00
package-lock.json dotenv support (#122) 2025-04-16 15:33:12 -07:00
package.json dotenv support (#122) 2025-04-16 15:33:12 -07:00
require-shim.js Initial commit 2025-04-16 12:56:08 -04:00
tsconfig.json Back out @lib indirection in tsconfig.json (#111) 2025-04-16 14:16:53 -07:00