Skip to content

Commit cd1459f

Browse files
authored
Disable Codex goals so no work outlives the Turn (#876)
An active Codex goal makes app-server start a continuation turn on its own whenever the thread goes idle. On mx a hosted Session whose Turn created a goal ran a second native turn right after the Turn completed: two exec_command calls wrote notes.txt in the workspace and update_goal closed the goal, while the API listed one completed Turn. The adapter now passes --disable goals, an unattended-cloud override for work that outlives its Turn.
1 parent abebcd1 commit cd1459f

5 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎apps/daemon/internal/agent/codex/options.go‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ type SessionPlan struct {
7878
func BuildSessionPlan(stateRoot, agentStateKey string, opts map[string]any, controls *proto.ExecutionControls) (SessionPlan, error) {
7979
plan := SessionPlan{
8080
// Harnesses run unattended: Codex never offers its ask-the-user tool,
81-
// and an unreachable model host fails the Turn after the provider's
82-
// bounded retries instead of waiting for the network forever.
81+
// an unreachable model host fails the Turn after the provider's
82+
// bounded retries instead of waiting for the network forever, and no
83+
// goal starts native turns of its own after the Turn ends.
8384
ExtraConfig: [][2]string{{"tools.experimental_request_user_input.enabled", "false"}},
84-
DisableFeatures: []string{"unbounded_connection_retries"},
85+
DisableFeatures: []string{"unbounded_connection_retries", "goals"},
8586
Cleanup: func() {},
8687
}
8788

‎apps/daemon/internal/agent/codex/provider_config_test.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,18 @@ func TestModelConnectionRetriesStayBounded(t *testing.T) {
214214
}
215215
}
216216

217+
// An active Codex goal starts native turns on its own whenever its thread is
218+
// idle, which would run work after the Turn ends.
219+
func TestGoalsStayDisabled(t *testing.T) {
220+
plan, err := BuildSessionPlan(t.TempDir(), "goals", map[string]any{}, nil)
221+
if err != nil {
222+
t.Fatal(err)
223+
}
224+
if !slices.Contains(plan.DisableFeatures, "goals") {
225+
t.Fatal("goals stay enabled")
226+
}
227+
}
228+
217229
func TestProviderCredentialOnlyInNativeLoopEnvironment(t *testing.T) {
218230
root := t.TempDir()
219231
const token = "synthetic-private-provider-token"

‎contracts/agents-api/index.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Each item is Core's deliberate or native behavior where the official service beh
7979
- An omitted reasoning effort stays null instead of taking the model's default.
8080
- Codex maps programmatic tool calling to its native `code_mode`, whose model-written scripts call the other tools; the feature is under development upstream.
8181
- Codex rejects programmatic tool calling together with `multi_agent`.
82+
- Codex runs without its native goals (`create_goal`, `get_goal` and `update_goal`), because an active goal starts turns of its own after the Turn ends ([Codex Runtime](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/services/core/deploy/codex/README.md)).
8283
- A Session's `agent.tools` omits `tool_search` declarations.
8384
- Core rejects an inline `authorization` on a Session MCP transport, an `Authorization` entry in `headers` and a nonempty stdio `env`: credentials come only from Vaults (`credential_id`) and environment values only from the Environment (`env_vars`) ([MCP](./execution-tools.md#mcp)).
8485
- A `stdio` MCP server needs a workspace placement and the origin `environment`. Claude Code starts the server in its workspace directory, so `cwd` must equal it, with its whole process environment, which also holds the model provider key and other servers' Vault bearer tokens, and it needs `allowed_tools` null. MiniMax Code starts the server in its private home directory, so it rejects every `stdio` server ([MCP](./execution-tools.md#mcp)).

‎contracts/agents-api/zh/index.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "OpenAI 兼容性"
33
source: contracts/agents-api/index.md
4-
source_hash: 1ba11a295c62e532fae58388b09d54a065648642ee17aed10081a36c65ef64f5
4+
source_hash: 3e138165ee27672531124d2c156d24e087fb6904e60f828635990dd1d3eb8626
55
---
66

77
Core 实现下方固定版本的 OpenAI Agents API。本台账列出各项资源的覆盖情况、相对于官方服务的所有差异以及已知缺口。
@@ -82,6 +82,7 @@ Core 自身字段位于 `x_agents_core` 中([Core extensions](../../../docs/zh
8282
- 未指定推理强度时会保持为 null,而不是采用模型的默认值。
8383
- Codex 把程序化工具调用映射到原生 `code_mode`,由模型编写的脚本调用其他工具;该功能在上游仍处于开发中。
8484
- Codex 拒绝同时使用程序化工具调用和 `multi_agent`。
85+
- Codex 不启用原生 goals(`create_goal`、`get_goal` 和 `update_goal`),因为处于活动状态的 goal 会在 Turn 结束后自行启动新的 turn([Codex Runtime](https://github.com/MiniMax-AI/OpenAgentCore/blob/main/services/core/deploy/codex/README.md))。
8586
- Session 的 `agent.tools` 会省略 `tool_search` 声明。
8687
- Core 拒绝 Session MCP 传输中的内联 `authorization`、`headers` 中的 `Authorization` 条目以及非空的 stdio `env`:凭据只来自 Vault(`credential_id`),环境值只来自 Environment(`env_vars`)([MCP](execution-tools.md#mcp))。
8788
- `stdio` MCP 服务器需要工作区部署位置和 `environment` 来源。Claude Code 在其工作区目录中启动服务器,因此 `cwd` 必须与之相同;服务器继承整个进程环境,其中也有模型提供方密钥和其他服务器的 Vault bearer 令牌;且 `allowed_tools` 须为 null。MiniMax Code 在其私有主目录中启动服务器,因此拒绝所有 `stdio` 服务器([MCP](execution-tools.md#mcp))。

‎services/core/deploy/codex/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Each Session has its own `CODEX_HOME` at `<StateRoot>/daemon/agent-sessions/<sta
1616

1717
By default Codex retries a failed model connection forever, waiting up to 60 seconds between attempts, so a Turn whose model host is unreachable stays in progress with no events. The adapter disables that `unbounded_connection_retries` feature, so Codex falls back to its bounded defaults: up to 4 retries per request and 5 per response stream. A model host that does not resolve or refuses connections then fails the Turn with `connection_failed` within about a minute, depending on how long each lookup or connection attempt takes. Retries start only after a request fails, so slow responses are unaffected, and a stream still ends after Codex's 300 seconds without data. Codex sets no connect timeout: against a host that silently drops connections, each of the 30 attempts waits for the operating system's connect timeout.
1818

19+
Codex's `goals` feature is on by default: when a thread with an active goal goes idle, Codex starts another turn toward the goal on its own, so its tools and model calls would keep running after the Turn ends, outside any Turn the API reports. The adapter disables it, so the model is not offered `create_goal`, `get_goal` or `update_goal`.
20+
1921
## Execution controls
2022

2123
The adapter applies Core's typed controls and opt-ins, described in the [Runtime protocol](../../../../docs/runtime-protocol.md#capability-declarations), through native Codex settings on both new and resumed Turns.

0 commit comments

Comments
 (0)