mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
Merge branch 'codex/viyatb/hooks-trust-precedence' of github.com:openai/codex into codex/viyatb/pr15937-p3
This commit is contained in:
@@ -394,11 +394,28 @@ mod tests {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let marker_path = temp.path().join("project-ran");
|
||||
let (shell_program, shell_args, stopping_command, project_command) = if cfg!(windows) {
|
||||
let stopping_script = temp.path().join("stopping.cmd");
|
||||
std::fs::write(
|
||||
&stopping_script,
|
||||
r#"@echo off
|
||||
more > nul
|
||||
echo {"continue":false,"stopReason":"pause","hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"trusted context"}}
|
||||
"#,
|
||||
)?;
|
||||
let project_script = temp.path().join("project.cmd");
|
||||
std::fs::write(
|
||||
&project_script,
|
||||
r#"@echo off
|
||||
more > nul
|
||||
type nul > project-ran
|
||||
echo project context
|
||||
"#,
|
||||
)?;
|
||||
(
|
||||
"cmd.exe".to_string(),
|
||||
vec!["/D".to_string(), "/C".to_string()],
|
||||
r#"more > nul && echo {^"continue^":false,^"stopReason^":^"pause^",^"hookSpecificOutput^":{^"hookEventName^":^"SessionStart^",^"additionalContext^":^"trusted context^"}}"#.to_string(),
|
||||
"more > nul && type nul > project-ran && echo project context".to_string(),
|
||||
format!("\"{}\"", stopping_script.display()),
|
||||
format!("\"{}\"", project_script.display()),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
|
||||
@@ -451,11 +451,28 @@ mod tests {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let marker_path = temp.path().join("project-ran");
|
||||
let (shell_program, shell_args, stopping_command, project_command) = if cfg!(windows) {
|
||||
let stopping_script = temp.path().join("stopping.cmd");
|
||||
std::fs::write(
|
||||
&stopping_script,
|
||||
r#"@echo off
|
||||
more > nul
|
||||
echo {"decision":"block","reason":"slow down","hookSpecificOutput":{"hookEventName":"UserPromptSubmit","additionalContext":"trusted context"}}
|
||||
"#,
|
||||
)?;
|
||||
let project_script = temp.path().join("project.cmd");
|
||||
std::fs::write(
|
||||
&project_script,
|
||||
r#"@echo off
|
||||
more > nul
|
||||
type nul > project-ran
|
||||
echo project context
|
||||
"#,
|
||||
)?;
|
||||
(
|
||||
"cmd.exe".to_string(),
|
||||
vec!["/D".to_string(), "/C".to_string()],
|
||||
r#"more > nul && echo {^"decision^":^"block^",^"reason^":^"slow down^",^"hookSpecificOutput^":{^"hookEventName^":^"UserPromptSubmit^",^"additionalContext^":^"trusted context^"}}"#.to_string(),
|
||||
"more > nul && type nul > project-ran && echo project context".to_string(),
|
||||
format!("\"{}\"", stopping_script.display()),
|
||||
format!("\"{}\"", project_script.display()),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user