Repository navigation
runtime-host project add with a regular file inside a Git repository shuts down the Host #5220
Description
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
-
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"
-
Start a Host and wait for the
runtime_host_readyJSON event (keep this terminal open; substitute the printed absolute path for$repro_dirin the second terminal):node packages/cli/dist/cli.js runtime-host serve \ --root "$repro_dir/state" --no-project-roots --json -
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"
-
The first query returns
[]. The add command exits 1 withProject catalog mutation outcome is unknown; the Host exits 1; the final query exits 1 withRuntime 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