mirror of
https://github.com/openai/codex.git
synced 2026-09-05 15:18:41 +00:00
Merge commit '22e9d5ff64c6c0be7563f15227d875ca097f2984' into bookholt/psec-4922-powershell-one-shot-policy
This commit is contained in:
@@ -1048,6 +1048,10 @@ async fn multiple_auto_compact_per_task_runs_after_token_limit_hit() {
|
||||
let codex = test_codex()
|
||||
.with_config(move |config| {
|
||||
config.model_provider.name = non_openai_provider_name;
|
||||
config
|
||||
.permissions
|
||||
.set_permission_profile(PermissionProfile::Disabled)
|
||||
.expect("set permission profile");
|
||||
})
|
||||
.build(&server)
|
||||
.await
|
||||
|
||||
@@ -15,6 +15,7 @@ use codex_protocol::dynamic_tools::DynamicToolNamespaceTool;
|
||||
use codex_protocol::dynamic_tools::DynamicToolSpec;
|
||||
use codex_protocol::items::TurnItem;
|
||||
use codex_protocol::models::ContentItem;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::protocol::ConversationStartParams;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
@@ -617,7 +618,12 @@ async fn assert_remote_manual_compact_request_parity(
|
||||
snapshot_name: &str,
|
||||
scenario: &str,
|
||||
) -> Result<()> {
|
||||
let mut builder = test_codex().with_auth(auth);
|
||||
let mut builder = test_codex().with_auth(auth).with_config(|config| {
|
||||
config
|
||||
.permissions
|
||||
.set_permission_profile(PermissionProfile::Disabled)
|
||||
.expect("set permission profile");
|
||||
});
|
||||
if let Some(service_tier) = configured_service_tier {
|
||||
builder = builder.with_config(move |config| {
|
||||
config.service_tier = Some(service_tier.request_value().to_string());
|
||||
@@ -1317,7 +1323,14 @@ async fn remote_compact_runs_automatically() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let harness = TestCodexHarness::with_builder(
|
||||
test_codex().with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing()),
|
||||
test_codex()
|
||||
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
|
||||
.with_config(|config| {
|
||||
config
|
||||
.permissions
|
||||
.set_permission_profile(PermissionProfile::Disabled)
|
||||
.expect("set permission profile");
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
let codex = harness.test().codex.clone();
|
||||
@@ -4208,6 +4221,10 @@ async fn snapshot_request_shape_remote_mid_turn_compaction_multi_summary_reinjec
|
||||
.with_auth(CodexAuth::create_dummy_chatgpt_auth_for_testing())
|
||||
.with_config(|config| {
|
||||
config.model_auto_compact_token_limit = Some(200);
|
||||
config
|
||||
.permissions
|
||||
.set_permission_profile(PermissionProfile::Disabled)
|
||||
.expect("set permission profile");
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -6,6 +6,7 @@ use anyhow::Result;
|
||||
use codex_features::Feature;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_protocol::config_types::ServiceTier;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
use codex_protocol::protocol::Op;
|
||||
use codex_protocol::protocol::RolloutItem;
|
||||
@@ -301,7 +302,11 @@ async fn run_manual_session(
|
||||
}
|
||||
response_bodies.push(after_compact_response_body(scenario.name));
|
||||
|
||||
let harness = build_harness(mode, settings, /*hooks*/ false).await?;
|
||||
let disable_permissions = scenario
|
||||
.steps
|
||||
.iter()
|
||||
.any(|step| matches!(step, Step::ShellTool));
|
||||
let harness = build_harness(mode, settings, /*hooks*/ false, disable_permissions).await?;
|
||||
let rollout_path = rollout_path(&harness);
|
||||
let codex = harness.test().codex.clone();
|
||||
|
||||
@@ -457,7 +462,13 @@ async fn run_manual_hook_session(mode: Mode) -> Result<Value> {
|
||||
compaction_v2_response_body(),
|
||||
],
|
||||
};
|
||||
let harness = build_harness(mode, RunSettings::default(), /*hooks*/ true).await?;
|
||||
let harness = build_harness(
|
||||
mode,
|
||||
RunSettings::default(),
|
||||
/*hooks*/ true,
|
||||
/*disable_permissions*/ false,
|
||||
)
|
||||
.await?;
|
||||
let codex = harness.test().codex.clone();
|
||||
responses::mount_sse_sequence(harness.server(), response_bodies).await;
|
||||
let compact_mock = mount_legacy_compact_if_needed(&harness, mode).await;
|
||||
@@ -492,12 +503,25 @@ async fn build_auto_harness(mode: Mode) -> Result<TestCodexHarness> {
|
||||
RunSettings::default(),
|
||||
/*hooks*/ false,
|
||||
Some(200),
|
||||
/*disable_permissions*/ false,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn build_harness(mode: Mode, settings: RunSettings, hooks: bool) -> Result<TestCodexHarness> {
|
||||
build_harness_inner(mode, settings, hooks, /*auto_compact_limit*/ None).await
|
||||
async fn build_harness(
|
||||
mode: Mode,
|
||||
settings: RunSettings,
|
||||
hooks: bool,
|
||||
disable_permissions: bool,
|
||||
) -> Result<TestCodexHarness> {
|
||||
build_harness_inner(
|
||||
mode,
|
||||
settings,
|
||||
hooks,
|
||||
/*auto_compact_limit*/ None,
|
||||
disable_permissions,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn build_harness_inner(
|
||||
@@ -505,6 +529,7 @@ async fn build_harness_inner(
|
||||
settings: RunSettings,
|
||||
hooks: bool,
|
||||
auto_compact_limit: Option<i64>,
|
||||
disable_permissions: bool,
|
||||
) -> Result<TestCodexHarness> {
|
||||
fs::create_dir_all(FIXED_CWD)?;
|
||||
let mut builder = test_codex()
|
||||
@@ -529,6 +554,12 @@ async fn build_harness_inner(
|
||||
if hooks {
|
||||
trust_discovered_hooks(config);
|
||||
}
|
||||
if disable_permissions {
|
||||
config
|
||||
.permissions
|
||||
.set_permission_profile(PermissionProfile::Disabled)
|
||||
.expect("set permission profile");
|
||||
}
|
||||
if mode == Mode::Legacy {
|
||||
let _ = config.features.disable(Feature::RemoteCompactionV2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user