mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Support cua_repl as a Node REPL-backed MCP server (#40257)
## What changed - Recognize `cua_repl` alongside `node_repl` when collecting Guardian review evidence, applying computer-use policy, and capturing transcript images. - Render `cua_repl.js` results with the compact REPL history and transcript views. - Preserve failed MCP call status and result content when replaying app-server history. ## Testing - Cover both REPL server names across Guardian policy, evidence, image capture, history rendering, and failed-call replay tests. GitOrigin-RevId: 8c13a721f718add403b07e727c1634b59203c51a
This commit is contained in:
1 parent
c9b19deb09
commit
2161ec272a
16 files changed
+260
-82
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# Computer and Browser Use
|
||||
Apply these extra rules when evaluating computer and browser use via Node REPL tool calls. User authorization includes proportionate implementation steps, but never overrides an explicit user restriction or specific authorization requirement. Ignore this section for other tools.
|
||||
- Recursively evaluate all tools called within Node REPL.
|
||||
Apply these extra rules when evaluating computer and browser use via `node_repl` or `cua_repl` tool calls. User authorization includes proportionate implementation steps, but never overrides an explicit user restriction or specific authorization requirement. Ignore this section for other tools.
|
||||
- Recursively evaluate all tools called within `node_repl` or `cua_repl`.
|
||||
- Actions which attempt to achieve the same result as a previously restricted action are `unknown` authorization and `high` risk and must be denied, unless this approach is an approved safer route.
|
||||
- Actions which grant, expand, or advance privileged access or any permissions are `high` risk, and must be denied unless there is specific user authorization for both the permission and the party involved. Assess the full access acquired, not just its immediate use. Permission changes must not exceed the specific principals, resources, or scope the user authorized.
|
||||
- Actions that sign in or have consequential effects as a signed-in user are `high` risk and must be specifically authorized; merely navigating under an existing signed-in session is not `high` risk in itself.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use codex_protocol::mcp::is_node_repl_backed_tool;
|
||||
use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::models::plaintext_agent_message_content;
|
||||
use codex_protocol::protocol::GuardianRiskLevel;
|
||||
@@ -593,16 +594,7 @@ pub(crate) fn collect_guardian_transcript_entries<'a>(
|
||||
call_id, output, ..
|
||||
} => output.body.to_text().and_then(|text| {
|
||||
let kind = match tool_names_by_call_id.get(call_id.as_str()) {
|
||||
Some((name, namespace))
|
||||
if matches!(
|
||||
namespace,
|
||||
Some(
|
||||
"mcp__node_repl" | "mcp__node_repl__" | "node_repl" | "node_repl__"
|
||||
)
|
||||
) || namespace.is_none()
|
||||
&& (name.starts_with("mcp__node_repl__")
|
||||
|| name.starts_with("node_repl__")) =>
|
||||
{
|
||||
Some((name, namespace)) if is_node_repl_backed_tool(name, *namespace) => {
|
||||
GuardianTranscriptEntryKind::NodeReplToolResult(format!(
|
||||
"tool {name} result"
|
||||
))
|
||||
|
||||
@@ -906,7 +906,7 @@ pub(super) async fn guardian_review_session_config(
|
||||
.enable(Feature::RetainClientDeveloperMessages)
|
||||
.map_err(|error| {
|
||||
anyhow::anyhow!(
|
||||
"guardian review session could not preserve Node REPL developer policy: {error}"
|
||||
"guardian review session could not preserve REPL developer policy: {error}"
|
||||
)
|
||||
})?;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ use codex_protocol::config_types::AutoCompactTokenLimitScope;
|
||||
use codex_protocol::config_types::Personality;
|
||||
use codex_protocol::config_types::ReasoningSummary as ReasoningSummaryConfig;
|
||||
use codex_protocol::items::TurnItem;
|
||||
use codex_protocol::mcp::is_node_repl_backed_server;
|
||||
use codex_protocol::models::BaseInstructionsProvenance;
|
||||
use codex_protocol::models::ContentItem;
|
||||
use codex_protocol::models::ImageDetail;
|
||||
@@ -955,7 +956,7 @@ async fn run_review_on_session(
|
||||
&& matches!(
|
||||
¶ms.request,
|
||||
GuardianApprovalRequest::McpToolCall { server, tool_name, .. }
|
||||
if server == "node_repl" && tool_name == "js"
|
||||
if is_node_repl_backed_server(server) && tool_name == "js"
|
||||
)
|
||||
{
|
||||
let policy = GuardianNodeReplPolicy;
|
||||
|
||||
Reference in new issue
Block a user