Skip to content

Codex agents incorrectly stop or declare completion while tasks are still incomplete #41176

Open

Description

@tamnhi3009

What version of Codex CLI is running?

0.150.1

What subscription do you have?

Plus

Which model were you using?

gpt-5.6-terra > gpt-5.6-sol

What platform is your computer?

WSL

What terminal emulator and version are you using (if applicable)?

No response

Codex doctor report

{
  "schemaVersion": 1,
  "generatedAt": "1787852709s since unix epoch",
  "overallStatus": "ok",
  "codexVersion": "0.150.1",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/home/thanhtam23/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/home/thanhtam23/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/home/thanhtam23/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/home/thanhtam23/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/home/thanhtam23/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "/home/thanhtam23/.codex/auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/home/thanhtam23/.codex",
        "config.toml": "/home/thanhtam23/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/home/thanhtam23/projects/tastet",
        "enabled feature flags": "shell_tool, view_image, unified_exec, unified_exec_zsh_fork, shell_snapshot, code_mode_host, terminal_resize_reflow, sqlite, hooks, enable_request_compression, unbounded_connection_retries, multi_agent, apps, tool_search_always_defer_mcp_tools, tool_suggest, plugins, in_app_browser, in_app_chat, in_app_dictation, in_app_local_automation, in_app_updates, browser_use, browser_use_full_cdp_access, browser_use_external, computer_use, remote_plugin, plugin_sharing, image_generation, resize_all_images, item_ids, skill_mcp_dependency_install, skill_search, mentions_v2, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, auth_elicitation, personality, fast_mode, tui_app_server, remote_compaction_v2, compaction_image_budget, workspace_dependencies",
        "feature flag overrides": "none",
        "feature flags enabled": "45",
        "log dir": "/home/thanhtam23/.codex/log",
        "mcp servers": "0",
        "model": "gpt-5.6-sol",
        "model provider": "openai",
        "sqlite home": "/home/thanhtam23/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.43.0",
      "details": {
        ".git entry": "directory",
        "PATH git #1": "/usr/bin/git",
        "PATH git #2": "/bin/git",
        "PATH git entries": "2",
        "git branch": "main",
        "git build options": "git version 2.43.0; cpu: x86_64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh",
        "git exec path": "/usr/lib/git-core",
        "git version": "git version 2.43.0",
        "repo detected": "true",
        "repo root": "/home/thanhtam23/projects/tastet",
        "selected git": "/usr/bin/git"
      },
      "remediation": null,
      "durationMs": 297
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/home/thanhtam23/.npm-global/bin/codex",
        "current executable": "/home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex",
        "install context": "npm (package /home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl, bin /home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin, resources /home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-resources, path /home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path)",
        "managed by bun": "false",
        "managed by npm": "true",
        "managed by pnpm": "false",
        "managed package root": "/home/thanhtam23/.npm-global/lib/node_modules/@openai/codex",
        "npm update target": "/home/thanhtam23/.npm-global/lib/node_modules/@openai/codex"
      },
      "remediation": null,
      "durationMs": 183
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "no MCP servers configured",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "managed proxy": "not configured",
        "proxy env vars": "none",
        "respect system proxy": "disabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT inference URL": "https://chatgpt.com/backend-api/<redacted> reachable (HTTP 405)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 362
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 975
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running npm on linux-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "/home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex",
        "install method": "npm (package /home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl, bin /home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin, resources /home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-resources, path /home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path)",
        "platform": "linux-x86_64",
        "version": "0.150.1"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "/home/thanhtam23/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/codex-path/rg",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "/home/thanhtam23/.codex/tmp/arg0/codex-arg0sHNqLZ/codex-linux-sandbox",
        "execve wrapper helper": "/home/thanhtam23/.codex/tmp/arg0/codex-arg0sHNqLZ/codex-execve-wrapper",
        "filesystem sandbox": "restricted",
        "network sandbox": "restricted"
      },
      "remediation": null,
      "durationMs": 0
    },
    "security.endpoint": {
      "id": "security.endpoint",
      "category": "security",
      "status": "ok",
      "summary": "endpoint protection is not inspected on this platform",
      "details": {
        "endpoint products": "not inspected on this platform"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "/home/thanhtam23/.codex (dir)",
        "active rollout files": "550 files, 1045580917 total bytes, 1901056 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "/home/thanhtam23/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/home/thanhtam23/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/home/thanhtam23/.codex/log (dir)",
        "memories DB": "/home/thanhtam23/.codex/memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "queue DB": "/home/thanhtam23/.codex/queue_1.sqlite (file)",
        "queue DB integrity": "ok",
        "sqlite home": "/home/thanhtam23/.codex (dir)",
        "state DB": "/home/thanhtam23/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "/home/thanhtam23/.codex/thread_history_1.sqlite (file)",
        "thread history DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 788
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "ok",
      "summary": "rollout files and state DB thread inventory agree",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "550",
        "rollout DB active rows": "550",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "0",
        "rollout DB archived rows": "0",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=550",
        "rollout DB rows": "550",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "cli=423, subagent:thread_spawn=127",
        "rollout DB stale rows": "0"
      },
      "remediation": null,
      "durationMs": 751
    },
    "system.disk": {
      "id": "system.disk",
      "category": "disk",
      "status": "ok",
      "summary": "sufficient free disk space (912.5 GiB)",
      "details": {
        "CODEX_HOME available": "912.5 GiB",
        "failure threshold": "1.0 GiB",
        "warning threshold": "5.0 GiB",
        "worktree available": "912.5 GiB"
      },
      "remediation": null,
      "durationMs": 0
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language C",
      "details": {
        "EDITOR": "not set",
        "LANG": "C.UTF-8",
        "VISUAL": "not set",
        "os": "Ubuntu 24.4.0 (noble) [64-bit]",
        "os language": "C",
        "os type": "Ubuntu",
        "os version": "24.4.0"
      },
      "remediation": null,
      "durationMs": 18
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "DISPLAY": "present",
        "TERM": "xterm-256color",
        "WAYLAND_DISPLAY": "present",
        "WSL_DISTRO_NAME": "present",
        "WSL_INTEROP": "present",
        "color output": "enabled",
        "effective locale": "C.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "true",
        "terminal": "unknown",
        "terminal size": "120x30"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "git repo root",
        "terminal title project value": "tastet",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.150.1",
        "check for update on startup": "true",
        "last checked at": "2026-08-27T17:17:30.318124844Z",
        "latest version": "0.150.1",
        "latest version status": "current version is not older",
        "npm update target": "/home/thanhtam23/.npm-global/lib/node_modules/@openai/codex",
        "update action": "npm install -g @openai/codex",
        "version cache": "/home/thanhtam23/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 739
    }
  }
}

What issue are you seeing?

I am seeing a recurring reliability problem with Codex determining whether a software-engineering task is actually complete.

In the same large, cross-cutting story, I observed two opposite failure modes:

  • GPT-5.6 Terra: correctly knew substantial work remained, but repeatedly stopped anyway.
  • GPT-5.6 Sol: continued working to the end, but declared the story complete despite unmet acceptance criteria and a failing required repository check.

This is not a complaint that AI-generated code requires review. I expect review. The problem is that the agent's own determination of "done" is unreliable.

Terra: stops despite knowing the task is incomplete

Terra stopped partway through the story and explicitly acknowledged that major implementation work and required tests remained.

It also acknowledged there was no blocker and that it should have continued.

After I explicitly told it to continue, it performed a small amount of additional work, reported that other parts were still "in progress," and stopped again.

The model therefore appeared to understand the state of the task correctly but treated an intermediate milestone as a valid termination point.

Sol: declares completion without verifying completion

I switched to Sol in the same context and asked it to continue.

Sol was much better at persistence and continued until it considered the story complete.

However, an independent code-review pass against the original story found eight missing or broken requirements, including several basic user workflows.

It also found that an existing mandatory repository build check was failing.

After receiving this feedback, Sol itself acknowledged that when it moved the story to review:

  • Several explicit acceptance criteria were not implemented.
  • The story checklist was still incomplete.
  • A required production build had not passed.
  • It had not verified each acceptance criterion against the finished behavior.
  • It had substituted narrower tests for a required repository gate without establishing equivalence.
  • Some unmet requirements had been documented as deviations rather than treated as unfinished work.

