Skip to content

A new shell is taken for OmO while its startup files run (flaky omo.contract.test.ts) #239

Closed

Description

@devswha

What fails

server/omo.contract.test.ts, different tests on different runs:

  • "uses live process evidence and stops cwd inference as soon as a second omo shares it": expect(await read(first)).toBe(fresh) got null, or expect(await read(first)).toBeNull() got the fresh session path.
  • "binds each omo pane in a shared cwd to the session its process holds".

How often

2 of 20 runs of the file alone on a Linux workstation that has omo installed (herdr 0.9.3, Bun 1.4.2). It needs a shell whose startup files run a command with a PATH argument that contains omo-ai's directory, so CI does not show it.

Cause

isOmoProcess in server/omo.ts matches any argv word that contains /omo-ai/. A zsh startup file here runs printf %s\n "$PATH", and that PATH has .../node_modules/omo-ai/node_modules/.bin in it, so for a few milliseconds a brand-new shell has a foreground process that counts as omo. Polling pane.process_info on 12 fresh shells with nothing typed into them: 9 of 12 matched isOmoProcess during startup, each time on that printf.

The test helper pane() types the stand-in omo command and returns as soon as any foreground process passes isOmoProcess. When it catches the printf, it returns before the stand-in runs, and the next omoTranscriptForPane call sees a pane with no omo process: the target pane is missing (null), or the second pane is not counted and cwd inference still answers for the first.

The same false match reaches the product: labelOmoPanes can mark a new shell as OmO for a moment, and startShellAgent (New session) can report omo started while the shell is still running its startup files.

Reproduction

On a machine whose shell startup prints or passes a PATH containing an omo-ai directory:

for i in $(seq 1 20); do HERDR_TEST_MODE=integration bun test --timeout 15000 ./server/omo.contract.test.ts || echo FAIL; done

Deterministic: isOmoProcess(["printf", "%s\\n", "/usr/bin:/home/u/lib/node_modules/omo-ai/node_modules/.bin"]) returns true on main.

Activity

  1. added a commit that references this issue on Oct 1, 2026
    f46ff44
  2. added a commit that references this issue on Oct 1, 2026
    d672035
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions