Skip to content

runtime-host project add with a regular file inside a Git repository shuts down the Host #5220

Closed

Description

@Sun-GLiang

What happened

maka runtime-host project add does not validate that the supplied path is a directory. Passing a regular file inside a Git repository returns Project catalog mutation outcome is unknown and makes the Runtime Host exit with code 1. The next project list cannot connect to the Host. A mistyped project path should be rejected as invalid input while the Host stays available.

There is a second branch of the same missing validation: a regular file outside any Git repository is successfully added as an unavailable project (available: false, exit code 0), instead of being rejected.

How to reproduce

  1. Build main (npm ci, npm run build). Create an isolated directory containing a Git repository, an ordinary file, and a separate Host state directory:

    repro_dir="$(mktemp -d)"
    git init --quiet "$repro_dir/repo"
    touch "$repro_dir/repo/README.md"
    mkdir "$repro_dir/state"
  2. Start a Host and wait for the runtime_host_ready JSON event (keep this terminal open; substitute the printed absolute path for $repro_dir in the second terminal):

    node packages/cli/dist/cli.js runtime-host serve \
      --root "$repro_dir/state" --no-project-roots --json
  3. In a second terminal, first confirm that the Host is available, then add the file, then query again:

    node packages/cli/dist/cli.js runtime-host project list --root "$repro_dir/state"
    node packages/cli/dist/cli.js runtime-host project add "$repro_dir/repo/README.md" --root "$repro_dir/state"
    node packages/cli/dist/cli.js runtime-host project list --root "$repro_dir/state"
  4. The first query returns []. The add command exits 1 with Project catalog mutation outcome is unknown; the Host exits 1; the final query exits 1 with Runtime Host service is not available (unavailable).

Reproduced in three isolated Host instances. For the non-Git variant, use a plain directory instead of git init: the add command returns a project with name README.md, available: false, and exit code 0.

Environment

  • Maka: built locally from main, 05164f5359467a9d00ea144395ab0b9f1f74750c (package version 0.2.0)
  • OS: macOS 15.6 (24G84), arm64
  • Surface: CLI / Runtime Host
  • Node.js: v24.19.0
  • Tested: September 12, 2026

Logs, screenshots, or additional context

Before:
  project list: exit 0, []
Trigger:
  RuntimeHostOperationError: Project catalog mutation outcome is unknown
  project add: exit 1
Host process:
  exit code 1, no signal
After:
  Error: Runtime Host service is not available (unavailable)
  project list: exit 1

The resolver calls realpath() but does not check stat().isDirectory() before repository discovery (packages/storage/src/project-catalog.ts, resolveProjectLocation). Within a Git repository it executes git -C <regular-file> rev-parse ...; this fails with Git's numeric exit status, which is not one of the filesystem codes recognized by isInvalidPathError. The coordinator consequently calls requestDrain() and reports commit_outcome_unknown (packages/runtime-host/src/server/project-catalog-coordinator.ts:143-149). Outside Git, the same file passes through as a folder project.

Related but different: #4806 concerns a valid directory below an invalid ancestor .git marker. This reproduction uses a valid Git repository and selects a regular file; the missing path-type check is also visible without Git.

Discovered and reproduced by Codex during user-authorized exploratory testing of a locally built main checkout. All fixtures and Host roots were isolated from the user's existing Maka data. The testing launcher only selected a separate profile name; the CLI commands and Host implementation were unchanged.

Activity

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