In other words, this was not simply a case where subtle defects escaped review. There was already evidence available to the agent that the task was not complete.

Why this matters

The independent reviewer was also an AI.

I fully expect AI-generated software to require review, just as human-written software does. But review should be an additional quality layer, not the mechanism required to determine whether the implementing agent actually completed the explicitly assigned work.

Another AI, given the original story and resulting implementation, was readily able to identify the unmet requirements and failing repository gate.

For an autonomous coding agent handling an engineering story end-to-end, I would expect "done" to require at minimum:

  • All explicit acceptance criteria accounted for.
  • Required repository/build/test gates passing.
  • Major end-to-end workflows verified.
  • No known unfinished checklist items.
  • No known unmet requirements represented merely as deviations.
  • Continued autonomous work whenever actionable work remains and no user decision or external blocker is required.

The two models exhibited opposite versions of the same underlying problem:

Terra: knows the task is incomplete, but stops.

Sol: knows or has evidence that the task is incomplete, but declares completion.

For long-running engineering work, reliable completion detection and self-verification are as important as raw coding capability. A user should be able to distinguish between "the agent reached an intermediate checkpoint" and "the assigned story has actually been completed and is ready for review."

What steps can reproduce the bug?

Uploaded thread: 01a043ec-ba0d-7e71-ab17-ba1fdf2456a9

What is the expected behavior?

No response

Additional information

No response

