Conversation
Codex emits no hook at TUI startup: SessionStart only fires lazily, milliseconds before the first UserPromptSubmit (measured 19ms apart on codex current; an idle TUI posts nothing). Claude has no such gap because its SessionStart fires at TUI open (STA-3386). Orca's codex status surface is hook-driven, so a runtime-built spawn (orca worktree create --agent codex, automations) has no card row until the first turn — upstream stablyai#6643. UI-built spawns already seed via the renderer's initialAgentStatus path. Seed the row in main at startup-terminal spawn: - with an injected prompt: a working row carrying that prompt - plain spawn: an idle session-boundary done row (mirrors Claude's SessionStart row; no phantom spinner, no completion notifications) The seed never overwrites an existing status (a real PermissionRequest waiting always wins), no-ops on retired panes, is idempotent under duplicate delivery, and any later hook/OSC status replaces it. Local repos only: remote status arrives relay-stamped with a connectionId a local seed row would contradict. Refs upstream stablyai#6643; complements stablyai#8292, which keeps SessionStart metadata-only and explicitly excludes startup delivery. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe change adds Mergeability Score: 🔵 Low · up to The change makes Codex status appear at spawn, with bounded merge-readiness risk from a test spy that is not restored and incomplete coverage of promptless and folder-workspace launches; merge is reasonable with explicit follow-up on test isolation and those paths. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.test.ts (1)
42921-42999: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd runtime coverage for the remaining launch paths.
This test covers only a prompt-bearing local Git worktree launch. Add tests for a promptless Codex launch and the folder-workspace terminal creation path. Verify that each path calls
seedCodexLaunchStatuswith the created pane and worktree metadata.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 024761cb-2bb1-4ea9-bd4a-8bd980536ec7
📒 Files selected for processing (4)
src/main/agent-hooks/server.test.tssrc/main/agent-hooks/server.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
CodeRabbit review: a seedCodexLaunchStatus failure inside the startup-terminal try/catch overwrote the already-successful spawn result with a misleading "Failed to create the startup terminal" warning. Extract both duplicated call sites into seedCodexLaunchStatusIfEligible with its own log-and-continue catch, and add a runtime test proving a seeding throw preserves the startupTerminal success state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Closing in favor of #14611, which supersedes this and covers the two gaps it names: the renderer path being gated to command-code so UI-launched Codex panes stayed uncovered, and the skipped seed when the caller supplies startup. Thanks for carrying over the diagnosis and the sessionBoundary idle-row choice. |
Summary
Fixes the #6643 symptom for runtime-built spawns: a Codex agent launched by Orca now appears in the agent status surface at spawn, using launch metadata, instead of staying absent until the first user message.
Root cause (measured)
Codex emits no hook at TUI startup. Captured with a captive HTTP listener replacing the managed hook endpoint (codex current, macOS):
SessionStartat 05:40:22.597Z,UserPromptSubmitat 05:40:22.616Z — 19 ms apart, ~50 s after the TUI opened.session_idis stamped on every event of the turn.Claude has no such gap because its
SessionStartfires at TUI open. Orca's Codex status surface is hook-driven, and the renderer'spaneStartup.initialAgentStatusseeding only covers UI-created panes. Runtime-built spawns (CLIworktree create --agent codex, automations) mount no renderer pane, so nothing seeds:--prompt: no status row from create (05:36:16Z) until the first turn's hooks (05:36:24Z), while the TUI was already Working at 05:36:19ZFix
AgentHookServer.seedCodexLaunchStatus+ a call increateManagedWorktreeafter the startup terminal spawns (git and folder-workspace branches):workingrow carrying the promptdone+sessionBoundaryrow (mirrors Claude's SessionStart row: no phantom spinner, completion-reactive consumers skip it)PermissionRequestwaiting is never overwritten), retired panes are not resurrected, duplicate seeds are idempotent, and any later hook/OSC status replaces the seedconnectionIdthat a local seed row would contradict (the SSH app-server-reuse gap is [Bug]: SSH Codex sessions emit no Orca hooks when the TUI reuses an existing app-server #11941, out of scope here)Relationship to #8292
Builds on, does not duplicate: #8292 makes
SessionStartmetadata-only (identity cache + stale-row clear) and explicitly excludes startup delivery. This PR touches none of #8292's normalizer/relay/hook-service lines, and the seed behaves correctly under #8292's semantics — the first turn'sSessionStartclears the seed row andUserPromptSubmitrecreates it 19 ms later. Since Codex firesSessionStartonly alongside the first prompt, spawn-window presence has to come from launch metadata, which #6643's notes also suggest.Testing
src/main/agent-hooks/server.test.ts: 8 new state-machine tests (seed shapes, idempotence, PermissionRequest-at-spawn precedence, waiting→working recovery on first turn, first-turn replacement with providerSession caching, duplicate identical UserPromptSubmit/Stop delivery, retired-pane no-op) — 276 file tests greensrc/main/runtime/orca-runtime.test.ts: CLI-created local worktree seeds with the injected prompt — 1082 file tests greenoxlint,oxfmt --checkRefs #6643
🤖 Generated with Claude Code