Skip to content

Add support for shell and agent_patch and generally reorganize openai agent#219

Merged
pimpale merged 33 commits intomainfrom
g/codex-support
Nov 27, 2025
Merged

Add support for shell and agent_patch and generally reorganize openai agent#219
pimpale merged 33 commits intomainfrom
g/codex-support

Conversation

@pimpale
Copy link
Collaborator

@pimpale pimpale commented Nov 25, 2025

Note

Refactors OpenAI/Operator agents to use strict tool schemas and native Responses tools (shell/apply_patch/computer), validates required tools, tightens computer tool params, and bumps openai to >=2.8.1.

  • Agents:
    • OpenAI:
      • Reworks tool conversion (_convert_tools_for_openai) with strict schemas and native shell/apply_patch support; adds truncation, typed reasoning/tool_choice, and generalized tool-call extraction.
      • Inlines request payload (uses Omit() for unset fields); format_blocks adds image detail="auto"; format_tool_results supports resource_link and embedded resources.
    • Operator:
      • Requires openai_computer; converts MCP computer tool to computer_use_preview with display/env settings (adds ubuntu env) and routes computer_call with pending safety checks; forces reasoning summary/truncation to auto.
    • Base: Logs MCP init failures and enforces required_tools presence.
  • Tools:
    • HudComputerTool and OpenAIComputerTool: tighten parameter types with Literals, unify mouse buttons, and refine action handling.
  • Tests:
    • Extensive updates for new tool conversion, payload assertions, computer-call routing, resource handling, and safety checks.
  • Dependencies:
    • Bump openai to >=2.8.1.

Written by Cursor Bugbot for commit 46a3a6a. This will update automatically on new commits. Configure here.

if self.reasoning is None:
self.reasoning = Reasoning(summary="auto")
else:
self.reasoning["summary"] = "auto"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Inconsistent reasoning field override in OperatorAgent

The reasoning field override has inconsistent behavior between the two branches. When reasoning is None, line 94 creates a fresh Reasoning instance, resulting in {"summary": "auto"}. When reasoning is not None, line 96 mutates the existing dict by adding the summary key, preserving other keys like {"effort": "high", "summary": "auto"}. This inconsistency means the same attribute ends up with different structures depending on initialization, potentially causing unexpected API calls. Both branches should result in the same final state to match the "override" intention in the comment.

Fix in Cursor Fix in Web

@pimpale
Copy link
Collaborator Author

pimpale commented Nov 26, 2025

return MCPToolCall(
name=self._operator_computer_tool_name,
arguments=item.action.to_dict(),
id=item.call_id,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing pending_call_id assignment in operator agent

The _extract_tool_call method sets self.pending_safety_checks but doesn't set self.pending_call_id like the previous _convert_computer_tool_call method did. Later in format_tool_results at line 152, the code falls back to self.pending_call_id when call.id is missing, but since pending_call_id is never assigned, this fallback won't work and could cause computer tool results to be skipped.

Fix in Cursor Fix in Web

@pimpale pimpale merged commit cda77d7 into main Nov 27, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants