mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
better error handling + example
This commit is contained in:
13
codex-rs/.codex/policy.codexpolicy
Normal file
13
codex-rs/.codex/policy.codexpolicy
Normal file
@@ -0,0 +1,13 @@
|
||||
# Execpolicy v2 smoke-test policy
|
||||
prefix_rule(
|
||||
pattern = ["echo", ["a", "b"]],
|
||||
decision = "allow",
|
||||
match = ["echo c"],
|
||||
not_match = ["echo-policy-allowed"],
|
||||
)
|
||||
|
||||
prefix_rule(
|
||||
pattern = ["echo", "c"],
|
||||
decision = "forbidden",
|
||||
match = ["echo c"],
|
||||
)
|
||||
@@ -10,6 +10,7 @@ use tokio::sync::mpsc::unbounded_channel;
|
||||
|
||||
use crate::app_event::AppEvent;
|
||||
use crate::app_event_sender::AppEventSender;
|
||||
use crate::history_cell;
|
||||
|
||||
/// Spawn the agent bootstrapper and op forwarding loop, returning the
|
||||
/// `UnboundedSender<Op>` used by the UI to submit operations.
|
||||
@@ -29,8 +30,12 @@ pub(crate) fn spawn_agent(
|
||||
} = match server.new_conversation(config).await {
|
||||
Ok(v) => v,
|
||||
Err(e) => {
|
||||
// TODO: surface this error to the user.
|
||||
tracing::error!("failed to initialize codex: {e}");
|
||||
let message =
|
||||
format!("Failed to initialize Codex: {e}");
|
||||
tracing::error!("{message}");
|
||||
app_event_tx_clone.send(AppEvent::InsertHistoryCell(Box::new(
|
||||
history_cell::new_error_event(message),
|
||||
)));
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user