mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
feat(core) Smart approvals on (#10286)
## Summary Turn on Smart Approvals by default ## Testing - [x] Updated unit tests
This commit is contained in:
committed by
GitHub
Unverified
parent
9327e99b28
commit
a8c9e386e7
@@ -464,12 +464,8 @@ pub const FEATURES: &[FeatureSpec] = &[
|
||||
FeatureSpec {
|
||||
id: Feature::RequestRule,
|
||||
key: "request_rule",
|
||||
stage: Stage::Experimental {
|
||||
name: "Smart approvals",
|
||||
menu_description: "Get smarter \"Don't ask again\" rule requests.",
|
||||
announcement: "NEW: Try Smart approvals to get smarter \"Don't ask again\" requests. Enable in /experimental!",
|
||||
},
|
||||
default_enabled: false,
|
||||
stage: Stage::Stable,
|
||||
default_enabled: true,
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::WindowsSandbox,
|
||||
|
||||
@@ -1576,7 +1576,7 @@ mod tests {
|
||||
// Build expected from the same helpers used by the builder.
|
||||
let mut expected: BTreeMap<String, ToolSpec> = BTreeMap::from([]);
|
||||
for spec in [
|
||||
create_exec_command_tool(false),
|
||||
create_exec_command_tool(true),
|
||||
create_write_stdin_tool(),
|
||||
create_list_mcp_resources_tool(),
|
||||
create_list_mcp_resource_templates_tool(),
|
||||
@@ -2410,7 +2410,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_shell_tool() {
|
||||
let tool = super::create_shell_tool(false);
|
||||
let tool = super::create_shell_tool(true);
|
||||
let ToolSpec::Function(ResponsesApiTool {
|
||||
description, name, ..
|
||||
}) = &tool
|
||||
@@ -2440,7 +2440,7 @@ Examples of valid command strings:
|
||||
|
||||
#[test]
|
||||
fn test_shell_command_tool() {
|
||||
let tool = super::create_shell_command_tool(false);
|
||||
let tool = super::create_shell_command_tool(true);
|
||||
let ToolSpec::Function(ResponsesApiTool {
|
||||
description, name, ..
|
||||
}) = &tool
|
||||
|
||||
@@ -320,7 +320,7 @@ async fn resume_includes_initial_messages_and_sends_prior_items() {
|
||||
.expect("prior assistant message");
|
||||
let pos_permissions = messages
|
||||
.iter()
|
||||
.position(|(role, text)| role == "developer" && text.contains("`approval_policy`"))
|
||||
.position(|(role, text)| role == "developer" && text.contains("<permissions instructions>"))
|
||||
.expect("permissions message");
|
||||
let pos_user_instructions = messages
|
||||
.iter()
|
||||
|
||||
@@ -83,7 +83,7 @@ async fn no_collaboration_instructions_by_default() -> Result<()> {
|
||||
let input = req.single_request().input();
|
||||
let dev_texts = developer_texts(&input);
|
||||
assert_eq!(dev_texts.len(), 1);
|
||||
assert!(dev_texts[0].contains("`approval_policy`"));
|
||||
assert!(dev_texts[0].contains("<permissions instructions>"));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ fn permissions_texts(input: &[serde_json::Value]) -> Vec<String> {
|
||||
.first()?
|
||||
.get("text")?
|
||||
.as_str()?;
|
||||
if text.contains("`approval_policy`") {
|
||||
if text.contains("<permissions instructions>") {
|
||||
Some(text.to_string())
|
||||
} else {
|
||||
None
|
||||
@@ -439,7 +439,7 @@ async fn permissions_message_includes_writable_roots() -> Result<()> {
|
||||
&sandbox_policy,
|
||||
AskForApproval::OnRequest,
|
||||
&Policy::empty(),
|
||||
false,
|
||||
true,
|
||||
test.config.cwd.as_path(),
|
||||
)
|
||||
.into_text();
|
||||
|
||||
Reference in New Issue
Block a user