Apply argument comment lint across codex-rs

This commit is contained in:
Michael Bolin
2026-03-13 17:49:10 -07:00
parent f9165c43e8
commit b25c9d75e8
167 changed files with 1321 additions and 725 deletions
+37 -7
View File
@@ -14,6 +14,7 @@ jobs:
name: Detect changed areas
runs-on: ubuntu-24.04
outputs:
argument_comment_lint: ${{ steps.detect.outputs.argument_comment_lint }}
codex: ${{ steps.detect.outputs.codex }}
workflows: ${{ steps.detect.outputs.workflows }}
steps:
@@ -39,12 +40,15 @@ jobs:
fi
codex=false
argument_comment_lint=false
workflows=false
for f in "${files[@]}"; do
[[ $f == codex-rs/* ]] && codex=true
[[ $f == codex-rs/* || $f == tools/argument-comment-lint/* || $f == justfile ]] && argument_comment_lint=true
[[ $f == .github/* ]] && workflows=true
done
echo "argument_comment_lint=$argument_comment_lint" >> "$GITHUB_OUTPUT"
echo "codex=$codex" >> "$GITHUB_OUTPUT"
echo "workflows=$workflows" >> "$GITHUB_OUTPUT"
@@ -83,6 +87,26 @@ jobs:
- name: cargo shear
run: cargo shear
argument_comment_lint:
name: Argument comment lint
runs-on: ubuntu-24.04
needs: changed
if: ${{ needs.changed.outputs.argument_comment_lint == 'true' || needs.changed.outputs.workflows == 'true' || github.event_name == 'push' }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly-2025-09-18
with:
components: llvm-tools-preview, rustc-dev, rust-src
- name: Install cargo-dylint tooling
run: cargo install --locked cargo-dylint dylint-link
- name: Test argument comment lint package
working-directory: tools/argument-comment-lint
run: cargo test
- name: Run argument comment lint on codex-rs
run: |
bash -n tools/argument-comment-lint/run.sh
./tools/argument-comment-lint/run.sh
# --- CI to validate on different os/targets --------------------------------
lint_build:
name: Lint/Build — ${{ matrix.runner }} - ${{ matrix.target }}${{ matrix.profile == 'release' && ' (release)' || '' }}
@@ -657,13 +681,14 @@ jobs:
# --- Gatherer job that you mark as the ONLY required status -----------------
results:
name: CI results (required)
needs: [changed, general, cargo_shear, lint_build, tests]
needs: [changed, general, cargo_shear, argument_comment_lint, lint_build, tests]
if: always()
runs-on: ubuntu-24.04
steps:
- name: Summarize
shell: bash
run: |
echo "arglint: ${{ needs.argument_comment_lint.result }}"
echo "general: ${{ needs.general.result }}"
echo "shear : ${{ needs.cargo_shear.result }}"
echo "lint : ${{ needs.lint_build.result }}"
@@ -671,16 +696,21 @@ jobs:
# If nothing relevant changed (PR touching only root README, etc.),
# declare success regardless of other jobs.
if [[ '${{ needs.changed.outputs.codex }}' != 'true' && '${{ needs.changed.outputs.workflows }}' != 'true' && '${{ github.event_name }}' != 'push' ]]; then
if [[ '${{ needs.changed.outputs.argument_comment_lint }}' != 'true' && '${{ needs.changed.outputs.codex }}' != 'true' && '${{ needs.changed.outputs.workflows }}' != 'true' && '${{ github.event_name }}' != 'push' ]]; then
echo 'No relevant changes -> CI not required.'
exit 0
fi
# Otherwise require the jobs to have succeeded
[[ '${{ needs.general.result }}' == 'success' ]] || { echo 'general failed'; exit 1; }
[[ '${{ needs.cargo_shear.result }}' == 'success' ]] || { echo 'cargo_shear failed'; exit 1; }
[[ '${{ needs.lint_build.result }}' == 'success' ]] || { echo 'lint_build failed'; exit 1; }
[[ '${{ needs.tests.result }}' == 'success' ]] || { echo 'tests failed'; exit 1; }
if [[ '${{ needs.changed.outputs.argument_comment_lint }}' == 'true' || '${{ needs.changed.outputs.workflows }}' == 'true' || '${{ github.event_name }}' == 'push' ]]; then
[[ '${{ needs.argument_comment_lint.result }}' == 'success' ]] || { echo 'argument_comment_lint failed'; exit 1; }
fi
if [[ '${{ needs.changed.outputs.codex }}' == 'true' || '${{ needs.changed.outputs.workflows }}' == 'true' || '${{ github.event_name }}' == 'push' ]]; then
[[ '${{ needs.general.result }}' == 'success' ]] || { echo 'general failed'; exit 1; }
[[ '${{ needs.cargo_shear.result }}' == 'success' ]] || { echo 'cargo_shear failed'; exit 1; }
[[ '${{ needs.lint_build.result }}' == 'success' ]] || { echo 'lint_build failed'; exit 1; }
[[ '${{ needs.tests.result }}' == 'success' ]] || { echo 'tests failed'; exit 1; }
fi
- name: sccache summary note
if: always()
+2 -2
View File
@@ -182,7 +182,7 @@ pub fn generate_ts_with_options(
}
pub fn generate_json(out_dir: &Path) -> Result<()> {
generate_json_with_experimental(out_dir, false)
generate_json_with_experimental(out_dir, /*experimental_api=*/ false)
}
pub fn generate_json_with_experimental(out_dir: &Path, experimental_api: bool) -> Result<()> {
@@ -1984,7 +1984,7 @@ pub(crate) fn generate_index_ts_tree(tree: &mut BTreeMap<PathBuf, String>) {
if !v2_entries.is_empty() {
tree.insert(
PathBuf::from("v2").join("index.ts"),
index_ts_entries(&v2_entries, false),
index_ts_entries(&v2_entries, /*has_v2_ts=*/ false),
);
}
}
@@ -201,7 +201,7 @@ impl ThreadHistoryBuilder {
let mut turn = self
.current_turn
.take()
.unwrap_or_else(|| self.new_turn(None));
.unwrap_or_else(|| self.new_turn(/*id=*/ None));
let id = self.next_item_id();
let content = self.build_user_inputs(payload);
turn.items.push(ThreadItem::UserMessage { id, content });
@@ -937,7 +937,7 @@ impl ThreadHistoryBuilder {
fn ensure_turn(&mut self) -> &mut PendingTurn {
if self.current_turn.is_none() {
let turn = self.new_turn(None);
let turn = self.new_turn(/*id=*/ None);
return self.current_turn.insert(turn);
}
+2 -2
View File
@@ -657,7 +657,7 @@ pub async fn send_message_v2(
&endpoint,
config_overrides,
user_message,
true,
/*experimental_api=*/ true,
dynamic_tools,
)
.await
@@ -1510,7 +1510,7 @@ impl CodexClient {
}
fn initialize(&mut self) -> Result<InitializeResponse> {
self.initialize_with_experimental_api(true)
self.initialize_with_experimental_api(/*experimental_api=*/ true)
}
fn initialize_with_experimental_api(
@@ -78,7 +78,7 @@ pub(crate) fn typed_request_span(
.or(session.client_version.as_deref()),
);
attach_parent_context(&span, &method, request.id(), None);
attach_parent_context(&span, &method, request.id(), /*parent_trace=*/ None);
span
}
@@ -1914,7 +1914,7 @@ async fn handle_turn_interrupted(
conversation_id,
event_turn_id,
TurnStatus::Interrupted,
None,
/*error=*/ None,
outgoing,
)
.await;
@@ -2503,7 +2503,7 @@ async fn on_command_execution_request_approval_response(
item_id.clone(),
completion_item.command,
completion_item.cwd,
None,
/*process_id=*/ None,
completion_item.command_actions,
status,
&outgoing,
@@ -446,7 +446,7 @@ impl CodexMessageProcessor {
}
pub(crate) async fn maybe_start_curated_repo_sync_for_latest_config(&self) {
match self.load_latest_config(None).await {
match self.load_latest_config(/*fallback_cwd=*/ None).await {
Ok(config) => self
.thread_manager
.plugins_manager()
@@ -2085,7 +2085,7 @@ impl CodexMessageProcessor {
otel.name = "app_server.thread_start.resolve_status",
))
.await,
false,
/*has_in_progress_turn=*/ false,
);
let response = ThreadStartResponse {
@@ -2530,7 +2530,7 @@ impl CodexMessageProcessor {
self.thread_watch_manager
.loaded_status_for_thread(&thread.id)
.await,
false,
/*has_in_progress_turn=*/ false,
);
self.outgoing
@@ -2842,7 +2842,7 @@ impl CodexMessageProcessor {
self.thread_watch_manager
.loaded_status_for_thread(&thread.id)
.await,
false,
/*has_in_progress_turn=*/ false,
);
self.attach_thread_name(thread_id, &mut thread).await;
let thread_id = thread.id.clone();
@@ -3316,8 +3316,13 @@ impl CodexMessageProcessor {
for connection_id in connection_ids {
Self::log_listener_attach_result(
self.ensure_conversation_listener(thread_id, connection_id, false, ApiVersion::V2)
.await,
self.ensure_conversation_listener(
thread_id,
connection_id,
/*raw_events_enabled=*/ false,
ApiVersion::V2,
)
.await,
thread_id,
connection_id,
"thread",
@@ -3450,7 +3455,7 @@ impl CodexMessageProcessor {
self.ensure_conversation_listener(
thread_id,
request_id.connection_id,
false,
/*raw_events_enabled=*/ false,
ApiVersion::V2,
)
.await,
@@ -3482,7 +3487,11 @@ impl CodexMessageProcessor {
.loaded_status_for_thread(&thread.id)
.await;
set_thread_status_and_interrupt_stale_turns(&mut thread, thread_status, false);
set_thread_status_and_interrupt_stale_turns(
&mut thread,
thread_status,
/*has_live_in_progress_turn=*/ false,
);
let response = ThreadResumeResponse {
thread,
@@ -3799,7 +3808,7 @@ impl CodexMessageProcessor {
if let Err(message) = populate_thread_turns(
&mut thread,
ThreadTurnSource::HistoryItems(&history_items),
None,
/*active_turn=*/ None,
)
.await
{
@@ -3914,7 +3923,7 @@ impl CodexMessageProcessor {
sandbox,
base_instructions,
developer_instructions,
None,
/*personality=*/ None,
);
typesafe_overrides.ephemeral = ephemeral.then_some(true);
// Derive a Config using the same logic as new conversation, honoring overrides if provided.
@@ -3985,7 +3994,7 @@ impl CodexMessageProcessor {
self.ensure_conversation_listener(
thread_id,
request_id.connection_id,
false,
/*raw_events_enabled=*/ false,
ApiVersion::V2,
)
.await,
@@ -4019,7 +4028,8 @@ impl CodexMessageProcessor {
} else {
let config_snapshot = forked_thread.config_snapshot().await;
// forked thread names do not inherit the source thread name
let mut thread = build_thread_from_snapshot(thread_id, &config_snapshot, None);
let mut thread =
build_thread_from_snapshot(thread_id, &config_snapshot, /*path=*/ None);
let history_items = match read_rollout_items_from_rollout(rollout_path.as_path()).await
{
Ok(items) => items,
@@ -4039,7 +4049,7 @@ impl CodexMessageProcessor {
if let Err(message) = populate_thread_turns(
&mut thread,
ThreadTurnSource::HistoryItems(&history_items),
None,
/*active_turn=*/ None,
)
.await
{
@@ -4053,7 +4063,7 @@ impl CodexMessageProcessor {
&& let Err(message) = populate_thread_turns(
&mut thread,
ThreadTurnSource::RolloutPath(fork_rollout_path.as_path()),
None,
/*active_turn=*/ None,
)
.await
{
@@ -4069,7 +4079,7 @@ impl CodexMessageProcessor {
self.thread_watch_manager
.loaded_status_for_thread(&thread.id)
.await,
false,
/*has_in_progress_turn=*/ false,
);
let response = ThreadForkResponse {
@@ -4381,7 +4391,7 @@ impl CodexMessageProcessor {
params: ExperimentalFeatureListParams,
) {
let ExperimentalFeatureListParams { cursor, limit } = params;
let config = match self.load_latest_config(None).await {
let config = match self.load_latest_config(/*fallback_cwd=*/ None).await {
Ok(config) => config,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
@@ -4496,7 +4506,7 @@ impl CodexMessageProcessor {
}
async fn mcp_server_refresh(&self, request_id: ConnectionRequestId, _params: Option<()>) {
let config = match self.load_latest_config(None).await {
let config = match self.load_latest_config(/*fallback_cwd=*/ None).await {
Ok(config) => config,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
@@ -4555,7 +4565,7 @@ impl CodexMessageProcessor {
request_id: ConnectionRequestId,
params: McpServerOauthLoginParams,
) {
let config = match self.load_latest_config(None).await {
let config = match self.load_latest_config(/*fallback_cwd=*/ None).await {
Ok(config) => config,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
@@ -4667,7 +4677,7 @@ impl CodexMessageProcessor {
let request = request_id.clone();
let outgoing = Arc::clone(&self.outgoing);
let config = match self.load_latest_config(None).await {
let config = match self.load_latest_config(/*fallback_cwd=*/ None).await {
Ok(config) => config,
Err(error) => {
self.outgoing.send_error(request, error).await;
@@ -4839,7 +4849,7 @@ impl CodexMessageProcessor {
async fn finalize_thread_teardown(&mut self, thread_id: ThreadId) {
self.pending_thread_unloads.lock().await.remove(&thread_id);
self.outgoing
.cancel_requests_for_thread(thread_id, None)
.cancel_requests_for_thread(thread_id, /*error=*/ None)
.await;
self.thread_state_manager
.remove_thread_state(thread_id)
@@ -4902,7 +4912,7 @@ impl CodexMessageProcessor {
// Any pending app-server -> client requests for this thread can no longer be
// answered; cancel their callbacks before shutdown/unload.
self.outgoing
.cancel_requests_for_thread(thread_id, None)
.cancel_requests_for_thread(thread_id, /*error=*/ None)
.await;
self.thread_state_manager
.remove_thread_state(thread_id)
@@ -5075,7 +5085,7 @@ impl CodexMessageProcessor {
}
async fn apps_list(&self, request_id: ConnectionRequestId, params: AppsListParams) {
let mut config = match self.load_latest_config(None).await {
let mut config = match self.load_latest_config(/*fallback_cwd=*/ None).await {
Ok(config) => config,
Err(error) => {
self.outgoing.send_error(request_id, error).await;
@@ -5372,7 +5382,7 @@ impl CodexMessageProcessor {
} = params;
let roots = cwds.unwrap_or_default();
let mut config = match self.load_latest_config(None).await {
let mut config = match self.load_latest_config(/*fallback_cwd=*/ None).await {
Ok(config) => config,
Err(err) => {
self.outgoing.send_error(request_id, err).await;
@@ -5405,7 +5415,7 @@ impl CodexMessageProcessor {
}
}
config = match self.load_latest_config(None).await {
config = match self.load_latest_config(/*fallback_cwd=*/ None).await {
Ok(config) => config,
Err(err) => {
self.outgoing.send_error(request_id, err).await;
@@ -6025,7 +6035,7 @@ impl CodexMessageProcessor {
.ensure_conversation_listener(
thread_id,
request_id.connection_id,
false,
/*raw_events_enabled=*/ false,
ApiVersion::V2,
)
.await
@@ -6320,7 +6330,7 @@ impl CodexMessageProcessor {
self.ensure_conversation_listener(
thread_id,
request_id.connection_id,
false,
/*raw_events_enabled=*/ false,
ApiVersion::V2,
)
.await,
@@ -6341,7 +6351,7 @@ impl CodexMessageProcessor {
self.thread_watch_manager
.loaded_status_for_thread(&thread.id)
.await,
false,
/*has_in_progress_turn=*/ false,
);
let notif = ThreadStartedNotification { thread };
self.outgoing
@@ -7029,7 +7039,7 @@ impl CodexMessageProcessor {
tokio::spawn(async move {
let derived_config = derive_config_for_cwd(
&cli_overrides,
None,
/*request_overrides=*/ None,
ConfigOverrides {
cwd: Some(command_cwd.clone()),
..Default::default()
+2 -2
View File
@@ -390,8 +390,8 @@ fn start_uninitialized(args: InProcessStartArgs) -> InProcessClientHandle {
Arc::clone(&outbound_initialized),
Arc::clone(&outbound_experimental_api_enabled),
Arc::clone(&outbound_opted_out_notification_methods),
true,
None,
/*allow_legacy_notifications=*/ true,
/*disconnect_sender=*/ None,
),
);
let mut outbound_handle = tokio::spawn(async move {
+6 -2
View File
@@ -332,7 +332,7 @@ impl MessageProcessor {
request_id.clone(),
codex_request,
session,
None,
/*outbound_initialized=*/ None,
request_context.clone(),
)
.await;
@@ -358,7 +358,11 @@ impl MessageProcessor {
};
let request_span =
crate::app_server_tracing::typed_request_span(&request, connection_id, session);
let request_context = RequestContext::new(request_id.clone(), request_span, None);
let request_context = RequestContext::new(
request_id.clone(),
request_span,
/*parent_trace=*/ None,
);
tracing::trace!(
?connection_id,
request_id = ?request_id.request_id,
+4 -1
View File
@@ -234,7 +234,10 @@ impl OutgoingMessageSender {
&self,
request: ServerRequestPayload,
) -> (RequestId, oneshot::Receiver<ClientRequestResult>) {
self.send_request_to_connections(None, request, None).await
self.send_request_to_connections(
/*connection_ids=*/ None, request, /*thread_id=*/ None,
)
.await
}
fn next_request_id(&self) -> RequestId {
+1 -1
View File
@@ -261,7 +261,7 @@ impl ThreadStateManager {
{
let mut thread_state_guard = thread_state.lock().await;
if experimental_raw_events {
thread_state_guard.set_experimental_raw_events(true);
thread_state_guard.set_experimental_raw_events(/*enabled=*/ true);
}
}
Some(thread_state)
+8 -4
View File
@@ -91,13 +91,17 @@ impl ThreadWatchManager {
}
pub(crate) async fn upsert_thread(&self, thread: Thread) {
self.mutate_and_publish(move |state| state.upsert_thread(thread.id, true))
.await;
self.mutate_and_publish(move |state| {
state.upsert_thread(thread.id, /*emit_notification=*/ true)
})
.await;
}
pub(crate) async fn upsert_thread_silently(&self, thread: Thread) {
self.mutate_and_publish(move |state| state.upsert_thread(thread.id, false))
.await;
self.mutate_and_publish(move |state| {
state.upsert_thread(thread.id, /*emit_notification=*/ false)
})
.await;
}
pub(crate) async fn remove_thread(&self, thread_id: &str) {
@@ -267,7 +267,8 @@ impl McpProcess {
/// Send an `account/rateLimits/read` JSON-RPC request.
pub async fn send_get_account_rate_limits_request(&mut self) -> anyhow::Result<i64> {
self.send_request("account/rateLimits/read", None).await
self.send_request("account/rateLimits/read", /*params=*/ None)
.await
}
/// Send an `account/read` JSON-RPC request.
@@ -768,7 +769,7 @@ impl McpProcess {
/// Send an `account/logout` JSON-RPC request.
pub async fn send_logout_account_request(&mut self) -> anyhow::Result<i64> {
self.send_request("account/logout", None).await
self.send_request("account/logout", /*params=*/ None).await
}
/// Send an `account/login/start` JSON-RPC request for API key login.
+2 -2
View File
@@ -399,7 +399,7 @@ fn compute_replacements(
original_lines,
std::slice::from_ref(ctx_line),
line_index,
false,
/*eof=*/ false,
) {
line_index = idx + 1;
} else {
@@ -512,7 +512,7 @@ pub fn unified_diff_from_chunks(
path: &Path,
chunks: &[UpdateFileChunk],
) -> std::result::Result<ApplyPatchFileUpdate, ApplyPatchError> {
unified_diff_from_chunks_with_context(path, chunks, 1)
unified_diff_from_chunks_with_context(path, chunks, /*context=*/ 1)
}
pub fn unified_diff_from_chunks_with_context(
+1 -1
View File
@@ -74,7 +74,7 @@ pub fn can_manage_artifact_runtime() -> bool {
pub(crate) fn resolve_machine_js_runtime() -> Option<JsRuntime> {
resolve_js_runtime_from_candidates(
None,
/*preferred_node_path=*/ None,
system_node_runtime(),
system_electron_runtime(),
codex_app_runtime_candidates(),
+2 -2
View File
@@ -399,7 +399,7 @@ impl Client {
let plan_type = Some(Self::map_plan_type(payload.plan_type));
let mut snapshots = vec![Self::make_rate_limit_snapshot(
Some("codex".to_string()),
None,
/*limit_name=*/ None,
payload.rate_limit.flatten().map(|details| *details),
payload.credits.flatten().map(|details| *details),
plan_type,
@@ -410,7 +410,7 @@ impl Client {
Some(details.metered_feature),
Some(details.limit_name),
details.rate_limit.flatten().map(|rate_limit| *rate_limit),
None,
/*credits=*/ None,
plan_type,
)
}));
+1 -1
View File
@@ -13,7 +13,7 @@ pub(crate) async fn chatgpt_get_request<T: DeserializeOwned>(
config: &Config,
path: String,
) -> anyhow::Result<T> {
chatgpt_get_request_with_timeout(config, path, None).await
chatgpt_get_request_with_timeout(config, path, /*timeout=*/ None).await
}
pub(crate) async fn chatgpt_get_request_with_timeout<T: DeserializeOwned>(
+4 -2
View File
@@ -45,13 +45,15 @@ pub async fn list_connectors(config: &Config) -> anyhow::Result<Vec<AppInfo>> {
let connectors = connectors_result?;
let accessible = accessible_result?;
Ok(with_app_enabled_state(
merge_connectors_with_accessible(connectors, accessible, true),
merge_connectors_with_accessible(
connectors, accessible, /*all_connectors_loaded=*/ true,
),
config,
))
}
pub async fn list_all_connectors(config: &Config) -> anyhow::Result<Vec<AppInfo>> {
list_all_connectors_with_options(config, false).await
list_all_connectors_with_options(config, /*force_refetch=*/ false).await
}
pub async fn list_cached_all_connectors(config: &Config) -> Option<Vec<AppInfo>> {
+2 -2
View File
@@ -69,7 +69,7 @@ pub async fn run_command_under_landlock(
config_overrides,
codex_linux_sandbox_exe,
SandboxType::Landlock,
false,
/*log_denials=*/ false,
)
.await
}
@@ -89,7 +89,7 @@ pub async fn run_command_under_windows(
config_overrides,
codex_linux_sandbox_exe,
SandboxType::Windows,
false,
/*log_denials=*/ false,
)
.await
}
+1 -1
View File
@@ -330,7 +330,7 @@ async fn run_add(config_overrides: &CliConfigOverrides, add_args: AddArgs) -> Re
oauth_config.http_headers,
oauth_config.env_http_headers,
&resolved_scopes,
None,
/*oauth_resource=*/ None,
config.mcp_oauth_callback_port,
config.mcp_oauth_callback_url.as_deref(),
)
+6 -2
View File
@@ -367,7 +367,9 @@ impl CloudRequirementsService {
while attempt <= CLOUD_REQUIREMENTS_MAX_ATTEMPTS {
let contents = match self.fetcher.fetch_requirements(&auth).await {
Ok(contents) => {
emit_fetch_attempt_metric(trigger, attempt, "success", None);
emit_fetch_attempt_metric(
trigger, attempt, "success", /*status_code=*/ None,
);
contents
}
Err(FetchAttemptError::Retryable(status)) => {
@@ -500,7 +502,9 @@ impl CloudRequirementsService {
tracing::warn!(error = %err, "Failed to write cloud requirements cache");
}
emit_fetch_final_metric(trigger, "success", "none", attempt, None);
emit_fetch_final_metric(
trigger, "success", "none", attempt, /*status_code=*/ None,
);
return Ok(requirements);
}
+8 -4
View File
@@ -94,7 +94,9 @@ impl CloudBackend for HttpClient {
}
async fn apply_task(&self, id: TaskId, diff_override: Option<String>) -> Result<ApplyOutcome> {
self.apply_api().run(id, diff_override, false).await
self.apply_api()
.run(id, diff_override, /*preflight=*/ false)
.await
}
async fn apply_task_preflight(
@@ -102,7 +104,9 @@ impl CloudBackend for HttpClient {
id: TaskId,
diff_override: Option<String>,
) -> Result<ApplyOutcome> {
self.apply_api().run(id, diff_override, true).await
self.apply_api()
.run(id, diff_override, /*preflight=*/ true)
.await
}
async fn create_task(
@@ -533,8 +537,8 @@ mod api {
let _ = writeln!(
&mut log,
"stdout_tail=\n{}\nstderr_tail=\n{}",
tail(&r.stdout, 2000),
tail(&r.stderr, 2000)
tail(&r.stdout, /*max=*/ 2000),
tail(&r.stderr, /*max=*/ 2000)
);
let _ = writeln!(&mut log, "{summary}");
let _ = writeln!(
+6 -1
View File
@@ -70,7 +70,12 @@ impl CloudBackend for MockClient {
}
async fn get_task_summary(&self, id: TaskId) -> Result<TaskSummary> {
let tasks = self.list_tasks(None, None, None).await?.tasks;
let tasks = self
.list_tasks(
/*env=*/ None, /*limit=*/ None, /*cursor=*/ None,
)
.await?
.tasks;
tasks
.into_iter()
.find(|t| t.id == id)
+13 -10
View File
@@ -827,7 +827,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option<PathBuf>) -> an
let backend = Arc::clone(&backend);
let tx = tx.clone();
tokio::spawn(async move {
let res = app::load_tasks(&*backend, None).await;
let res = app::load_tasks(&*backend, /*env=*/ None).await;
let _ = tx.send(app::AppEvent::TasksLoaded {
env: None,
result: res,
@@ -861,7 +861,10 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option<PathBuf>) -> an
let headers = util::build_chatgpt_headers().await;
// Run autodetect. If it fails, we keep using "All".
let res = crate::env_detect::autodetect_environment_id(&base_url, &headers, None).await;
let res = crate::env_detect::autodetect_environment_id(
&base_url, &headers, /*desired_label=*/ None,
)
.await;
let _ = tx.send(app::AppEvent::EnvironmentAutodetected(res));
});
}
@@ -1105,7 +1108,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option<PathBuf>) -> an
ov.base_can_apply = true;
ov.apply_selection_to_fields();
} else {
let mut overlay = app::DiffOverlay::new(id.clone(), title, None);
let mut overlay = app::DiffOverlay::new(id.clone(), title, /*attempt_total_hint=*/ None);
{
let base = overlay.base_attempt_mut();
base.diff_lines = diff_lines.clone();
@@ -1178,7 +1181,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option<PathBuf>) -> an
});
}
} else {
let mut overlay = app::DiffOverlay::new(id.clone(), title, None);
let mut overlay = app::DiffOverlay::new(id.clone(), title, /*attempt_total_hint=*/ None);
{
let base = overlay.base_attempt_mut();
base.text_lines = conv.clone();
@@ -1216,7 +1219,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option<PathBuf>) -> an
.as_ref()
.map(|d| d.lines().map(str::to_string).collect())
.unwrap_or_default();
let text_lines = conversation_lines(None, &attempt.messages);
let text_lines = conversation_lines(/*prompt=*/ None, &attempt.messages);
ov.attempts.push(app::AttemptView {
turn_id: Some(attempt.turn_id.clone()),
status: attempt.status,
@@ -1263,7 +1266,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option<PathBuf>) -> an
ov.current_view = app::DetailView::Prompt;
ov.apply_selection_to_fields();
} else {
let mut overlay = app::DiffOverlay::new(id.clone(), title, None);
let mut overlay = app::DiffOverlay::new(id.clone(), title, /*attempt_total_hint=*/ None);
{
let base = overlay.base_attempt_mut();
base.text_lines = pretty;
@@ -1500,7 +1503,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option<PathBuf>) -> an
let backend = Arc::clone(&backend);
let best_of_n = page.best_of_n;
tokio::spawn(async move {
let git_ref = resolve_git_ref(None).await;
let git_ref = resolve_git_ref(/*branch_override=*/ None).await;
let result = codex_cloud_tasks_client::CloudBackend::create_task(&*backend, &env, &text, &git_ref, false, best_of_n).await;
let evt = match result {
@@ -1685,11 +1688,11 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option<PathBuf>) -> an
needs_redraw = true;
}
KeyCode::Down | KeyCode::Char('j') => {
if let Some(ov) = &mut app.diff_overlay { ov.sd.scroll_by(1); }
if let Some(ov) = &mut app.diff_overlay { ov.sd.scroll_by(/*delta=*/ 1); }
needs_redraw = true;
}
KeyCode::Up | KeyCode::Char('k') => {
if let Some(ov) = &mut app.diff_overlay { ov.sd.scroll_by(-1); }
if let Some(ov) = &mut app.diff_overlay { ov.sd.scroll_by(/*delta=*/ -1); }
needs_redraw = true;
}
KeyCode::PageDown | KeyCode::Char(' ') => {
@@ -1721,7 +1724,7 @@ pub async fn run_main(cli: Cli, _codex_linux_sandbox_exe: Option<PathBuf>) -> an
KeyCode::PageUp => { if let Some(m) = app.env_modal.as_mut() { let step = 10usize; m.selected = m.selected.saturating_sub(step); } needs_redraw = true; }
KeyCode::Char('n') => {
if app.env_filter.is_none() {
app.new_task = Some(crate::new_task::NewTaskPage::new(None, app.best_of_n));
app.new_task = Some(crate::new_task::NewTaskPage::new(/*env_id=*/ None, app.best_of_n));
} else {
app.new_task = Some(crate::new_task::NewTaskPage::new(app.env_filter.clone(), app.best_of_n));
}
+1 -1
View File
@@ -30,6 +30,6 @@ impl NewTaskPage {
impl Default for NewTaskPage {
fn default() -> Self {
Self::new(None, 1)
Self::new(/*env_id=*/ None, /*best_of_n=*/ 1)
}
}
+4 -1
View File
@@ -582,7 +582,10 @@ fn style_conversation_lines(
speaker = Some(ConversationSpeaker::User);
in_code = false;
bullet_indent = None;
styled.push(conversation_header_line(ConversationSpeaker::User, None));
styled.push(conversation_header_line(
ConversationSpeaker::User,
/*attempt=*/ None,
));
last_src = Some(src_idx);
continue;
}
+9 -3
View File
@@ -44,9 +44,15 @@ impl<T: HttpTransport, A: AuthProvider> ModelsClient<T, A> {
) -> Result<(Vec<ModelInfo>, Option<String>), ApiError> {
let resp = self
.session
.execute_with(Method::GET, Self::path(), extra_headers, None, |req| {
Self::append_client_version_query(req, client_version);
})
.execute_with(
Method::GET,
Self::path(),
extra_headers,
/*body=*/ None,
|req| {
Self::append_client_version_query(req, client_version);
},
)
.await?;
let header_etag = resp
+1 -1
View File
@@ -20,7 +20,7 @@ impl Display for RateLimitError {
/// Parses the default Codex rate-limit header family into a `RateLimitSnapshot`.
pub fn parse_default_rate_limit(headers: &HeaderMap) -> Option<RateLimitSnapshot> {
parse_rate_limit_for_limit(headers, None)
parse_rate_limit_for_limit(headers, /*limit_id=*/ None)
}
/// Parses all known rate-limit header families into update records keyed by limit id.
+6 -1
View File
@@ -45,7 +45,12 @@ pub fn stream_from_fixture(
let reader = std::io::Cursor::new(content);
let stream = ReaderStream::new(reader).map_err(|err| TransportError::Network(err.to_string()));
let (tx_event, rx_event) = mpsc::channel::<Result<ResponseEvent, ApiError>>(1600);
tokio::spawn(process_sse(Box::pin(stream), tx_event, idle_timeout, None));
tokio::spawn(process_sse(
Box::pin(stream),
tx_event,
idle_timeout,
/*telemetry=*/ None,
));
Ok(ResponseStream { rx_event })
}
@@ -38,7 +38,7 @@ fn derive_for_struct(input: &DeriveInput, data: &DataStruct) -> TokenStream {
let mut registrations = Vec::new();
for field in &named.named {
if let Some(reason) = experimental_reason(&field.attrs) {
let expr = experimental_presence_expr(field, false);
let expr = experimental_presence_expr(field, /*tuple_struct=*/ false);
checks.push(quote! {
if #expr {
return Some(#reason);
+23 -8
View File
@@ -92,20 +92,23 @@ impl Default for ConfigRequirements {
Self {
approval_policy: ConstrainedWithSource::new(
Constrained::allow_any_from_default(),
None,
/*source=*/ None,
),
sandbox_policy: ConstrainedWithSource::new(
Constrained::allow_any(SandboxPolicy::new_read_only_policy()),
None,
/*source=*/ None,
),
web_search_mode: ConstrainedWithSource::new(
Constrained::allow_any(WebSearchMode::Cached),
None,
/*source=*/ None,
),
feature_requirements: None,
mcp_servers: None,
exec_policy: None,
enforce_residency: ConstrainedWithSource::new(Constrained::allow_any(None), None),
enforce_residency: ConstrainedWithSource::new(
Constrained::allow_any(/*initial_value=*/ None),
/*source=*/ None,
),
network: None,
}
}
@@ -508,7 +511,10 @@ impl TryFrom<ConfigRequirementsWithSources> for ConfigRequirements {
})?;
ConstrainedWithSource::new(constrained, Some(requirement_source))
}
None => ConstrainedWithSource::new(Constrained::allow_any_from_default(), None),
None => ConstrainedWithSource::new(
Constrained::allow_any_from_default(),
/*source=*/ None,
),
};
// TODO(gt): `ConfigRequirementsToml` should let the author specify the
@@ -559,7 +565,10 @@ impl TryFrom<ConfigRequirementsWithSources> for ConfigRequirements {
ConstrainedWithSource::new(constrained, Some(requirement_source))
}
None => {
ConstrainedWithSource::new(Constrained::allow_any(default_sandbox_policy), None)
ConstrainedWithSource::new(
Constrained::allow_any(default_sandbox_policy),
/*source=*/ None,
)
}
};
let exec_policy = match rules {
@@ -612,7 +621,10 @@ impl TryFrom<ConfigRequirementsWithSources> for ConfigRequirements {
})?;
ConstrainedWithSource::new(constrained, Some(requirement_source))
}
None => ConstrainedWithSource::new(Constrained::allow_any(WebSearchMode::Cached), None),
None => ConstrainedWithSource::new(
Constrained::allow_any(WebSearchMode::Cached),
/*source=*/ None,
),
};
let feature_requirements =
feature_requirements.filter(|requirements| !requirements.value.is_empty());
@@ -638,7 +650,10 @@ impl TryFrom<ConfigRequirementsWithSources> for ConfigRequirements {
})?;
ConstrainedWithSource::new(constrained, Some(requirement_source))
}
None => ConstrainedWithSource::new(Constrained::allow_any(None), None),
None => ConstrainedWithSource::new(
Constrained::allow_any(/*initial_value=*/ None),
/*source=*/ None,
),
};
let network = network.map(|sourced_network| {
let Sourced { value, source } = sourced_network;
+4 -1
View File
@@ -142,7 +142,10 @@ pub async fn first_layer_config_error<T: DeserializeOwned>(
// per-file error to point users at a specific file and range rather than an
// opaque merged-layer failure.
first_layer_config_error_for_entries::<T, _>(
layers.get_layers(ConfigLayerStackOrdering::LowestPrecedenceFirst, false),
layers.get_layers(
ConfigLayerStackOrdering::LowestPrecedenceFirst,
/*include_disabled=*/ false,
),
config_toml_file,
)
.await
+12 -3
View File
@@ -211,7 +211,10 @@ impl ConfigLayerStack {
pub fn effective_config(&self) -> TomlValue {
let mut merged = TomlValue::Table(toml::map::Map::new());
for layer in self.get_layers(ConfigLayerStackOrdering::LowestPrecedenceFirst, false) {
for layer in self.get_layers(
ConfigLayerStackOrdering::LowestPrecedenceFirst,
/*include_disabled=*/ false,
) {
merge_toml_values(&mut merged, &layer.config);
}
merged
@@ -221,7 +224,10 @@ impl ConfigLayerStack {
let mut origins = HashMap::new();
let mut path = Vec::new();
for layer in self.get_layers(ConfigLayerStackOrdering::LowestPrecedenceFirst, false) {
for layer in self.get_layers(
ConfigLayerStackOrdering::LowestPrecedenceFirst,
/*include_disabled=*/ false,
) {
record_origins(&layer.config, &layer.metadata(), &mut path, &mut origins);
}
@@ -231,7 +237,10 @@ impl ConfigLayerStack {
/// Returns the highest-precedence to lowest-precedence layers, so
/// `ConfigLayerSource::SessionFlags` would be first, if present.
pub fn layers_high_to_low(&self) -> Vec<&ConfigLayerEntry> {
self.get_layers(ConfigLayerStackOrdering::HighestPrecedenceFirst, false)
self.get_layers(
ConfigLayerStackOrdering::HighestPrecedenceFirst,
/*include_disabled=*/ false,
)
}
/// Returns the highest-precedence to lowest-precedence layers, so
+3 -3
View File
@@ -186,7 +186,7 @@ impl AgentControl {
initial_history,
self.clone(),
session_source,
false,
/*persist_extended_history=*/ false,
inherited_shell_snapshot,
)
.await?
@@ -196,8 +196,8 @@ impl AgentControl {
config,
self.clone(),
session_source,
false,
None,
/*persist_extended_history=*/ false,
/*metrics_service_name=*/ None,
inherited_shell_snapshot,
)
.await?
+2 -2
View File
@@ -179,7 +179,7 @@ pub(crate) struct SpawnReservation {
impl SpawnReservation {
pub(crate) fn reserve_agent_nickname(&mut self, names: &[&str]) -> Result<String> {
self.reserve_agent_nickname_with_preference(names, None)
self.reserve_agent_nickname_with_preference(names, /*preferred=*/ None)
}
pub(crate) fn reserve_agent_nickname_with_preference(
@@ -198,7 +198,7 @@ impl SpawnReservation {
}
pub(crate) fn commit(self, thread_id: ThreadId) {
self.commit_with_agent_nickname(thread_id, None);
self.commit_with_agent_nickname(thread_id, /*agent_nickname=*/ None);
}
pub(crate) fn commit_with_agent_nickname(
+6 -2
View File
@@ -194,7 +194,11 @@ impl CodexAuth {
codex_home: &Path,
auth_credentials_store_mode: AuthCredentialsStoreMode,
) -> std::io::Result<Option<Self>> {
load_auth(codex_home, false, auth_credentials_store_mode)
load_auth(
codex_home,
/*enable_codex_api_key_env=*/ false,
auth_credentials_store_mode,
)
}
pub fn auth_mode(&self) -> AuthMode {
@@ -457,7 +461,7 @@ pub fn load_auth_dot_json(
pub fn enforce_login_restrictions(config: &Config) -> std::io::Result<()> {
let Some(auth) = load_auth(
&config.codex_home,
true,
/*enable_codex_api_key_env=*/ true,
config.cli_auth_credentials_store_mode,
)?
else {
+8 -6
View File
@@ -680,9 +680,11 @@ impl ModelClientSession {
let Some(last_response) = self.get_last_response() else {
return ResponsesWsRequest::ResponseCreate(payload);
};
let Some(incremental_items) =
self.get_incremental_items(request, Some(&last_response), true)
else {
let Some(incremental_items) = self.get_incremental_items(
request,
Some(&last_response),
/*allow_empty_delta=*/ true,
) else {
return ResponsesWsRequest::ResponseCreate(payload);
};
@@ -726,7 +728,7 @@ impl ModelClientSession {
client_setup.api_provider,
client_setup.api_auth,
Some(Arc::clone(&self.turn_state)),
None,
/*turn_metadata_header=*/ None,
)
.await?;
self.websocket_session.connection = Some(connection);
@@ -1024,7 +1026,7 @@ impl ModelClientSession {
summary,
service_tier,
turn_metadata_header,
true,
/*warmup=*/ true,
)
.await
{
@@ -1077,7 +1079,7 @@ impl ModelClientSession {
summary,
service_tier,
turn_metadata_header,
false,
/*warmup=*/ false,
)
.await?
{
+25 -13
View File
@@ -632,7 +632,7 @@ impl Codex {
/// Submit the `op` wrapped in a `Submission` with a unique ID.
pub async fn submit(&self, op: Op) -> CodexResult<String> {
self.submit_with_trace(op, None).await
self.submit_with_trace(op, /*trace=*/ None).await
}
pub async fn submit_with_trace(
@@ -1694,7 +1694,8 @@ impl Session {
(None, None)
};
let mut hook_shell_argv = default_shell.derive_exec_args("", false);
let mut hook_shell_argv =
default_shell.derive_exec_args("", /*use_login_shell=*/ false);
let hook_shell_program = hook_shell_argv.remove(0);
let _ = hook_shell_argv.pop();
let hooks = Hooks::new(HooksConfig {
@@ -2042,7 +2043,8 @@ impl Session {
InitialHistory::New => {
// Defer initial context insertion until the first real turn starts so
// turn/start overrides can be merged before we write model-visible context.
self.set_previous_turn_settings(None).await;
self.set_previous_turn_settings(/*previous_turn_settings=*/ None)
.await;
}
InitialHistory::Resumed(resumed_history) => {
let rollout_items = resumed_history.history;
@@ -2340,7 +2342,7 @@ impl Session {
let skills_outcome = Arc::new(
self.services
.skills_manager
.skills_for_cwd(&session_configuration.cwd, false)
.skills_for_cwd(&session_configuration.cwd, /*force_reload=*/ false)
.await,
);
let mut turn_context: TurnContext = Self::make_turn_context(
@@ -2431,7 +2433,7 @@ impl Session {
startup_turn_context.as_ref(),
&[],
&HashSet::new(),
None,
/*skills_outcome=*/ None,
&startup_cancellation_token,
)
.await?;
@@ -2517,8 +2519,13 @@ impl Session {
let state = self.state.lock().await;
state.session_configuration.clone()
};
self.new_turn_from_configuration(sub_id, session_configuration, None, false)
.await
self.new_turn_from_configuration(
sub_id,
session_configuration,
/*final_output_json_schema=*/ None,
/*sandbox_policy_changed=*/ false,
)
.await
}
async fn build_settings_update_items(
@@ -4483,7 +4490,9 @@ mod handlers {
current_context.session_telemetry.user_prompt(&items);
// Attempt to inject input into current task.
if let Err(SteerInputError::NoActiveTurn(items)) = sess.steer_input(items, None).await {
if let Err(SteerInputError::NoActiveTurn(items)) =
sess.steer_input(items, /*expected_turn_id=*/ None).await
{
sess.refresh_mcp_servers_if_requested(&current_context)
.await;
let regular_task = sess.take_startup_regular_task().await.unwrap_or_default();
@@ -5229,7 +5238,7 @@ async fn spawn_review_thread(
sandbox_policy: parent_turn_context.sandbox_policy.get(),
windows_sandbox_level: parent_turn_context.windows_sandbox_level,
})
.with_web_search_config(None)
.with_web_search_config(/*web_search_config=*/ None)
.with_allow_login_shell(config.permissions.allow_login_shell)
.with_agent_roles(config.agent_roles.clone());
@@ -5909,7 +5918,7 @@ pub(crate) async fn run_turn(
}
Err(e) => {
info!("Turn error: {e:#}");
let event = EventMsg::Error(e.to_error_event(None));
let event = EventMsg::Error(e.to_error_event(/*message_prefix=*/ None));
sess.send_event(&turn_context, event).await;
// let the user continue the conversation
break;
@@ -6946,7 +6955,8 @@ async fn handle_assistant_item_done_in_plan_mode(
{
maybe_complete_plan_item_from_message(sess, turn_context, state, item).await;
if let Some(turn_item) = handle_non_tool_response_item(sess, turn_context, item, true).await
if let Some(turn_item) =
handle_non_tool_response_item(sess, turn_context, item, /*plan_mode=*/ true).await
{
emit_turn_item_in_plan_mode(
sess,
@@ -6959,7 +6969,9 @@ async fn handle_assistant_item_done_in_plan_mode(
}
record_completed_response_item(sess, turn_context, item).await;
if let Some(agent_message) = last_assistant_message_from_item(item, true) {
if let Some(agent_message) =
last_assistant_message_from_item(item, /*plan_mode=*/ true)
{
*last_agent_message = Some(agent_message);
}
return true;
@@ -7330,7 +7342,7 @@ async fn try_run_sampling_request(
pub(super) fn get_last_assistant_message_from_turn(responses: &[ResponseItem]) -> Option<String> {
for item in responses.iter().rev() {
if let Some(message) = last_assistant_message_from_item(item, false) {
if let Some(message) = last_assistant_message_from_item(item, /*plan_mode=*/ false) {
return Some(message);
}
}
+2 -2
View File
@@ -171,7 +171,7 @@ impl CodexThread {
if was_zero {
self.codex
.session
.set_out_of_band_elicitation_pause_state(true);
.set_out_of_band_elicitation_pause_state(/*paused=*/ true);
}
Ok(*guard)
@@ -190,7 +190,7 @@ impl CodexThread {
if now_zero {
self.codex
.session
.set_out_of_band_elicitation_pause_state(false);
.set_out_of_band_elicitation_pause_state(/*paused=*/ false);
}
Ok(*guard)
+2 -2
View File
@@ -163,7 +163,7 @@ async fn run_compact_task_inner(
continue;
}
sess.set_total_tokens_full(turn_context.as_ref()).await;
let event = EventMsg::Error(e.to_error_event(None));
let event = EventMsg::Error(e.to_error_event(/*message_prefix=*/ None));
sess.send_event(&turn_context, event).await;
return Err(e);
}
@@ -180,7 +180,7 @@ async fn run_compact_task_inner(
tokio::time::sleep(delay).await;
continue;
} else {
let event = EventMsg::Error(e.to_error_event(None));
let event = EventMsg::Error(e.to_error_event(/*message_prefix=*/ None));
sess.send_event(&turn_context, event).await;
return Err(e);
}
+1 -1
View File
@@ -101,7 +101,7 @@ async fn run_remote_compact_task_inner_impl(
turn_context.as_ref(),
&prompt_input,
&HashSet::new(),
None,
/*skills_outcome=*/ None,
&CancellationToken::new(),
)
.await?;
+8 -7
View File
@@ -450,13 +450,14 @@ fn discover_agent_roles_in_dir(
if declared_role_files.contains(&agent_file) {
continue;
}
let parsed_file = match read_resolved_agent_role_file(&agent_file, None) {
Ok(parsed_file) => parsed_file,
Err(err) => {
push_agent_role_warning(startup_warnings, err);
continue;
}
};
let parsed_file =
match read_resolved_agent_role_file(&agent_file, /*role_name_hint=*/ None) {
Ok(parsed_file) => parsed_file,
Err(err) => {
push_agent_role_warning(startup_warnings, err);
continue;
}
};
let role_name = parsed_file.role_name;
if roles.contains_key(&role_name) {
push_agent_role_warning(
+8 -3
View File
@@ -81,11 +81,11 @@ impl ManagedFeatures {
}
pub fn enable(&mut self, feature: Feature) -> ConstraintResult<()> {
self.set_enabled(feature, true)
self.set_enabled(feature, /*enabled=*/ true)
}
pub fn disable(&mut self, feature: Feature) -> ConstraintResult<()> {
self.set_enabled(feature, false)
self.set_enabled(feature, /*enabled=*/ false)
}
}
@@ -321,7 +321,12 @@ pub(crate) fn validate_feature_requirements_in_config_toml(
})
}
validate_profile(cfg, None, &ConfigProfile::default(), feature_requirements)?;
validate_profile(
cfg,
/*profile_name=*/ None,
&ConfigProfile::default(),
feature_requirements,
)?;
for (profile_name, profile) in &cfg.profiles {
validate_profile(cfg, Some(profile_name), profile, feature_requirements)?;
}
+7 -6
View File
@@ -56,12 +56,13 @@ pub(super) async fn load_config_layers_internal(
managed_config_path.unwrap_or_else(|| managed_config_default_path(codex_home)),
)?;
let managed_config = read_config_from_path(&managed_config_path, false)
.await?
.map(|managed_config| MangedConfigFromFile {
managed_config,
file: managed_config_path.clone(),
});
let managed_config =
read_config_from_path(&managed_config_path, /*log_missing_as_info=*/ false)
.await?
.map(|managed_config| MangedConfigFromFile {
managed_config,
file: managed_config_path.clone(),
});
#[cfg(target_os = "macos")]
let managed_preferences =
+9 -4
View File
@@ -853,15 +853,20 @@ async fn load_project_layers(
&dot_codex_abs,
&layer_dir,
TomlValue::Table(toml::map::Map::new()),
true,
/*config_toml_exists=*/ true,
));
continue;
}
};
let config =
resolve_relative_paths_in_config_toml(config, dot_codex_abs.as_path())?;
let entry =
project_layer_entry(trust_context, &dot_codex_abs, &layer_dir, config, true);
let entry = project_layer_entry(
trust_context,
&dot_codex_abs,
&layer_dir,
config,
/*config_toml_exists=*/ true,
);
layers.push(entry);
}
Err(err) => {
@@ -874,7 +879,7 @@ async fn load_project_layers(
&dot_codex_abs,
&layer_dir,
TomlValue::Table(toml::map::Map::new()),
false,
/*config_toml_exists=*/ false,
));
} else {
let config_file_display = config_file.as_path().display();
+12 -5
View File
@@ -104,9 +104,11 @@ pub async fn list_accessible_connectors_from_mcp_tools(
config: &Config,
) -> anyhow::Result<Vec<AppInfo>> {
Ok(
list_accessible_connectors_from_mcp_tools_with_options_and_status(config, false)
.await?
.connectors,
list_accessible_connectors_from_mcp_tools_with_options_and_status(
config, /*force_refetch=*/ false,
)
.await?
.connectors,
)
}
@@ -186,7 +188,12 @@ pub async fn list_accessible_connectors_from_mcp_tools_with_options_and_status(
});
}
let mcp_servers = with_codex_apps_mcp(HashMap::new(), true, auth.as_ref(), config);
let mcp_servers = with_codex_apps_mcp(
HashMap::new(),
/*connectors_enabled=*/ true,
auth.as_ref(),
config,
);
if mcp_servers.is_empty() {
return Ok(AccessibleConnectorsStatus {
connectors: Vec::new(),
@@ -459,7 +466,7 @@ async fn chatgpt_get_request_with_token<T: DeserializeOwned>(
fn auth_manager_from_config(config: &Config) -> std::sync::Arc<AuthManager> {
AuthManager::shared(
config.codex_home.clone(),
false,
/*enable_codex_api_key_env=*/ false,
config.cli_auth_credentials_store_mode,
)
}
+2 -2
View File
@@ -97,7 +97,7 @@ pub fn originator() -> Originator {
}
if std::env::var(CODEX_INTERNAL_ORIGINATOR_OVERRIDE_ENV_VAR).is_ok() {
let originator = get_originator_value(None);
let originator = get_originator_value(/*provided=*/ None);
if let Ok(mut guard) = ORIGINATOR.write() {
match guard.as_ref() {
Some(originator) => return originator.clone(),
@@ -107,7 +107,7 @@ pub fn originator() -> Originator {
return originator;
}
get_originator_value(None)
get_originator_value(/*provided=*/ None)
}
pub fn is_first_party_originator(originator_value: &str) -> bool {
+10 -3
View File
@@ -82,7 +82,14 @@ impl EnvironmentContext {
} else {
before_network
};
EnvironmentContext::new(cwd, shell.clone(), current_date, timezone, network, None)
EnvironmentContext::new(
cwd,
shell.clone(),
current_date,
timezone,
network,
/*subagents=*/ None,
)
}
pub fn from_turn_context(turn_context: &TurnContext, shell: &Shell) -> Self {
@@ -92,7 +99,7 @@ impl EnvironmentContext {
turn_context.current_date.clone(),
turn_context.timezone.clone(),
Self::network_from_turn_context(turn_context),
None,
/*subagents=*/ None,
)
}
@@ -103,7 +110,7 @@ impl EnvironmentContext {
turn_context_item.current_date.clone(),
turn_context_item.timezone.clone(),
Self::network_from_turn_context_item(turn_context_item),
None,
/*subagents=*/ None,
)
}
+2 -2
View File
@@ -877,12 +877,12 @@ async fn consume_truncated_output(
let stdout_handle = tokio::spawn(read_capped(
BufReader::new(stdout_reader),
stdout_stream.clone(),
false,
/*is_stderr=*/ false,
));
let stderr_handle = tokio::spawn(read_capped(
BufReader::new(stderr_reader),
stdout_stream.clone(),
true,
/*is_stderr=*/ true,
));
let (exit_status, timed_out) = tokio::select! {
+5 -5
View File
@@ -60,7 +60,7 @@ impl ExternalAgentConfigService {
) -> io::Result<Vec<ExternalAgentConfigMigrationItem>> {
let mut items = Vec::new();
if params.include_home {
self.detect_migrations(None, &mut items)?;
self.detect_migrations(/*repo_root=*/ None, &mut items)?;
}
for cwd in params.cwds.as_deref().unwrap_or(&[]) {
@@ -81,7 +81,7 @@ impl ExternalAgentConfigService {
emit_migration_metric(
EXTERNAL_AGENT_CONFIG_IMPORT_METRIC,
ExternalAgentConfigMigrationItemType::Config,
None,
/*skills_count=*/ None,
);
}
ExternalAgentConfigMigrationItemType::Skills => {
@@ -97,7 +97,7 @@ impl ExternalAgentConfigService {
emit_migration_metric(
EXTERNAL_AGENT_CONFIG_IMPORT_METRIC,
ExternalAgentConfigMigrationItemType::AgentsMd,
None,
/*skills_count=*/ None,
);
}
ExternalAgentConfigMigrationItemType::McpServerConfig => {}
@@ -153,7 +153,7 @@ impl ExternalAgentConfigService {
emit_migration_metric(
EXTERNAL_AGENT_CONFIG_DETECT_METRIC,
ExternalAgentConfigMigrationItemType::Config,
None,
/*skills_count=*/ None,
);
}
}
@@ -210,7 +210,7 @@ impl ExternalAgentConfigService {
emit_migration_metric(
EXTERNAL_AGENT_CONFIG_DETECT_METRIC,
ExternalAgentConfigMigrationItemType::AgentsMd,
None,
/*skills_count=*/ None,
);
}
+1 -1
View File
@@ -614,7 +614,7 @@ async fn run_guardian_subagent(
turn,
child_cancel.clone(),
SubAgentSource::Other(GUARDIAN_SUBAGENT_NAME.to_string()),
None,
/*initial_history=*/ None,
)
.await?;
// Preserve exact session-scoped network approvals after spawn so their
+1 -1
View File
@@ -43,7 +43,7 @@ where
network_sandbox_policy,
sandbox_policy_cwd,
use_legacy_landlock,
allow_network_for_proxy(false),
allow_network_for_proxy(/*enforce_managed_network=*/ false),
);
let arg0 = Some("codex-linux-sandbox");
spawn_child_async(SpawnChildRequest {
+1 -1
View File
@@ -277,7 +277,7 @@ fn effective_mcp_servers(
pub async fn collect_mcp_snapshot(config: &Config) -> McpListToolsResponseEvent {
let auth_manager = AuthManager::shared(
config.codex_home.clone(),
false,
/*enable_codex_api_key_env=*/ false,
config.cli_auth_credentials_store_mode,
);
let auth = auth_manager.auth().await;
+1 -1
View File
@@ -239,7 +239,7 @@ pub(crate) async fn maybe_install_mcp_dependencies(
.await;
let resolved_scopes = resolve_oauth_scopes(
None,
/*explicit_scopes=*/ None,
server_config.scopes.clone(),
oauth_config.discovered_scopes.clone(),
);
+1 -1
View File
@@ -495,7 +495,7 @@ async fn maybe_request_mcp_tool_approval(
sess,
turn_context,
build_guardian_mcp_tool_review_request(invocation, metadata),
None,
/*retry_reason=*/ None,
)
.await;
let decision = mcp_tool_approval_decision_from_guardian(decision);
+1 -1
View File
@@ -46,7 +46,7 @@ async fn build_config_state_with_mtimes() -> Result<(ConfigState, Vec<LayerMtime
let overrides = LoaderOverrides::default();
let config_layer_stack = load_config_layers_state(
&codex_home,
None,
/*cwd=*/ None,
&cli_overrides,
overrides,
CloudRequirementsLoader::default(),
+9 -9
View File
@@ -34,7 +34,7 @@ pub async fn maybe_migrate_personality(
}
let config_profile = config_toml
.get_config_profile(None)
.get_config_profile(/*override_profile=*/ None)
.map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?;
if config_toml.personality.is_some() || config_profile.personality.is_some() {
create_marker(&marker_path).await?;
@@ -70,12 +70,12 @@ async fn has_recorded_sessions(codex_home: &Path, default_provider: &str) -> io:
&& let Some(ids) = state_db::list_thread_ids_db(
Some(state_db_ctx.as_ref()),
codex_home,
1,
None,
/*page_size=*/ 1,
/*cursor=*/ None,
ThreadSortKey::CreatedAt,
allowed_sources,
None,
false,
/*model_providers=*/ None,
/*archived_only=*/ false,
"personality_migration",
)
.await
@@ -86,8 +86,8 @@ async fn has_recorded_sessions(codex_home: &Path, default_provider: &str) -> io:
let sessions = get_threads_in_root(
codex_home.join(SESSIONS_SUBDIR),
1,
None,
/*page_size=*/ 1,
/*cursor=*/ None,
ThreadSortKey::CreatedAt,
ThreadListConfig {
allowed_sources,
@@ -103,8 +103,8 @@ async fn has_recorded_sessions(codex_home: &Path, default_provider: &str) -> io:
let archived_sessions = get_threads_in_root(
codex_home.join(ARCHIVED_SESSIONS_SUBDIR),
1,
None,
/*page_size=*/ 1,
/*cursor=*/ None,
ThreadSortKey::CreatedAt,
ThreadListConfig {
allowed_sources,
+5 -1
View File
@@ -434,7 +434,11 @@ impl PluginsManager {
}
pub fn plugins_for_config(&self, config: &Config) -> PluginLoadOutcome {
self.plugins_for_layer_stack(&config.cwd, &config.config_layer_stack, false)
self.plugins_for_layer_stack(
&config.cwd,
&config.config_layer_stack,
/*force_reload=*/ false,
)
}
pub fn plugins_for_layer_stack(
+1 -1
View File
@@ -235,7 +235,7 @@ fn render_tree(root: &Path) -> Option<Vec<String>> {
}
let mut lines = Vec::new();
collect_tree_lines(root, 0, &mut lines);
collect_tree_lines(root, /*depth=*/ 0, &mut lines);
(!lines.is_empty()).then_some(lines)
}
+1 -1
View File
@@ -68,7 +68,7 @@ pub fn render_review_output_text(output: &ReviewOutputEvent) -> String {
sections.push(explanation.to_string());
}
if !output.findings.is_empty() {
let findings = format_review_findings_block(&output.findings, None);
let findings = format_review_findings_block(&output.findings, /*selection=*/ None);
let trimmed = findings.trim();
if !trimmed.is_empty() {
sections.push(trimmed.to_string());
+5 -5
View File
@@ -180,7 +180,7 @@ impl RolloutRecorder {
allowed_sources,
model_providers,
default_provider,
false,
/*archived=*/ false,
search_term,
)
.await
@@ -206,7 +206,7 @@ impl RolloutRecorder {
allowed_sources,
model_providers,
default_provider,
true,
/*archived=*/ true,
search_term,
)
.await
@@ -320,8 +320,8 @@ impl RolloutRecorder {
sort_key,
allowed_sources,
model_providers,
false,
None,
/*archived=*/ false,
/*search_term=*/ None,
)
.await
else {
@@ -889,7 +889,7 @@ async fn write_and_reconcile_items(
state_builder,
items,
default_provider,
None,
/*new_thread_memory_mode=*/ None,
)
.await;
Ok(())
+7 -1
View File
@@ -728,7 +728,13 @@ pub async fn execute_env(
stdout_stream: Option<StdoutStream>,
) -> crate::error::Result<ExecToolCallOutput> {
let effective_policy = exec_request.sandbox_policy.clone();
execute_exec_request(exec_request, &effective_policy, stdout_stream, None).await
execute_exec_request(
exec_request,
&effective_policy,
stdout_stream,
/*after_spawn=*/ None,
)
.await
}
pub async fn execute_exec_request_with_after_spawn(
+8 -3
View File
@@ -45,8 +45,13 @@ pub async fn spawn_command_under_seatbelt(
network: Option<&NetworkProxy>,
mut env: HashMap<String, String>,
) -> std::io::Result<Child> {
let args =
create_seatbelt_command_args(command, sandbox_policy, sandbox_policy_cwd, false, network);
let args = create_seatbelt_command_args(
command,
sandbox_policy,
sandbox_policy_cwd,
/*enforce_managed_network=*/ false,
network,
);
let arg0 = None;
env.insert(CODEX_SANDBOX_ENV_VAR.to_string(), "seatbelt".to_string());
spawn_child_async(SpawnChildRequest {
@@ -338,7 +343,7 @@ pub(crate) fn create_seatbelt_command_args(
sandbox_policy_cwd,
enforce_managed_network,
network,
None,
/*extensions=*/ None,
)
}
+6 -6
View File
@@ -291,20 +291,20 @@ pub fn default_user_shell() -> Shell {
fn default_user_shell_from_path(user_shell_path: Option<PathBuf>) -> Shell {
if cfg!(windows) {
get_shell(ShellType::PowerShell, None).unwrap_or(ultimate_fallback_shell())
get_shell(ShellType::PowerShell, /*path=*/ None).unwrap_or(ultimate_fallback_shell())
} else {
let user_default_shell = user_shell_path
.and_then(|shell| detect_shell_type(&shell))
.and_then(|shell_type| get_shell(shell_type, None));
.and_then(|shell_type| get_shell(shell_type, /*path=*/ None));
let shell_with_fallback = if cfg!(target_os = "macos") {
user_default_shell
.or_else(|| get_shell(ShellType::Zsh, None))
.or_else(|| get_shell(ShellType::Bash, None))
.or_else(|| get_shell(ShellType::Zsh, /*path=*/ None))
.or_else(|| get_shell(ShellType::Bash, /*path=*/ None))
} else {
user_default_shell
.or_else(|| get_shell(ShellType::Bash, None))
.or_else(|| get_shell(ShellType::Zsh, None))
.or_else(|| get_shell(ShellType::Bash, /*path=*/ None))
.or_else(|| get_shell(ShellType::Zsh, /*path=*/ None))
};
shell_with_fallback.unwrap_or(ultimate_fallback_shell())
+18 -5
View File
@@ -199,7 +199,7 @@ async fn write_shell_snapshot(
if shell_type == ShellType::PowerShell || shell_type == ShellType::Cmd {
bail!("Shell snapshot not supported yet for {shell_type:?}");
}
let shell = get_shell(shell_type.clone(), None)
let shell = get_shell(shell_type.clone(), /*path=*/ None)
.with_context(|| format!("No available shell for {shell_type:?}"))?;
let raw_snapshot = capture_snapshot(&shell, cwd).await?;
@@ -243,13 +243,26 @@ fn strip_snapshot_preamble(snapshot: &str) -> Result<String> {
async fn validate_snapshot(shell: &Shell, snapshot_path: &Path, cwd: &Path) -> Result<()> {
let snapshot_path_display = snapshot_path.display();
let script = format!("set -e; . \"{snapshot_path_display}\"");
run_script_with_timeout(shell, &script, SNAPSHOT_TIMEOUT, false, cwd)
.await
.map(|_| ())
run_script_with_timeout(
shell,
&script,
SNAPSHOT_TIMEOUT,
/*use_login_shell=*/ false,
cwd,
)
.await
.map(|_| ())
}
async fn run_shell_script(shell: &Shell, script: &str, cwd: &Path) -> Result<String> {
run_script_with_timeout(shell, script, SNAPSHOT_TIMEOUT, true, cwd).await
run_script_with_timeout(
shell,
script,
SNAPSHOT_TIMEOUT,
/*use_login_shell=*/ true,
cwd,
)
.await
}
async fn run_script_with_timeout(
+3 -3
View File
@@ -350,7 +350,7 @@ pub async fn reconcile_rollout(
items,
"reconcile_rollout",
new_thread_memory_mode,
None,
/*updated_at_override=*/ None,
)
.await;
return;
@@ -472,10 +472,10 @@ pub async fn read_repair_rollout_path(
Some(ctx),
rollout_path,
default_provider.as_str(),
None,
/*builder=*/ None,
&[],
archived_only,
None,
/*new_thread_memory_mode=*/ None,
)
.await;
}
+2 -1
View File
@@ -81,7 +81,8 @@ impl SessionTask for RegularTask {
) -> Option<String> {
let sess = session.clone_session();
let run_turn_span = trace_span!("run_turn");
sess.set_server_reasoning_included(false).await;
sess.set_server_reasoning_included(/*included=*/ false)
.await;
let prewarmed_client_session = self.take_prewarmed_session().await;
run_turn(
sess,
+4 -4
View File
@@ -80,7 +80,7 @@ impl SessionTask for ReviewTask {
}
async fn abort(&self, session: Arc<SessionTaskContext>, ctx: Arc<TurnContext>) {
exit_review_mode(session.clone_session(), None, ctx).await;
exit_review_mode(session.clone_session(), /*review_output=*/ None, ctx).await;
}
}
@@ -121,8 +121,8 @@ async fn start_review_conversation(
ctx.clone(),
cancellation_token,
SubAgentSource::Review,
None,
None,
/*final_output_json_schema=*/ None,
/*initial_history=*/ None,
)
.await)
.ok()
@@ -217,7 +217,7 @@ pub(crate) async fn exit_review_mode(
findings_str.push_str(text);
}
if !out.findings.is_empty() {
let block = format_review_findings_block(&out.findings, None);
let block = format_review_findings_block(&out.findings, /*selection=*/ None);
findings_str.push_str(&format!("\n{block}"));
}
let rendered =
+8 -3
View File
@@ -185,9 +185,14 @@ pub(crate) async fn execute_user_shell_command(
tx_event: session.get_tx_event(),
});
let exec_result = execute_exec_request(exec_env, &sandbox_policy, stdout_stream, None)
.or_cancel(&cancellation_token)
.await;
let exec_result = execute_exec_request(
exec_env,
&sandbox_policy,
stdout_stream,
/*after_spawn=*/ None,
)
.or_cancel(&cancellation_token)
.await;
match exec_result {
Err(CancelErr::Cancelled) => {
+50 -10
View File
@@ -108,7 +108,13 @@ impl TerminalInfo {
version: Option<String>,
multiplexer: Option<Multiplexer>,
) -> Self {
Self::new(name, Some(term_program), version, None, multiplexer)
Self::new(
name,
Some(term_program),
version,
/*term=*/ None,
multiplexer,
)
}
/// Creates terminal metadata from a `TERM_PROGRAM` match plus a `TERM` value.
@@ -128,7 +134,13 @@ impl TerminalInfo {
version: Option<String>,
multiplexer: Option<Multiplexer>,
) -> Self {
Self::new(name, None, version, None, multiplexer)
Self::new(
name,
/*term_program=*/ None,
version,
/*term=*/ None,
multiplexer,
)
}
/// Creates terminal metadata from a `TERM` capability value.
@@ -138,12 +150,24 @@ impl TerminalInfo {
} else {
TerminalName::Unknown
};
Self::new(name, None, None, Some(term), multiplexer)
Self::new(
name,
/*term_program=*/ None,
/*version=*/ None,
Some(term),
multiplexer,
)
}
/// Creates terminal metadata for unknown terminals.
fn unknown(multiplexer: Option<Multiplexer>) -> Self {
Self::new(TerminalName::Unknown, None, None, None, multiplexer)
Self::new(
TerminalName::Unknown,
/*term_program=*/ None,
/*version=*/ None,
/*term=*/ None,
multiplexer,
)
}
/// Formats the terminal info as a User-Agent token.
@@ -279,11 +303,15 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo {
}
if env.has("ITERM_SESSION_ID") || env.has("ITERM_PROFILE") || env.has("ITERM_PROFILE_NAME") {
return TerminalInfo::from_name(TerminalName::Iterm2, None, multiplexer);
return TerminalInfo::from_name(TerminalName::Iterm2, /*version=*/ None, multiplexer);
}
if env.has("TERM_SESSION_ID") {
return TerminalInfo::from_name(TerminalName::AppleTerminal, None, multiplexer);
return TerminalInfo::from_name(
TerminalName::AppleTerminal,
/*version=*/ None,
multiplexer,
);
}
if env.has("KITTY_WINDOW_ID")
@@ -292,7 +320,7 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo {
.map(|term| term.contains("kitty"))
.unwrap_or(false)
{
return TerminalInfo::from_name(TerminalName::Kitty, None, multiplexer);
return TerminalInfo::from_name(TerminalName::Kitty, /*version=*/ None, multiplexer);
}
if env.has("ALACRITTY_SOCKET")
@@ -301,7 +329,11 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo {
.map(|term| term == "alacritty")
.unwrap_or(false)
{
return TerminalInfo::from_name(TerminalName::Alacritty, None, multiplexer);
return TerminalInfo::from_name(
TerminalName::Alacritty,
/*version=*/ None,
multiplexer,
);
}
if env.has("KONSOLE_VERSION") {
@@ -310,7 +342,11 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo {
}
if env.has("GNOME_TERMINAL_SCREEN") {
return TerminalInfo::from_name(TerminalName::GnomeTerminal, None, multiplexer);
return TerminalInfo::from_name(
TerminalName::GnomeTerminal,
/*version=*/ None,
multiplexer,
);
}
if env.has("VTE_VERSION") {
@@ -319,7 +355,11 @@ fn detect_terminal_info_from_env(env: &dyn Environment) -> TerminalInfo {
}
if env.has("WT_SESSION") {
return TerminalInfo::from_name(TerminalName::WindowsTerminal, None, multiplexer);
return TerminalInfo::from_name(
TerminalName::WindowsTerminal,
/*version=*/ None,
multiplexer,
);
}
if let Some(term) = env.var_non_empty("TERM") {
+24 -19
View File
@@ -206,7 +206,7 @@ impl ThreadManager {
auth: CodexAuth,
provider: ModelProviderInfo,
) -> Self {
set_thread_manager_test_mode_for_tests(true);
set_thread_manager_test_mode_for_tests(/*enabled=*/ true);
let codex_home = std::env::temp_dir().join(format!(
"codex-thread-manager-test-{}",
uuid::Uuid::new_v4()
@@ -226,7 +226,7 @@ impl ThreadManager {
provider: ModelProviderInfo,
codex_home: PathBuf,
) -> Self {
set_thread_manager_test_mode_for_tests(true);
set_thread_manager_test_mode_for_tests(/*enabled=*/ true);
let auth_manager = AuthManager::from_auth_for_testing(auth);
let (thread_created_tx, _) = broadcast::channel(THREAD_CREATED_CHANNEL_CAPACITY);
let plugins_manager = Arc::new(PluginsManager::new(codex_home.clone()));
@@ -234,7 +234,7 @@ impl ThreadManager {
let skills_manager = Arc::new(SkillsManager::new(
codex_home.clone(),
Arc::clone(&plugins_manager),
true,
/*bundled_skills_enabled=*/ true,
));
let file_watcher = build_file_watcher(codex_home.clone(), Arc::clone(&skills_manager));
Self {
@@ -333,7 +333,12 @@ impl ThreadManager {
pub async fn start_thread(&self, config: Config) -> CodexResult<NewThread> {
// Box delegated thread-spawn futures so these convenience wrappers do
// not inline the full spawn path into every caller's async state.
Box::pin(self.start_thread_with_tools(config, Vec::new(), false)).await
Box::pin(self.start_thread_with_tools(
config,
Vec::new(),
/*persist_extended_history=*/ false,
))
.await
}
pub async fn start_thread_with_tools(
@@ -346,8 +351,8 @@ impl ThreadManager {
config,
dynamic_tools,
persist_extended_history,
None,
None,
/*metrics_service_name=*/ None,
/*parent_trace=*/ None,
))
.await
}
@@ -385,7 +390,7 @@ impl ThreadManager {
config,
initial_history,
auth_manager,
false,
/*persist_extended_history=*/ false,
parent_trace,
))
.await
@@ -406,7 +411,7 @@ impl ThreadManager {
self.agent_control(),
Vec::new(),
persist_extended_history,
None,
/*metrics_service_name=*/ None,
parent_trace,
))
.await
@@ -491,7 +496,7 @@ impl ThreadManager {
self.agent_control(),
Vec::new(),
persist_extended_history,
None,
/*metrics_service_name=*/ None,
parent_trace,
))
.await
@@ -551,9 +556,9 @@ impl ThreadManagerState {
config,
agent_control,
self.session_source.clone(),
false,
None,
None,
/*persist_extended_history=*/ false,
/*metrics_service_name=*/ None,
/*inherited_shell_snapshot=*/ None,
))
.await
}
@@ -577,7 +582,7 @@ impl ThreadManagerState {
persist_extended_history,
metrics_service_name,
inherited_shell_snapshot,
None,
/*parent_trace=*/ None,
))
.await
}
@@ -598,10 +603,10 @@ impl ThreadManagerState {
agent_control,
session_source,
Vec::new(),
false,
None,
/*persist_extended_history=*/ false,
/*metrics_service_name=*/ None,
inherited_shell_snapshot,
None,
/*parent_trace=*/ None,
))
.await
}
@@ -623,9 +628,9 @@ impl ThreadManagerState {
session_source,
Vec::new(),
persist_extended_history,
None,
/*metrics_service_name=*/ None,
inherited_shell_snapshot,
None,
/*parent_trace=*/ None,
))
.await
}
@@ -652,7 +657,7 @@ impl ThreadManagerState {
dynamic_tools,
persist_extended_history,
metrics_service_name,
None,
/*inherited_shell_snapshot=*/ None,
parent_trace,
))
.await
@@ -84,7 +84,10 @@ impl CodeModeExecuteHandler {
Ok(message) => message,
Err(error) => return Err(FunctionCallError::RespondToModel(error)),
};
handle_node_message(&exec, cell_id, message, None, started_at).await
handle_node_message(
&exec, cell_id, message, /*poll_max_output_tokens=*/ None, started_at,
)
.await
};
match result {
Ok(CodeModeSessionProgress::Finished(output))
+1 -1
View File
@@ -230,7 +230,7 @@ async fn build_enabled_tools(exec: &ExecContext) -> Vec<protocol::EnabledTool> {
let mut out = router
.specs()
.into_iter()
.map(|spec| augment_tool_spec_for_code_mode(spec, true))
.map(|spec| augment_tool_spec_for_code_mode(spec, /*code_mode_enabled=*/ true))
.filter_map(enabled_tool_from_spec)
.collect::<Vec<_>>();
out.sort_by(|left, right| left.tool_name.cmp(&right.tool_name));
+1 -1
View File
@@ -230,7 +230,7 @@ impl ToolOutput for AbortedToolOutput {
vec![FunctionCallOutputContentItem::InputText {
text: self.message.clone(),
}],
None,
/*success=*/ None,
),
}
}
+11 -4
View File
@@ -162,7 +162,14 @@ impl ToolEmitter {
) => {
emit_exec_stage(
ctx,
ExecCommandInput::new(command, cwd.as_path(), parsed_cmd, *source, None, None),
ExecCommandInput::new(
command,
cwd.as_path(),
parsed_cmd,
*source,
/*interaction_input=*/ None,
/*process_id=*/ None,
),
stage,
)
.await;
@@ -233,7 +240,7 @@ impl ToolEmitter {
changes.clone(),
String::new(),
(*message).to_string(),
false,
/*success=*/ false,
PatchApplyStatus::Failed,
)
.await;
@@ -247,7 +254,7 @@ impl ToolEmitter {
changes.clone(),
String::new(),
(*message).to_string(),
false,
/*success=*/ false,
PatchApplyStatus::Declined,
)
.await;
@@ -269,7 +276,7 @@ impl ToolEmitter {
cwd.as_path(),
parsed_cmd,
*source,
None,
/*interaction_input=*/ None,
process_id.as_deref(),
),
stage,
+28 -4
View File
@@ -584,7 +584,13 @@ async fn run_agent_job_loop(
.await?;
let initial_progress = db.get_agent_job_progress(job_id.as_str()).await?;
progress_emitter
.maybe_emit(&session, &turn, job_id.as_str(), &initial_progress, true)
.maybe_emit(
&session,
&turn,
job_id.as_str(),
&initial_progress,
/*force=*/ true,
)
.await?;
let mut cancel_requested = db.is_agent_job_cancelled(job_id.as_str()).await?;
@@ -719,7 +725,13 @@ async fn run_agent_job_loop(
active_items.remove(&thread_id);
let progress = db.get_agent_job_progress(job_id.as_str()).await?;
progress_emitter
.maybe_emit(&session, &turn, job_id.as_str(), &progress, false)
.maybe_emit(
&session,
&turn,
job_id.as_str(),
&progress,
/*force=*/ false,
)
.await?;
}
}
@@ -738,7 +750,13 @@ async fn run_agent_job_loop(
format!("agent job {job_id} cancelled with {pending_items} unprocessed items");
let _ = session.notify_background_event(&turn, message).await;
progress_emitter
.maybe_emit(&session, &turn, job_id.as_str(), &progress, true)
.maybe_emit(
&session,
&turn,
job_id.as_str(),
&progress,
/*force=*/ true,
)
.await?;
return Ok(());
}
@@ -750,7 +768,13 @@ async fn run_agent_job_loop(
db.mark_agent_job_completed(job_id.as_str()).await?;
let progress = db.get_agent_job_progress(job_id.as_str()).await?;
progress_emitter
.maybe_emit(&session, &turn, job_id.as_str(), &progress, true)
.maybe_emit(
&session,
&turn,
job_id.as_str(),
&progress,
/*force=*/ true,
)
.await?;
Ok(())
}
@@ -225,9 +225,9 @@ async fn emit_exec_begin(session: &Session, turn: &TurnContext, call_id: &str) {
vec![ARTIFACTS_TOOL_NAME.to_string()],
turn.cwd.clone(),
ExecCommandSource::Agent,
true,
/*freeform=*/ true,
);
let ctx = ToolEventCtx::new(session, turn, call_id, None);
let ctx = ToolEventCtx::new(session, turn, call_id, /*turn_diff_tracker=*/ None);
emitter.emit(ctx, ToolEventStage::Begin).await;
}
@@ -251,9 +251,9 @@ async fn emit_exec_end(
vec![ARTIFACTS_TOOL_NAME.to_string()],
turn.cwd.clone(),
ExecCommandSource::Agent,
true,
/*freeform=*/ true,
);
let ctx = ToolEventCtx::new(session, turn, call_id, None);
let ctx = ToolEventCtx::new(session, turn, call_id, /*turn_diff_tracker=*/ None);
let stage = if success {
ToolEventStage::Success(exec_output)
} else {
+5 -5
View File
@@ -63,9 +63,9 @@ async fn emit_js_repl_exec_begin(
vec!["js_repl".to_string()],
turn.cwd.clone(),
ExecCommandSource::Agent,
false,
/*freeform=*/ false,
);
let ctx = ToolEventCtx::new(session, turn, call_id, None);
let ctx = ToolEventCtx::new(session, turn, call_id, /*turn_diff_tracker=*/ None);
emitter.emit(ctx, ToolEventStage::Begin).await;
}
@@ -82,9 +82,9 @@ async fn emit_js_repl_exec_end(
vec!["js_repl".to_string()],
turn.cwd.clone(),
ExecCommandSource::Agent,
false,
/*freeform=*/ false,
);
let ctx = ToolEventCtx::new(session, turn, call_id, None);
let ctx = ToolEventCtx::new(session, turn, call_id, /*turn_diff_tracker=*/ None);
let stage = if error.is_some() {
ToolEventStage::Failure(ToolEventFailure::Output(exec_output))
} else {
@@ -169,7 +169,7 @@ impl ToolHandler for JsReplHandler {
turn.as_ref(),
&call_id,
&content,
None,
/*error=*/ None,
started_at.elapsed(),
)
.await;
@@ -150,7 +150,11 @@ async fn try_resume_closed_agent(
.resume_agent_from_rollout(
config,
receiver_thread_id,
thread_spawn_source(session.conversation_id, child_depth, None),
thread_spawn_source(
session.conversation_id,
child_depth,
/*agent_role=*/ None,
),
)
.await
.map_err(|err| collab_agent_error(receiver_thread_id, err))?;
@@ -197,7 +197,7 @@ impl ToolOutput for WaitAgentResult {
}
fn to_response_item(&self, call_id: &str, payload: &ToolPayload) -> ResponseInputItem {
tool_output_response_item(call_id, payload, self, None, "wait_agent")
tool_output_response_item(call_id, payload, self, /*success=*/ None, "wait_agent")
}
fn code_mode_result(&self, _payload: &ToolPayload) -> JsonValue {
+12 -2
View File
@@ -417,7 +417,12 @@ impl ShellHandler {
source,
freeform,
);
let event_ctx = ToolEventCtx::new(session.as_ref(), turn.as_ref(), &call_id, None);
let event_ctx = ToolEventCtx::new(
session.as_ref(),
turn.as_ref(),
&call_id,
/*turn_diff_tracker=*/ None,
);
emitter.begin(event_ctx).await;
let exec_approval_requirement = session
@@ -478,7 +483,12 @@ impl ShellHandler {
)
.await
.map(|result| result.output);
let event_ctx = ToolEventCtx::new(session.as_ref(), turn.as_ref(), &call_id, None);
let event_ctx = ToolEventCtx::new(
session.as_ref(),
turn.as_ref(),
&call_id,
/*turn_diff_tracker=*/ None,
);
let content = emitter.finish(event_ctx, out).await?;
Ok(FunctionToolOutput::from_text(content, Some(true)))
}
+34 -6
View File
@@ -792,7 +792,11 @@ impl JsReplManager {
}
fn summarize_tool_call_error(error: &str) -> JsReplToolCallResponseSummary {
Self::summarize_text_payload(None, JsReplToolCallPayloadKind::Error, error)
Self::summarize_text_payload(
/*response_type=*/ None,
JsReplToolCallPayloadKind::Error,
error,
)
}
pub async fn reset(&self) -> Result<(), FunctionCallError> {
@@ -962,7 +966,7 @@ impl JsReplManager {
with_model_kernel_failure_message(
"js_repl kernel closed unexpectedly",
"response_channel_closed",
None,
/*stream_error=*/ None,
&snapshot,
)
} else {
@@ -1531,7 +1535,13 @@ impl JsReplManager {
if is_js_repl_internal_tool(&req.tool_name) {
let error = "js_repl cannot invoke itself".to_string();
let summary = Self::summarize_tool_call_error(&error);
Self::log_tool_call_response(&req, false, &summary, None, Some(&error));
Self::log_tool_call_response(
&req,
/*ok=*/ false,
&summary,
/*response=*/ None,
Some(&error),
);
return RunToolResult {
id: req.id,
ok: false,
@@ -1610,7 +1620,13 @@ impl JsReplManager {
let summary = Self::summarize_tool_call_response(&response);
match serde_json::to_value(response) {
Ok(value) => {
Self::log_tool_call_response(&req, true, &summary, Some(&value), None);
Self::log_tool_call_response(
&req,
/*ok=*/ true,
&summary,
Some(&value),
/*error=*/ None,
);
RunToolResult {
id: req.id,
ok: true,
@@ -1621,7 +1637,13 @@ impl JsReplManager {
Err(err) => {
let error = format!("failed to serialize tool output: {err}");
let summary = Self::summarize_tool_call_error(&error);
Self::log_tool_call_response(&req, false, &summary, None, Some(&error));
Self::log_tool_call_response(
&req,
/*ok=*/ false,
&summary,
/*response=*/ None,
Some(&error),
);
RunToolResult {
id: req.id,
ok: false,
@@ -1634,7 +1656,13 @@ impl JsReplManager {
Err(err) => {
let error = err.to_string();
let summary = Self::summarize_tool_call_error(&error);
Self::log_tool_call_response(&req, false, &summary, None, Some(&error));
Self::log_tool_call_response(
&req,
/*ok=*/ false,
&summary,
/*response=*/ None,
Some(&error),
);
RunToolResult {
id: req.id,
ok: false,
+4 -4
View File
@@ -360,14 +360,14 @@ impl NetworkApprovalService {
.request_command_approval(
turn_context.as_ref(),
approval_id,
None,
/*approval_id=*/ None,
prompt_command,
turn_context.cwd.clone(),
Some(prompt_reason),
Some(network_approval_context.clone()),
None,
None,
None,
/*proposed_execpolicy_amendment=*/ None,
/*additional_permissions=*/ None,
/*skill_metadata=*/ None,
available_decisions,
)
.await
+1 -1
View File
@@ -341,7 +341,7 @@ impl ToolRegistryBuilder {
}
pub fn push_spec(&mut self, spec: ToolSpec) {
self.push_spec_with_parallel_support(spec, false);
self.push_spec_with_parallel_support(spec, /*supports_parallel_tool_calls=*/ false);
}
pub fn push_spec_with_parallel_support(
@@ -143,7 +143,13 @@ impl Approvable<ApplyPatchRequest> for ApplyPatchRuntime {
}
if let Some(reason) = retry_reason {
let rx_approve = session
.request_patch_approval(turn, call_id, changes.clone(), Some(reason), None)
.request_patch_approval(
turn,
call_id,
changes.clone(),
Some(reason),
/*grant_root=*/ None,
)
.await;
return rx_approve.await.unwrap_or_default();
}
@@ -154,7 +160,10 @@ impl Approvable<ApplyPatchRequest> for ApplyPatchRuntime {
approval_keys,
|| async move {
let rx_approve = session
.request_patch_approval(turn, call_id, changes, None, None)
.request_patch_approval(
turn, call_id, changes, /*reason=*/ None,
/*grant_root=*/ None,
)
.await;
rx_approve.await.unwrap_or_default()
},
@@ -194,7 +203,7 @@ impl ToolRuntime<ApplyPatchRequest, ExecToolCallOutput> for ApplyPatchRuntime {
) -> Result<ExecToolCallOutput, ToolError> {
let spec = Self::build_command_spec(req, &ctx.turn.config.codex_home)?;
let env = attempt
.env_for(spec, None)
.env_for(spec, /*network=*/ None)
.map_err(|err| ToolError::Codex(err.into()))?;
let out = execute_env(env, Self::stdout_stream(ctx))
.await
+2 -2
View File
@@ -173,7 +173,7 @@ impl Approvable<ShellRequest> for ShellRuntime {
.request_command_approval(
turn,
call_id,
None,
/*approval_id=*/ None,
command,
cwd,
reason,
@@ -182,7 +182,7 @@ impl Approvable<ShellRequest> for ShellRuntime {
.proposed_execpolicy_amendment()
.cloned(),
req.additional_permissions.clone(),
None,
/*skill_metadata=*/ None,
available_decisions,
)
.await
@@ -455,7 +455,7 @@ impl CoreShellActionProvider {
cwd: workdir,
additional_permissions,
},
None,
/*retry_reason=*/ None,
)
.await;
}
@@ -488,9 +488,9 @@ impl CoreShellActionProvider {
approval_id,
command,
workdir,
None,
None,
None,
/*reason=*/ None,
/*network_approval_context=*/ None,
/*proposed_execpolicy_amendment=*/ None,
additional_permissions,
skill_metadata,
Some(available_decisions),
@@ -933,7 +933,7 @@ impl ShellCommandExecutor for CoreShellCommandExecutor {
justification: self.justification.clone(),
arg0: self.arg0.clone(),
},
None,
/*stdout_stream=*/ None,
after_spawn,
)
.await?;
@@ -139,7 +139,7 @@ impl Approvable<UnifiedExecRequest> for UnifiedExecRuntime<'_> {
.request_command_approval(
turn,
call_id,
None,
/*approval_id=*/ None,
command,
cwd,
reason,
@@ -148,7 +148,7 @@ impl Approvable<UnifiedExecRequest> for UnifiedExecRuntime<'_> {
.proposed_execpolicy_amendment()
.cloned(),
req.additional_permissions.clone(),
None,
/*skill_metadata=*/ None,
available_decisions,
)
.await
+44 -39
View File
@@ -2165,7 +2165,7 @@ fn push_tool_spec(
) {
let spec = augment_tool_spec_for_code_mode(spec, code_mode_enabled);
if supports_parallel_tool_calls {
builder.push_spec_with_parallel_support(spec, true);
builder.push_spec_with_parallel_support(spec, /*supports_parallel_tool_calls=*/ true);
} else {
builder.push_spec(spec);
}
@@ -2473,14 +2473,16 @@ pub(crate) fn build_specs_with_discoverable_tools(
&nested_config,
mcp_tools.clone(),
app_tools.clone(),
None,
/*discoverable_tools=*/ None,
dynamic_tools,
)
.build();
let mut enabled_tools = nested_specs
.into_iter()
.filter_map(|spec| {
let (name, description) = match augment_tool_spec_for_code_mode(spec.spec, true) {
let (name, description) = match augment_tool_spec_for_code_mode(
spec.spec, /*code_mode_enabled=*/ true,
) {
ToolSpec::Function(tool) => (tool.name, tool.description),
ToolSpec::Freeform(tool) => (tool.name, tool.description),
_ => return None,
@@ -2493,14 +2495,14 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_code_mode_tool(&enabled_tools, config.code_mode_only_enabled),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler(PUBLIC_TOOL_NAME, code_mode_handler);
push_tool_spec(
&mut builder,
create_exec_wait_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler(WAIT_TOOL_NAME, code_mode_wait_handler);
@@ -2511,7 +2513,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_shell_tool(exec_permission_approvals_enabled),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
}
@@ -2519,7 +2521,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
ToolSpec::LocalShell {},
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
}
@@ -2530,13 +2532,13 @@ pub(crate) fn build_specs_with_discoverable_tools(
config.allow_login_shell,
exec_permission_approvals_enabled,
),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
push_tool_spec(
&mut builder,
create_write_stdin_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler("exec_command", unified_exec_handler.clone());
@@ -2552,7 +2554,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
config.allow_login_shell,
exec_permission_approvals_enabled,
),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
}
@@ -2570,19 +2572,19 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_list_mcp_resources_tool(),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
push_tool_spec(
&mut builder,
create_list_mcp_resource_templates_tool(),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
push_tool_spec(
&mut builder,
create_read_mcp_resource_tool(),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
builder.register_handler("list_mcp_resources", mcp_resource_handler.clone());
@@ -2593,7 +2595,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
PLAN_TOOL.clone(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler("update_plan", plan_handler);
@@ -2602,13 +2604,13 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_js_repl_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
push_tool_spec(
&mut builder,
create_js_repl_reset_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler("js_repl", js_repl_handler);
@@ -2621,7 +2623,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
create_request_user_input_tool(CollaborationModesConfig {
default_mode_request_user_input: config.default_mode_request_user_input,
}),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler("request_user_input", request_user_input_handler);
@@ -2631,7 +2633,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_request_permissions_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler("request_permissions", request_permissions_handler);
@@ -2644,7 +2646,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_tool_search_tool(&app_tools),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
builder.register_handler(TOOL_SEARCH_TOOL_NAME, search_tool_handler);
@@ -2662,7 +2664,10 @@ pub(crate) fn build_specs_with_discoverable_tools(
.as_ref()
.filter(|tools| !tools.is_empty())
{
builder.push_spec_with_parallel_support(create_tool_suggest_tool(discoverable_tools), true);
builder.push_spec_with_parallel_support(
create_tool_suggest_tool(discoverable_tools),
/*supports_parallel_tool_calls=*/ true,
);
builder.register_handler(TOOL_SUGGEST_TOOL_NAME, tool_suggest_handler);
}
@@ -2672,7 +2677,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_apply_patch_freeform_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
}
@@ -2680,7 +2685,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_apply_patch_json_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
}
@@ -2696,7 +2701,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_grep_files_tool(),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
builder.register_handler("grep_files", grep_files_handler);
@@ -2710,7 +2715,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_read_file_tool(),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
builder.register_handler("read_file", read_file_handler);
@@ -2725,7 +2730,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_list_dir_tool(),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
builder.register_handler("list_dir", list_dir_handler);
@@ -2739,7 +2744,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_test_sync_tool(),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
builder.register_handler("test_sync_tool", test_sync_handler);
@@ -2780,7 +2785,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
.and_then(|cfg| cfg.search_context_size),
search_content_types,
},
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
}
@@ -2791,7 +2796,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
ToolSpec::ImageGeneration {
output_format: "png".to_string(),
},
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
}
@@ -2799,7 +2804,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_view_image_tool(config.can_request_original_image_detail),
true,
/*supports_parallel_tool_calls=*/ true,
config.code_mode_enabled,
);
builder.register_handler("view_image", view_image_handler);
@@ -2808,7 +2813,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_artifacts_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler("artifacts", artifacts_handler);
@@ -2818,31 +2823,31 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_spawn_agent_tool(config),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
push_tool_spec(
&mut builder,
create_send_input_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
push_tool_spec(
&mut builder,
create_resume_agent_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
push_tool_spec(
&mut builder,
create_wait_agent_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
push_tool_spec(
&mut builder,
create_close_agent_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler("spawn_agent", Arc::new(SpawnAgentHandler));
@@ -2857,7 +2862,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_spawn_agents_on_csv_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler("spawn_agents_on_csv", agent_jobs_handler.clone());
@@ -2865,7 +2870,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
create_report_agent_job_result_tool(),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler("report_agent_job_result", agent_jobs_handler);
@@ -2882,7 +2887,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
ToolSpec::Function(converted_tool),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler(name, mcp_handler.clone());
@@ -2901,7 +2906,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
push_tool_spec(
&mut builder,
ToolSpec::Function(converted_tool),
false,
/*supports_parallel_tool_calls=*/ false,
config.code_mode_enabled,
);
builder.register_handler(tool.name.clone(), dynamic_tool_handler.clone());
+7 -2
View File
@@ -104,7 +104,7 @@ pub async fn build_turn_metadata_header(cwd: &Path, sandbox: Option<&str>) -> Op
}
build_turn_metadata_bag(
None,
/*turn_id=*/ None,
sandbox.map(ToString::to_string),
repo_root,
Some(WorkspaceGitMetadata {
@@ -135,7 +135,12 @@ impl TurnMetadataState {
) -> Self {
let repo_root = get_git_repo_root(&cwd).map(|root| root.to_string_lossy().into_owned());
let sandbox = Some(sandbox_tag(sandbox_policy, windows_sandbox_level).to_string());
let base_metadata = build_turn_metadata_bag(Some(turn_id), sandbox, None, None);
let base_metadata = build_turn_metadata_bag(
Some(turn_id),
sandbox,
/*repo_root=*/ None,
/*workspace_git_metadata=*/ None,
);
let base_header = base_metadata
.to_header_value()
.unwrap_or_else(|| "{}".to_string());
@@ -196,7 +196,12 @@ pub(crate) async fn emit_exec_end_for_unified_exec(
duration,
timed_out: false,
};
let event_ctx = ToolEventCtx::new(session_ref.as_ref(), turn_ref.as_ref(), &call_id, None);
let event_ctx = ToolEventCtx::new(
session_ref.as_ref(),
turn_ref.as_ref(),
&call_id,
/*turn_diff_tracker=*/ None,
);
let emitter = ToolEmitter::unified_exec(
&command,
cwd,
@@ -180,7 +180,7 @@ impl UnifiedExecProcessManager {
context.session.as_ref(),
context.turn.as_ref(),
&context.call_id,
None,
/*turn_diff_tracker=*/ None,
);
let emitter = ToolEmitter::unified_exec(
&request.command,
+2 -2
View File
@@ -79,7 +79,7 @@ pub fn test_path_buf_with_windows(unix_path: &str, windows_path: Option<&str>) -
}
pub fn test_path_buf(unix_path: &str) -> PathBuf {
test_path_buf_with_windows(unix_path, None)
test_path_buf_with_windows(unix_path, /*windows_path=*/ None)
}
pub fn test_absolute_path_with_windows(
@@ -91,7 +91,7 @@ pub fn test_absolute_path_with_windows(
}
pub fn test_absolute_path(unix_path: &str) -> AbsolutePathBuf {
test_absolute_path_with_windows(unix_path, None)
test_absolute_path_with_windows(unix_path, /*windows_path=*/ None)
}
pub fn test_tmp_path() -> AbsolutePathBuf {
+6 -6
View File
@@ -81,7 +81,7 @@ pub async fn start_streaming_sse_server(
tokio::spawn(async move {
let (request, body_prefix) = read_http_request(&mut stream).await;
let Some((method, path)) = parse_request_line(&request) else {
let _ = write_http_response(&mut stream, 400, "bad request", "text/plain").await;
let _ = write_http_response(&mut stream, /*status=*/ 400, "bad request", "text/plain").await;
return;
};
@@ -90,7 +90,7 @@ pub async fn start_streaming_sse_server(
.await
.is_err()
{
let _ = write_http_response(&mut stream, 400, "bad request", "text/plain").await;
let _ = write_http_response(&mut stream, /*status=*/ 400, "bad request", "text/plain").await;
return;
}
let body = serde_json::json!({
@@ -98,7 +98,7 @@ pub async fn start_streaming_sse_server(
"object": "list"
})
.to_string();
let _ = write_http_response(&mut stream, 200, &body, "application/json").await;
let _ = write_http_response(&mut stream, /*status=*/ 200, &body, "application/json").await;
return;
}
@@ -108,13 +108,13 @@ pub async fn start_streaming_sse_server(
{
Ok(body) => body,
Err(_) => {
let _ = write_http_response(&mut stream, 400, "bad request", "text/plain").await;
let _ = write_http_response(&mut stream, /*status=*/ 400, "bad request", "text/plain").await;
return;
}
};
requests.lock().await.push(body);
let Some((chunks, completion)) = take_next_stream(&state).await else {
let _ = write_http_response(&mut stream, 500, "no responses queued", "text/plain").await;
let _ = write_http_response(&mut stream, /*status=*/ 500, "no responses queued", "text/plain").await;
return;
};
@@ -138,7 +138,7 @@ pub async fn start_streaming_sse_server(
return;
}
let _ = write_http_response(&mut stream, 404, "not found", "text/plain").await;
let _ = write_http_response(&mut stream, /*status=*/ 404, "not found", "text/plain").await;
});
}
}
+15 -5
View File
@@ -105,7 +105,7 @@ impl TestCodexBuilder {
Some(home) => home,
None => Arc::new(TempDir::new()?),
};
Box::pin(self.build_with_home(server, home, None)).await
Box::pin(self.build_with_home(server, home, /*resume_from=*/ None)).await
}
pub async fn build_with_streaming_server(
@@ -117,7 +117,12 @@ impl TestCodexBuilder {
Some(home) => home,
None => Arc::new(TempDir::new()?),
};
Box::pin(self.build_with_home_and_base_url(format!("{base_url}/v1"), home, None)).await
Box::pin(self.build_with_home_and_base_url(
format!("{base_url}/v1"),
home,
/*resume_from=*/ None,
))
.await
}
pub async fn build_with_websocket_server(
@@ -138,7 +143,7 @@ impl TestCodexBuilder {
.enable(Feature::ResponsesWebsockets)
.expect("test config should allow feature update");
}));
Box::pin(self.build_with_home_and_base_url(base_url, home, None)).await
Box::pin(self.build_with_home_and_base_url(base_url, home, /*resume_from=*/ None)).await
}
pub async fn resume(
@@ -362,8 +367,13 @@ impl TestCodex {
approval_policy: AskForApproval,
sandbox_policy: SandboxPolicy,
) -> Result<()> {
self.submit_turn_with_context(prompt, approval_policy, sandbox_policy, None)
.await
self.submit_turn_with_context(
prompt,
approval_policy,
sandbox_policy,
/*service_tier=*/ None,
)
.await
}
async fn submit_turn_with_context(
+1 -1
View File
@@ -102,7 +102,7 @@ fn find_test_zsh_path() -> Result<Option<PathBuf>> {
return Ok(None);
}
match crate::fetch_dotslash_file(&dotslash_zsh, None) {
match crate::fetch_dotslash_file(&dotslash_zsh, /*dotslash_cache=*/ None) {
Ok(path) => Ok(Some(path)),
Err(error) => {
eprintln!("skipping zsh-fork test: failed to fetch zsh via dotslash: {error:#}");
+1 -1
View File
@@ -219,7 +219,7 @@ fn handle_command(
true
}
UserCommand::RefreshThread => {
match client.request_thread_list(None) {
match client.request_thread_list(/*cursor=*/ None) {
Ok(request_id) => {
output
.client_line(&format!("requested thread list ({request_id:?})"))
@@ -777,7 +777,7 @@ impl EventProcessor for EventProcessorWithHumanOutput {
self,
"{} {}",
"collab".style(self.magenta),
format_collab_invocation("wait", &call_id, None).style(self.bold)
format_collab_invocation("wait", &call_id, /*prompt=*/ None).style(self.bold)
);
eprintln!(
" receivers: {}",
@@ -794,7 +794,7 @@ impl EventProcessor for EventProcessorWithHumanOutput {
ts_msg!(
self,
"{} {}:",
format_collab_invocation("wait", &call_id, None),
format_collab_invocation("wait", &call_id, /*prompt=*/ None),
"timed out".style(self.yellow)
);
return CodexStatus::Running;
@@ -803,7 +803,7 @@ impl EventProcessor for EventProcessorWithHumanOutput {
let title_style = if success { self.green } else { self.red };
let title = format!(
"{} {} agents complete:",
format_collab_invocation("wait", &call_id, None),
format_collab_invocation("wait", &call_id, /*prompt=*/ None),
statuses.len()
);
ts_msg!(self, "{}", title.style(title_style));
@@ -829,7 +829,8 @@ impl EventProcessor for EventProcessorWithHumanOutput {
self,
"{} {}",
"collab".style(self.magenta),
format_collab_invocation("close_agent", &call_id, None).style(self.bold)
format_collab_invocation("close_agent", &call_id, /*prompt=*/ None)
.style(self.bold)
);
eprintln!(
" receiver: {}",
@@ -847,7 +848,7 @@ impl EventProcessor for EventProcessorWithHumanOutput {
let title_style = if success { self.green } else { self.red };
let title = format!(
"{} {}:",
format_collab_invocation("close_agent", &call_id, None),
format_collab_invocation("close_agent", &call_id, /*prompt=*/ None),
format_collab_status(&status)
);
ts_msg!(self, "{}", title.style(title_style));
@@ -1246,7 +1247,7 @@ fn format_collab_invocation(tool: &str, call_id: &str, prompt: Option<&str>) ->
let prompt = prompt
.map(str::trim)
.filter(|prompt| !prompt.is_empty())
.map(|prompt| truncate_preview(prompt, 120));
.map(|prompt| truncate_preview(prompt, /*max_chars=*/ 120));
match prompt {
Some(prompt) => format!("{tool}({call_id}, prompt=\"{prompt}\")"),
None => format!("{tool}({call_id})"),
@@ -1258,7 +1259,7 @@ fn format_collab_status(status: &AgentStatus) -> String {
AgentStatus::PendingInit => "pending init".to_string(),
AgentStatus::Running => "running".to_string(),
AgentStatus::Completed(Some(message)) => {
let preview = truncate_preview(message.trim(), 120);
let preview = truncate_preview(message.trim(), /*max_chars=*/ 120);
if preview.is_empty() {
"completed".to_string()
} else {
@@ -1267,7 +1268,7 @@ fn format_collab_status(status: &AgentStatus) -> String {
}
AgentStatus::Completed(None) => "completed".to_string(),
AgentStatus::Errored(message) => {
let preview = truncate_preview(message.trim(), 120);
let preview = truncate_preview(message.trim(), /*max_chars=*/ 120);
if preview.is_empty() {
"errored".to_string()
} else {
@@ -495,7 +495,7 @@ impl EventProcessorWithJsonOutput {
.iter()
.map(ToString::to_string)
.collect(),
None,
/*prompt=*/ None,
)
}
@@ -526,7 +526,7 @@ impl EventProcessorWithJsonOutput {
CollabTool::Wait,
ev.sender_thread_id.to_string(),
receiver_thread_ids,
None,
/*prompt=*/ None,
agents_states,
status,
)
@@ -538,7 +538,7 @@ impl EventProcessorWithJsonOutput {
CollabTool::CloseAgent,
ev.sender_thread_id.to_string(),
vec![ev.receiver_thread_id.to_string()],
None,
/*prompt=*/ None,
)
}
@@ -555,7 +555,7 @@ impl EventProcessorWithJsonOutput {
CollabTool::CloseAgent,
ev.sender_thread_id.to_string(),
vec![receiver_id.clone()],
None,
/*prompt=*/ None,
[(receiver_id, agent_state)].into_iter().collect(),
status,
)
@@ -221,6 +221,6 @@ fn policy_builtins(builder: &mut GlobalsBuilder) {
}
fn flag(name: String) -> anyhow::Result<Opt> {
Ok(Opt::new(name, OptMeta::Flag, false))
Ok(Opt::new(name, OptMeta::Flag, /*required=*/ false))
}
}

Some files were not shown because too many files have changed in this diff Show More