Activity

  1. added
    CLIIssues related to the Codex CLI
    model-behaviorIssues related to behaviors exhibited by the model
    on Aug 27, 2026
  2. byte271 commented on Aug 28, 2026

    @byte271

    I audited the goal lifecycle on current openai/codex main (41d3dc56a0, #41239) because this report looks like more than a model-behavior problem.

    update_goal currently accepts Complete / Blocked in handle_update and persists the new goal state without first checking for live unified-exec processes or non-terminal child agents:

    async fn handle_update(
    &self,
    invocation: ToolCall<'_>,
    ) -> Result<Box<dyn ToolOutput>, FunctionCallError> {
    let args: UpdateGoalArgs = parse_arguments(invocation.function_arguments()?)?;
    if !matches!(
    args.status,
    ThreadGoalStatus::Complete | ThreadGoalStatus::Blocked
    ) {
    return Err(FunctionCallError::RespondToModel(
    "update_goal can only mark the existing goal complete or blocked; pause, resume, budget-limited, and usage-limited status changes are controlled by the user or system"
    .to_string(),
    ));
    }

    That creates a concrete lifecycle hole: goal completion and process/subagent completion are separate authorities. A model can therefore legitimately call update_goal(Complete) while work represented elsewhere is still non-terminal.

    I built a small observation/reducer experiment for this invariant:

    cd codex-agent-kernel
    cargo run -p codex-kernel-cli -- experiment goal-complete

    The disagreement is reported as goal_complete_unfinished_work.

    The minimal invariant I would expect is: before persisting Complete, reject completion while the thread still owns a live process or a non-terminal child. This also keeps MODEL_FINISHED_TURN distinct from GOAL_COMPLETED.

    Full RCA / reproducible artifact: https://github.com/byte271/codex/blob/main/codex-agent-kernel/docs/UPSTREAM.md

    This is root-cause evidence for the issue, not an external code PR.

  3. andrejg2008 commented on Sep 2, 2026

    @andrejg2008

    I’m seeing the same issue with GPT-5.6 Terra High.

    In an existing Codex development session, Terra repeatedly stops the agent turn even though the task is clearly not finished and no user input is required.

    A typical sequence today was:

    • Terra says it is continuing the implementation.
    • It works for only ~36 seconds and stops.
    • I explicitly tell it to continue working without unnecessary pauses.
    • Terra acknowledges this and says it will continue.
    • It works for another ~23 seconds and stops again.
    • After another request to continue, it responds that it is continuing the implementation, but again returns control to the user instead of continuing the task.

    There is no error, no reported blocker, and no request for additional information. The model simply terminates the agent turn prematurely.

    I then manually switched the SAME conversation, SAME project and SAME unfinished task from GPT-5.6 Terra to GPT-5.5.

    GPT-5.5 continued working normally and did not exhibit the repeated premature stopping behavior.

    So in my case:

    GPT-5.6 Terra High:
    36 sec → premature stop → continue → 23 sec → premature stop → continue → premature stop again

    GPT-5.5:
    same conversation + same project + same task → continues working normally

    This behavior started around September 1.

    This makes long autonomous development tasks very difficult with Terra, because the user has to repeatedly send “continue” even when the model already knows exactly what remains to be done.

    It looks like the agent/model is incorrectly treating an intermediate point in the task as the end of the turn.

    Environment:

    • ChatGPT Plus
    • Codex in VS Code
    • GPT-5.6 Terra High
    • Windows
    • Existing long-running development conversation

    I can provide screenshots showing the repeated premature termination if useful.

  4. Black-Studio-ia commented on Oct 15, 2026

    @Black-Studio-ia

    This matches what I've seen, and I agree with the core diagnosis: as long as "done" is the model's own unexamined judgment, no prompt wording fully fixes it. The durable fix on the user side is to move the stop condition out of the model — a checklist that lives outside the conversation plus a mechanical gate before anything is accepted.

    Concretely, the minimum bar you list (acceptance criteria implemented, checklist complete, required build passed, per-criterion verification) can be enforced without any new model call: write the criteria down as machine-checkable facts and run them after the agent stops. I built a tiny zero-dependency tool for exactly that step (done-guard, MIT, works with any agent): an acceptance.json declaring required files, required changes vs git HEAD, and required commands with expected exit codes and required/forbidden output — e.g. the production build plus a forbid_output rule against FAILED. Exit 0 only when every check is evidenced; a typo'd or empty criteria file is a usage error, never a silent pass.

    Two honest limits: it verifies observable evidence, not semantic correctness — a green gate means "evidenced", not "correct" — and criteria quality is on you (a weak command like echo ok proves nothing). But in practice it catches the two cheapest failure modes from this thread for free: the zero-action turn (nothing changed vs HEAD) and the unrun required gate. Happy to help shape an acceptance.json for the QuantPilot-style story above if useful.

  5. tamnhi3009 commented on Oct 19, 2026

    @tamnhi3009
    Author

    I'm seeing the same premature termination behavior again, now with GPT-6 Luna.

    The agent stopped midway through an implementation task despite having unfinished work and no reported blocker. It explicitly acknowledged that the task was incomplete.

    When asked why it stopped, the agent responded:

    I stopped because I treated the scope as too large and returned an incomplete result. That was the wrong call: the story workflow explicitly says to continue until completion or a defined halt.

    This is particularly concerning because the agent was aware of both the remaining work and the explicit workflow instructions, yet still chose to terminate execution prematurely.

    This is not a completion verification problem. The agent already knew the task was incomplete. The problem is that it stopped anyway.

    Given that this behavior persists across model generations, I believe it warrants investigation into the agent's termination behavior rather than treating it solely as a prompting or workflow configuration issue.

  6. aldi949 commented on Oct 19, 2026

    @aldi949

    Hey @tamnhi3009, I saw your update that the premature stopping behavior is still happening with GPT-6 Luna.

    I've been working on an external completion gate for Codex, mainly to catch cases where the agent claims DONE despite missing acceptance criteria.

    It won't fix the underlying premature-turn bug, and the current live pilot only supports native Windows. But I'm curious whether you also see cases where it explicitly claims the coding task is finished while required work is missing.

    If you have a small reproducible Python example, I'd be interested in testing that specific failure.

    https://github.com/aldi949/truth-firewall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingmodel-behaviorIssues related to behaviors exhibited by the model

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions