Repository navigation
Description
Title
[Bug]: Codex 0.157 shared managed app-server keeps Orca agent attribution bound to the first session
Operating system
Windows 11 + WSL2 (Ubuntu 22.04)
Orca version
1.4.215
Details
Codex sessions launched from an Orca-managed WSL workspace are not consistently registered in the Orca sidebar / agent-status store when Codex 0.157.1 uses the shared managed app-server daemon.
The first Codex session after a clean daemon start is registered correctly. A second fresh Codex session, opened without restarting the daemon, gets its own ORCA_PANE_KEY, ORCA_TAB_ID, and ORCA_AGENT_LAUNCH_TOKEN, but the shared managed daemon continues to hold the metadata from the first session.
As a result, Orca keeps tracking only the first Codex session. The second session exists and works normally in the terminal, but no new agentType: "codex" entry is created for it.
Environment
- Orca:
1.4.215 - OS: Windows 11
- WSL: Ubuntu 22.04
- Codex CLI:
0.157.1 - Agent runtime: WSL / Ubuntu-22.04
- Workspace:
\\wsl.localhost\Ubuntu-22.04\home\tsungyeh\CROWN - Codex home:
/home/tsungyeh/.codex
Reproduction
- Close all Orca Codex sessions.
- Stop the Codex managed app-server daemon and its helper processes.
- Confirm that only unrelated Codex processes, such as the VS Code extension app-server, remain.
- Open a fresh Codex session in Orca. Call this Session A.
- Send a prompt such as:
say hello
- After the turn completes, run:
& "$env:LOCALAPPDATA\Programs\orca\resources\bin\orca.exe" worktree ps --json- Session A is registered correctly.
agents[]contains an entry similar to:
{
"state": "done",
"agentType": "codex",
"prompt": "say hello",
"lastAssistantMessage": "Hello!"
}- Do not restart or kill the Codex managed daemon.
- Open another completely fresh Codex session in the same workspace. Call this Session B.
- Send another prompt.
- Run
worktree ps --jsonagain.
Actual behavior
After Session B is opened:
liveTerminalCountincreases, confirming that the new terminal/session exists.- Session B runs normally.
- Session B has its own Orca pane/tab/launch metadata.
- However,
agents[]still contains only Session A's Codex entry. - No second
agentType: "codex"entry is created for Session B.
For example, after Session A:
{
"liveTerminalCount": 2,
"agents": [
{
"paneKey": "1a0a2d7f-b818-4750-9e01-1bb71f226cdc:cb691c6a-a9aa-4f4d-9b95-f30ebcdc55eb",
"state": "done",
"agentType": "codex",
"prompt": "say hello"
}
]
}After opening Session B:
{
"liveTerminalCount": 3,
"agents": [
{
"paneKey": "1a0a2d7f-b818-4750-9e01-1bb71f226cdc:cb691c6a-a9aa-4f4d-9b95-f30ebcdc55eb",
"state": "done",
"agentType": "codex",
"prompt": "say hello"
}
]
}The second Codex session does not appear in agents[].
Process / environment evidence
Session A has its own Orca metadata:
ORCA_PANE_KEY=1a0a2d7f-b818-4750-9e01-1bb71f226cdc:cb691c6a-a9aa-4f4d-9b95-f30ebcdc55eb
ORCA_TAB_ID=1a0a2d7f-b818-4750-9e01-1bb71f226cdc
ORCA_AGENT_LAUNCH_TOKEN=45e3327a-4c1c-4c42-b592-29958140cec3
Session B has different metadata:
ORCA_PANE_KEY=34242fbd-9fa6-48fc-8a40-deadd06c4d62:73acf142-cfb8-48b2-a057-00e1a3f0683d
ORCA_TAB_ID=34242fbd-9fa6-48fc-8a40-deadd06c4d62
ORCA_AGENT_LAUNCH_TOKEN=362ea32e-9db3-4294-867b-b5869c0917b6
However, the shared Codex daemon:
codex app-server --listen unix:// --managed-daemon
still contains Session A's Orca metadata:
ORCA_PANE_KEY=1a0a2d7f-b818-4750-9e01-1bb71f226cdc:cb691c6a-a9aa-4f4d-9b95-f30ebcdc55eb
ORCA_TAB_ID=1a0a2d7f-b818-4750-9e01-1bb71f226cdc
ORCA_AGENT_LAUNCH_TOKEN=45e3327a-4c1c-4c42-b592-29958140cec3
This suggests that the shared managed app-server inherits the Orca attribution metadata from the first session and keeps it for subsequent Codex sessions.
Hook debugging
The Orca Codex hook installation is present and working.
~/.codex/hooks.json is installed, and the Orca hook script is executed.
For a fresh session, the following events are emitted:
SessionStart
UserPromptSubmit
Stop
The Codex process also receives the expected Orca variables:
ORCA_PANE_KEY
ORCA_TAB_ID
ORCA_WORKTREE_ID
ORCA_AGENT_LAUNCH_TOKEN
ORCA_AGENT_HOOK_ENDPOINT
ORCA_AGENT_HOOK_PORT
The Orca hook endpoint is reachable from WSL.
A manually constructed POST to:
/hook/codex
using the Orca token and metadata returns:
HTTP 204
The first session is therefore able to register correctly.
Additional observation
Resuming an existing Codex conversation can show the same symptom, but the issue is not limited to resume.
A second completely fresh Codex session also fails to receive its own agent entry while the shared managed daemon from Session A is still running.
Restarting the managed daemon restores correct behavior for the first newly opened session, after which the problem can recur for subsequent sessions.
Expected behavior
Each Codex session should be attributed to its own Orca pane/tab.
If multiple Codex sessions share one managed app-server daemon, the daemon or hook handling should not cause Orca attribution to remain bound to the first session's:
ORCA_PANE_KEY
ORCA_TAB_ID
ORCA_AGENT_LAUNCH_TOKEN
Opening Session B should create a second Codex entry in agents[] with Session B's own paneKey.
Actual behavior
The shared Codex managed app-server remains associated with the first Orca session's environment.
Subsequent fresh Codex sessions have their own Orca environment variables at the TUI process level, but they are not separately registered in the Orca agent-status store.
This causes only the first Codex session after a clean daemon start to appear correctly in the sidebar / agents[].
Suspected cause
Codex 0.157.1 uses a shared process:
codex app-server --listen unix:// --managed-daemon
The daemon appears to inherit and retain the Orca environment from the first Codex session that started it.
Subsequent Codex sessions reuse the same daemon, but the daemon's Orca attribution metadata is not updated or scoped per session.
Possible fix
Orca could avoid relying on process-global Orca attribution inherited by the shared Codex managed daemon.
Possible approaches include:
- Associate Codex lifecycle events with the pane/session metadata from the current TUI/session instead of the daemon's inherited environment.
- Pass pane/tab/launch attribution explicitly per Codex session or hook event.
- Detect a lifecycle event for a new
ORCA_PANE_KEYand create/rebind the Codex agent entry accordingly. - Avoid treating the shared daemon's environment as authoritative for agent attribution when multiple Codex sessions are attached to the same daemon.
Activity
[-][Bug]: Resumed Codex sessions are not restored in the sidebar because SessionStart is not emitted on resume[/-][+][Bug]: Only the first Codex session is registered in the sidebar when Codex 0.157 shared app-server daemon is enabled[/+]AmethystLiang commentedon Sep 28, 2026
looking into it
nwparker commentedon Oct 26, 2026
Thanks @EngineerEricXie for the clear repro. This has the same cause as #23643: the shared Codex app-server daemon keeps the first session's pane key, so later sessions never get their own entry. Closing as a duplicate so the work stays in one place; please follow #23643.