Skip to content

fix: stop hiding codex sessions whose -c args mention grep or exec - #181

Open
demrom wants to merge 1 commit into
graykode:mainfrom
demrom:fix/codex-grep-substring
Open

demrom wants to merge 1 commit into
graykode:mainfrom
demrom:fix/codex-grep-substring

Conversation

@demrom

@demrom demrom commented Oct 16, 2026

Copy link
Copy Markdown

abtop can miss Codex sessions started with long -c values (for example -c developer_instructions=...), even while the process is running and has its rollout open. Two substring checks run over the whole command line:

  • !cmd.contains("grep") drops the process if any argument mentions grep.
  • cmd.contains(" exec") treats an interactive TUI as a one-shot codex exec if any argument contains " exec", as in "run executables". After the first task_complete the session counts as Done and disappears from the list.

Changes:

  • process::cmd_is_grep excludes a process only when its executable is a grep (grep, pgrep, ...). Codex CLI and Desktop discovery, codex mcp-server detection and opencode discovery all had the same substring check and now use it.
  • Exec vs interactive comes from the rollout's session_meta.originator (codex_exec or codex-tui). The argv guess is kept as a fallback for rollouts without an originator, and now matches exec only as a whole token.

Testing:

  • cargo clippy -- -D warnings and cargo test pass (225 tests).
  • Added find_codex_pids_ignores_grep_and_exec_inside_args, test_codex_tui_originator_overrides_exec_guess_from_argv and cmd_is_grep_checks_only_the_executable. The first two fail on main.
  • On macOS, with Codex TUIs running with long -c instructions: abtop 0.5.5 does not list them, this branch lists all of them.

Codex discovery skipped any process whose command line contained "grep", and marked it as a one-shot exec when it contained " exec". Long -c values such as developer instructions are part of that command line, so an interactive TUI could be dropped entirely, or shown as exec and then hidden as Done after its first task_complete.

- grep: exclude only when the executable itself is a grep (new process::cmd_is_grep), in codex, codex mcp-server, and opencode discovery.
- exec: take it from the rollout's session_meta originator (codex_exec vs codex-tui); argv is only a fallback for rollouts without one, and matches the whole token.
@demrom
demrom marked this pull request as ready for review October 16, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant