-
Notifications
You must be signed in to change notification settings - Fork 118
Codex active run tracking can remain stuck after SubagentStop or turn_aborted #170
Description
Summary
After updating to Workmux 0.1.211, Codex status tracking can leave stale active run IDs in the Workmux Codex runtime state. When this happens, the sidebar/pane remains stuck on working even though the visible Codex work has already completed or been interrupted.
This looks like a remaining edge case in the active-run tracking added for nested Codex agents, related to #154.
Environment
- Workmux:
0.1.211 - Codex CLI:
0.133.0 - Multiplexer: tmux
- Workmux Codex hooks installed from the bundled template
Observed behavior
A Workmux sidebar entry stayed in working indefinitely.
Inspecting the Workmux runtime state showed a non-empty active set under the Codex status runtime directory for that tmux pane. The corresponding Codex transcript metadata showed those turn IDs were no longer active:
- some had ended with
turn_aborted/ interrupted - some were thread-spawned subagent turns that ended with
task_complete
There were no visible active Codex turns corresponding to those stale active IDs, but Workmux continued to derive working from the non-empty active set.
Why this may leak active IDs
From Workmux 0.1.211 source:
src/state/codex_status.rstracks active Codex runs bysession_id:turn_id.- It accepts these events for run-id detection:
UserPromptSubmit,PreToolUse,PermissionRequest,PostToolUse, andStop. - The bundled Codex hook template registers
UserPromptSubmit,PostToolUse, andStop.
From Codex 0.133.0 source/behavior:
- thread-spawned child agents complete with
SubagentStop, not normalStop SubagentStoppayloads includeagent_id/agent_type- interrupted turns can end as
turn_abortedwithout running the normal stop hook path
This means Workmux can add a run ID on UserPromptSubmit/PostToolUse, but miss the corresponding cleanup when the turn ends through SubagentStop or turn_aborted. Also, adding a SubagentStop hook alone may not be sufficient in the current implementation because codex_status.rs rejects payloads containing agent_id or agent_type.
Expected behavior
Any run ID added to the pane active set should eventually be removed when that Codex turn completes, the subagent completes, or the turn is interrupted/aborted. The pane/sidebar should not remain working when all tracked Codex turns are done.
Possible fix direction
A few possible approaches:
- handle
SubagentStopas a cleanup event forsession_id:turn_id - include a bundled
SubagentStopWorkmux hook if needed - allow
SubagentStoppayloads withagent_id/agent_typefor cleanup - add cleanup/reconciliation for
turn_abortedor stale active IDs
I can provide more anonymized runtime-state details if helpful.