t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Codex command stays Running after a sandbox-denied shell exits

Open mochafreddo opened this issue 1 week ago • 1 comments

Before submitting

  • [x] I searched existing T3 Code issues and PRs and did not find a duplicate.
  • [x] I included enough detail to investigate the problem.

Area

apps/server, Codex command lifecycle

Steps to reproduce

Observed once in a local Codex thread using workspace-write sandboxing and auto-review:

  1. Run a foreground shell command through code mode (functions.exec → exec_command). In the observed case, a compound command used a temporary Git index in a linked worktree. Its git add -A attempted a write to the protected Git object store and failed with Operation not permitted.
  2. Let the assistant receive the failure result and continue. In the observed run, it retried the snapshot with reviewed permissions, the retry completed, and the assistant finished its turn.
  3. Inspect the original command in T3 Code after the reply. It still appears to be running.

This is the observed sequence. I have not independently confirmed a deterministic desktop reproducer. For a smaller starting point, OpenAI's app-server report openai/codex#53488 documents a code-mode command that the sandbox blocks immediately.

Expected behavior

After the command exits, T3 Code stops showing it as running. If Codex does not send its final command event and T3 has no verified result for the row, the UI should communicate that its status is unknown rather than imply that the shell process is still alive.

Actual behavior

The original shell had exited and no matching OS process was present when checked. The UI nevertheless described the command as running. The T3 server's persisted command_execution row was still running, with no completion timestamp or exit code, even though the owning run had completed and the thread accepted follow-up turns. The successful retry had a separate, correctly completed row.

Impact

Minor bug or occasional failure. A finished command appears active and is indistinguishable from active background work. The thread continued accepting messages.

Version or commit

T3 Code Beta 0.1.11. Codex CLI 0.172.0 (from the session record).

Environment

macOS 27.2.1 arm64, local T3 Code desktop, Codex app-server, GPT-6.2 Sol, workspace-write sandbox with auto-review.

Logs or stack traces

Sanitized observations on 2026-11-24 (UTC). The original and retry are different command item IDs.

Time Source Observation
13:37:21.269 T3 Codex protocol log Original item/started, command status inProgress
13:37:26.670 T3 Codex protocol log Original item/autoApprovalReview/completed, status approved
13:37:26.733 Codex session result Shell exit code 1, Operation not permitted, and printed rc=128 snapshot= from the failing Git step
13:37:43.907 T3 Codex protocol log Retry item/completed, status completed, exit code 0
13:38:30.706 T3 run state Owning run completed

In the captured protocol log, the original command ID has no item/completed. Read-only inspection of the T3 projection later showed original running / no exit code and retry completed / exit 0. The Codex tool result reaching the assistant and the command lifecycle event reaching T3 are distinct. This trace identifies the missing event at the observed boundary and the stale server row. It does not establish where inside Codex the event was lost.

Related reports: openai/codex#53488 describes missing completion notifications after immediate sandbox denials in code mode. T3 Code #25000 and PR #3908 cover late completions; this command's completion was absent in the captured stream. T3 Code PR #40848 covers tools still blocked on approval when their run ends; this command had already received an approval result and returned a shell failure.

Workaround

A reviewed retry succeeded for the underlying Git task. It did not clear the stale entry for the original command. No workaround for the stale row was verified.

mochafreddo avatar Nov 24 '26 13:11 mochafreddo

Desktop screenshot taken after the original shell exited. The command row still shows Running after 13 minutes.

t3code-42175-stale-command

mochafreddo avatar Nov 24 '26 14:11 mochafreddo