Skip to content

fix(prompt): bind a command outcome to the custom OmO holding the session, not its SDK child (#1985) - #2186

Merged
devswha merged 3 commits into
mainfrom
fix/macos-process-starts-omo-holder
Oct 28, 2026
Merged

devswha merged 3 commits into
mainfrom
fix/macos-process-starts-omo-holder

Conversation

@devswha

@devswha devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Fixes #1985

#1985 had two halves. The first was the synchronous macOS ps behind paneProcessRoots, codexTranscriptPath and hermesTranscriptForPane, and #1980 already removed it on main. The second was that command outcomes picked a custom OmO without the session-holder rule. This PR fixes the second.

What changes for the user

  • A command sent to a custom OmO keeps its row in Chat. A custom OmO is one whose launcher does not name omo, so it is known only by the session-holder record it writes. Command outcomes (server/prompt.ts outcomeProcess) found it through agentProcesses alone. A /command sent to it was therefore bound to its bundled Claude SDK child, which matches omo by its omo-ai path and exits at the end of each turn. When the child exited, the row was never adopted into the session herdr then reported for the pane, and stayed out of it. Queued messages already preferred the holder (fix(pending): bind a queued message to the agent process as command outcomes do, and read its birth without blocking #1986).

How

  • bindCommandProcess(paneId, command, seen, pane): for an OmO send it reads heldOmoProcess once, the rule pending sends and typing use, and passes it to agentProcessInFront. The three callers (core/composer.ts twice, core/pending.ts) pass the pane.
  • A process bound as the holder is marked held, together with its start time, on macOS too. On macOS that start is the kernel's kinfo_proc record from fix(server): read macOS process starts and terminals from the kernel, and await name lookups' git #1980, not ps. The bound check (checkBoundProcess) accepts it while herdr lists it, even though agentProcesses does not name it, and reads no holders again on a poll.
  • A holder only counts while its process's start can be read. That is never the case on Windows, which hands a finished process's pid to the next one at once, so nothing changes there. Where the start is known, a later start under the same pid is another process, and the existing start comparison marks the send replaced.
  • Other agents are unchanged: held is only read for omo.

The ps half (already on main)

On eamac (macOS, Bun 1.4.3), in a /tmp clone of main dbbaad5, processStartedAt and processStartedAtAsync for a live child return the same exact start in 2.2 ms with no Bun.spawnSync call, and a missing pid gives null. server/process-start.ts has no spawnSync. codex.ts and hermes.ts still call the synchronous processStartedAt, which on macOS is now that kernel read, not a subprocess.

How it was verified

  • New server/outcome-omo-holder.test.ts drives the real GET /api/pane/prompt (handlePromptRequest) with a custom OmO, its holder record and its SDK child, with no per-process cwd (as on macOS). It has four cases:
    1. After the SDK child exits, the row is kept and adopted into the session herdr reports. This fails on main: the send is bound to the SDK child (41002, not 41001).
    2. A second holder of the same session moves before the bound one. The row is kept, and heldOmoProcess is not called on any poll. This fails on the first commit.
    3. and 4. After the OmO exits, an unrelated Claude Code gets its pid, once with Linux and once with macOS mocked. The row is not carried into Claude's session. The macOS case fails on the second commit.
  • With only the bound-check half reverted, case 1 fails at the adoption step.
  • The outcome, pending, composer, omo and agent-process suites pass (259 tests across 18 files), as does typecheck.
  • bun run check fast passes on the final change before the last rebase (7937 unit tests, 0 fail). The rebase onto main brought in only plugin, Codex model and sidebar changes, and the 18 suites above pass again on it.
  • Reviews:
    • omo-native-code-reviewer approved the first commit with no HIGH or MEDIUM. Its LOWs were the per-poll cost, fixed below, and the fixed fixture pids, the same pattern as core/pending-omo-holder.test.ts.
    • Codex (gpt-6.1-sol, fast, xhigh) reproduced three MEDIUMs over two rounds, each now a test case above:
      • With two holders, a reorder dropped the bound one.
      • heldOmoProcess ran on every poll, 194 to 815 ms of synchronous reads with thousands of holder folders.
      • The recorded holder accepted a reused pid on macOS, where no start was recorded.
    • Codex's last round, on the final delta, approved with no findings.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 8299220 and bd70d95.

Files selected for processing: 5
  • changelog.d/omo-custom-outcome-holder.md
  • server/core/composer.ts
  • server/core/pending.ts
  • server/outcome-omo-holder.test.ts
  • server/prompt.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Merging bd70d95: omo-native-code-reviewer and Codex both pass this head. The four new cases fail on main, where the command is bound to the SDK child (#1985), and pass here. Other agents and Windows binding are unchanged. The required checks are green, and CodeRabbit did not review this head. Codex's two MEDIUMs need two session holders in one pane, or a pid reused in a microsecond window. They go to a follow-up issue with the LOW notes.

@devswha
devswha merged commit 0272085 into main Oct 28, 2026
19 checks passed
@devswha
devswha deleted the fix/macos-process-starts-omo-holder branch October 28, 2026 05:31
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.

Read the remaining process starts without a synchronous ps on macOS, and pick a custom OmO by its holder in command outcomes (#1545 follow-ups)

1 participant