Skip to content

[Bug]: Automation run completes when a nested codex exec exits #17650

Closed

Description

@Shushpancheak

Summary

A scheduled Codex automation that launches a nested codex exec is marked completed when the nested process finishes. Orca captures the child process's output as the automation output, and the parent workflow never resumes.

Environment

  • Orca 1.4.190
  • macOS
  • Scheduled automation provider: Codex
  • Run ID: d5c43e06-0fce-4b64-b843-da84c779ed0d
  • Automation ID: 68bb5c96-e7eb-4c41-82b2-879b000a9981
  • Started: 2026-08-31 10:00:51 Europe/Moscow

Reproduction

Run a scheduled Codex automation whose parent process launches a nested Codex process:

subprocess.run(
    [
        "codex",
        "exec",
        "-s",
        "read-only",
        "--skip-git-repo-check",
        "-o",
        output_file,
        prompt,
    ],
    stdin=subprocess.DEVNULL,
    capture_output=True,
    text=True,
    timeout=900,
)

After this call, the parent process is expected to perform additional work and produce its own final response.

Actual behavior

  1. The parent workflow launched the nested codex exec.
  2. The nested command successfully produced its output file.
  3. When the nested command finished, Orca marked the entire automation run as completed with error: null.
  4. outputSnapshot.content contained the nested command's generated output instead of the parent agent's final response.
  5. The parent workflow never regained control, so none of the subsequent work ran.
  6. Run metadata had terminalSessionId, terminalPaneKey, and terminalPtyId all set to null.
  7. The parent process's log ended immediately after the nested process returned, without an error or completion message.

Expected behavior

A child codex exec launched by an automation agent should not be treated as the automation's provider session. Orca should keep the automation active until the root agent process or turn finishes, and outputSnapshot should contain the root agent's final response.

Impact

The run appears successful in Orca even though the workflow was only partially executed. For side-effecting automations, subsequent work can be silently skipped without any failure being surfaced.

Activity

  1. added theissue type on Sep 19, 2026
  2. nwparker commented on Oct 24, 2026

    @nwparker
    Contributor

    Thanks for the report! Please retest on 1.4.239+ (#31780, v1.4.239, stopped a nested agent taking over its parent's status). If a nested codex exec still ends the run, share: Orca version, macOS version, Codex CLI version, and a description (not the prompt) of how the nested exec is launched. Please redact anything private before sharing; screenshots or log excerpts are fine.

  3. kevsjh commented on Oct 25, 2026

    @kevsjh

    Retested on 1.4.240: it still happens with Antigravity subagents. #31780 fixed the nested claude -p case, but Antigravity's subagents run inside the parent agy process, so a subagent finishing still ends the whole automation run.

    Environment

    • Orca 1.4.240 (macOS 26.6.2, Apple Silicon)
    • Antigravity CLI (agy) 1.4.7; Orca's Antigravity runtime 1.3.0
    • Automation: provider antigravity, existing workspace, fresh session per run, started with orca automations run

    How the nested agent is launched
    The automation prompt asks the main agent to translate a file into three languages in parallel with Antigravity's built-in invoke_subagent tool (Model: "flash", Workspace: "inherit"), wait for all of them, then validate, clean up and write a final report. No nested CLI process: the subagents run inside the parent agy session. Orca launches the parent as agy --dangerously-skip-permissions --prompt-interactive <prompt>.

    What happens (3 of the 4 runs that reached the subagent step)

    1. The main agent spawns the subagents and waits for them.
    2. When a subagent reports back (the first one, or the last one), Orca closes the run's terminal tab within about a second.
    3. That sends SIGTERM to agy, so the parent never resumes: no validation, no cleanup, no final report. In one run the third subagent was still working and its file was never written.
    4. The run is recorded as completed with error: null. outputSnapshot.content is the subagent's message, not the parent's final report, and terminalSessionId, terminalPaneKey and terminalPtyId are all null.

    Log excerpts (redacted)

    Orca main.trace.ndjson, the second the run ends:

    01:37:55.602 persistence.terminal-topology {"topology.kind":"close_tab","topology.outcome":"committed"}
    

    ~/.gemini/antigravity-cli/log/cli-<run>.log, same run:

    I… 00:41:59.561584 server.go:3177] Got signal terminated, shutting down
    I… 00:41:59.564401 common.go:528] CLI program exited, shutting down
    I… 00:41:59.600691 conversation_manager.go:1218] Stream completed for <conversation>, clearing ResponsePending
    

    (two different runs; each shows the same pattern: close_tab, then SIGTERM, then the run marked completed)

    Run record (fields only):

    status: completed, error: null, sessionKind: terminal,
    terminalSessionId: null, terminalPaneKey: null, terminalPtyId: null,
    outputSnapshot.content: <the subagent's report, not the parent's>
    

    Nobody closed the tab by hand: it happened at the same point in three separate runs. One earlier run (two subagents) finished normally and kept its tab, so it isn't every time, but it is most of the time.

    Expected
    A subagent finishing inside an Antigravity session shouldn't count as the run's end. The run should stay open until the parent agent's own turn ends, and outputSnapshot should hold the parent's final response.

    Impact
    For side-effecting automations the work stops halfway while the run shows success. Our workaround is to avoid Antigravity subagents in automation prompts.

  4. added a commit that references this issue on Oct 25, 2026
    9639426
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions