Skip to content

lazycodex doctor recurses through delegated omo invocation #40

@dspaudio

Description

@dspaudio

Summary

Running lazycodex doctor can appear to hang indefinitely because the LazyCodex passthrough path recursively invokes omo doctor while preserving OMO_INVOCATION_NAME=lazycodex.

The command does not reach the actual doctor surface; it repeatedly re-enters the LazyCodex installer/delegation path and spawns more Node/npm processes.

Environment

  • LazyCodex version: lazycodex-ai 4.7.5
  • Codex version: not required to reproduce; the failure happens before Codex CLI is involved
  • OS: macOS 26.5.1, arm64
  • Node/npm: Node v26.3.0, npm 11.16.0
  • Install method: global/local bin links under /Users/wknam/.bun/bin
  • Relevant config: /Users/wknam/.bun/bin/lazycodex and /Users/wknam/.bun/bin/omo both resolve to oh-my-openagent/bin/oh-my-opencode.js

Repository Decision

  • Target repository: code-yeongyu/lazycodex
  • Why this belongs there: the failure is in the LazyCodex/lazycodex-ai alias and delegated command packaging path, not in upstream Codex CLI behavior.
  • LazyCodex evidence: bin/oh-my-opencode.js propagates the invocation name through OMO_INVOCATION_NAME; the packaged binary routes LazyCodex invocations to packages/omo-codex/scripts/install-local.mjs; install/cli-args.mjs treats doctor as a passthrough command; install/delegated-command.mjs delegates to npx --yes --package oh-my-openagent omo doctor.
  • Upstream Codex source evidence from /tmp/openai-codex-source: searching the cloned upstream source for lazycodex, OMO_INVOCATION_NAME, and this alias delegation path found no owning implementation. The affected files are LazyCodex package files under oh-my-openagent / packages/omo-codex.

Reproduction

  1. Install/use LazyCodex with lazycodex and omo bin aliases available on PATH.
  2. Run:
    lazycodex doctor
  3. Observe that the command produces no doctor output and keeps spawning nested node ... install-local.mjs doctor and npm exec omo doctor processes.

Expected Behavior

lazycodex doctor should delegate once to the real omo doctor surface and exit with the doctor report.

Actual Behavior

The command appears to hang. Runtime process inspection showed a repeating chain like:

node /Users/wknam/.bun/bin/lazycodex doctor
node .../oh-my-openagent-darwin-arm64/bin/oh-my-opencode.js doctor
node .../packages/omo-codex/scripts/install-local.mjs doctor
npm exec omo doctor
node /Users/wknam/.bun/bin/omo doctor
node .../oh-my-openagent-darwin-arm64/bin/oh-my-opencode.js doctor
node .../packages/omo-codex/scripts/install-local.mjs doctor
...

Evidence

  • lazycodex --version prints lazycodex-ai 4.7.5.
  • command -v lazycodex resolves to /Users/wknam/.bun/bin/lazycodex.
  • command -v omo resolves to /Users/wknam/.bun/bin/omo.
  • bin/oh-my-opencode.js:
    • getInvocationName() returns process.env.OMO_INVOCATION_NAME when present.
    • child env is built with OMO_INVOCATION_NAME: invocationName.
  • oh-my-openagent-darwin-arm64/bin/oh-my-opencode.js:
    • if OMO_INVOCATION_NAME is lazycodex or lazycodex-ai, it launches packages/omo-codex/scripts/install-local.mjs.
  • packages/omo-codex/scripts/install/cli-args.mjs:
    • doctor is included in PASSTHROUGH_COMMANDS.
  • packages/omo-codex/scripts/install/delegated-command.mjs:
    • passthrough commands are delegated as npx --yes --package oh-my-openagent omo <command>.
  • Control check:
    OMO_INVOCATION_NAME=omo npx --yes --package oh-my-openagent omo doctor
    exits normally and prints the doctor report.

Root Cause

The LazyCodex wrapper intentionally sets OMO_INVOCATION_NAME=lazycodex so the packaged binary can route LazyCodex invocations into the Codex installer path. That environment variable is inherited by the delegated npx ... omo doctor process.

When the delegated omo wrapper starts, it sees OMO_INVOCATION_NAME=lazycodex, treats itself as another LazyCodex invocation, and re-enters install-local.mjs doctor. That repeats indefinitely.

Proposed Fix

Reset or remove OMO_INVOCATION_NAME when running delegated omo passthrough commands from the LazyCodex installer path.

One minimal fix path:

  • Update packages/omo-codex/scripts/install/process.mjs so defaultRunCommand() accepts an optional env.
  • Update packages/omo-codex/scripts/install/delegated-command.mjs so runDelegatedOmoCommand() calls the delegated command with OMO_INVOCATION_NAME=omo.
  • Add a regression test around runDelegatedOmoCommand() asserting delegated passthrough commands do not preserve OMO_INVOCATION_NAME=lazycodex.

A local hotfix with that shape made lazycodex doctor exit normally on the affected machine.

Verification Plan

  • Run lazycodex doctor from a shell where lazycodex is the invocation path and verify it exits with a doctor report.
  • Run the delegated control command with OMO_INVOCATION_NAME=omo and verify the report is unchanged.
  • Add/update Node tests for the LazyCodex passthrough command path so doctor, cleanup, and other passthrough commands cannot recurse through a stale LazyCodex invocation name.

This issue or PR was generated by LazyCodex.
Tag: lazycodex-generated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions