Repository navigation
Resolve CLI callers under Codex's shared daemon - #839
Merged
Merged
Conversation
Codex 0.157+ runs the commands of a hand-typed `codex` in a shared app-server daemon. The daemon keeps the environment of the process that last started it, and keeps that process as its parent. So a command from any pane walked up to the starter pane's shell and was attributed to the wrong pane, or failed with SOURCE_REQUIRED after the starter exited. `PROWL_PANE_ID` inside Codex names the same wrong pane. - Stop the caller ancestry walk at a Codex managed daemon. - Read the caller's CODEX_THREAD_ID from its KERN_PROCARGS2 environment at accept time. - Every pane records a Codex TUI session log. Map the thread to the pane whose newest indexed submit (client_user_message_id) is in that thread's root rollout. The mapping runs off the main actor. - Use one caller resolution for signal, dispatch-complete, native hook, workflow, and list. A mapped caller binds a signal when the session log belongs to the pane's current Codex process. - `prowl list --json` reports the resolved `caller`. The prowl-cli skill and the CLI manual use it inside Codex. - Record the design in docs-ai 073.
This was referenced Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Codex 0.157+ attaches a hand-typed
codexTUI to a sharedcodex app-server --managed-daemon. The daemon runs every thread's shell commands:daemon restartcaller, or the auto-update process, which can live for days. Upstream documents this ("per-client environment isolation is not provided") and declined to forward client environments (TUI: allow opt-in client environment metadata on app-server turns openai/codex#44774).Effect in Prowl for a hand-typed Codex (Profile launches are not affected, because
-c notify=…forces the embedded server):agents signal,agents dispatch-complete, workflowrun/read/deliver/statusSOURCE_REQUIREDafter it exits$PROWL_PANE_IDused by the prowl-cli skillReproduced on the installed release build: pane B's Codex ran
prowl agents signal turn-ended, and Prowl recorded it on pane A (the starter) with bindingcurrent.Change
CODEX_THREAD_IDfrom itsKERN_PROCARGS2environment (server-side, not client-claimed).CODEX_TUI_RECORD_SESSION=1and a pane-ownedCODEX_TUI_SESSION_LOG_PATH. Each submit there carries aclient_user_message_id, which the daemon writes as the user item'sclient_idin the target rollout.CodexDaemonThreadMapperindexes the daemon's open rollouts incrementally, off the main actor, and maps the caller's thread (through subagent lineage) to the pane whose newest indexed submit is in that thread. No evidence means no pane, never a guess.CallerPaneResolver.pane(for:paneByShellPID:)) now serves signal, dispatch-complete, native hook, workflow, and list. A mapped caller binds a signal ascurrentonly when the session log belongs to the pane's current Codex process.prowl list --jsonreportscaller(server-resolved pane and worktree). The prowl-cli skill anddocs/components/cli.mduse it whenCODEX_THREAD_IDis set and keepPROWL_PANE_IDfor everything else.docs-ai/073-codex-daemon-caller-identity/.Verification
/new, pending steer, subagent lineage, two panes on one thread, missing evidence, incremental file reads), the listcallerfield, pane environment, and log sweeping.make check,make test(3594 passed, 0 failed insupacode-tests),make build-cli,make test-cli-smoke,make test-cli-unit,make test-cli-integration, andmake build-apppass.CODEX_HOMEdaemon started by pane X's Codex (so its parent chain reaches X's shell):!prowl listcallerabsent (not X)$PROWL_PANE_IDprowl listcaller andagents signalcurrentagents dispatchto Y; Codex runsdispatch-completecompleted/succeededon Yworkflow run prowl.handoff --input next=save,read, tokendelivercompleted,currentrole YFollow-up
Daemon-mode Codex log-based working/idle detection will reuse
CodexDaemonThreadMapperin a stacked PR.