Skip to content

apps: an app name of 251+ characters passes app_name_error, then install raises an unhandled OSError and POST /api/apps/install answers 500, because the name gate has no length bound #27872

Closed

Description

@jongaffen

Existing issues

  • I searched open issues and this is not already reported.

KiroCrew version

0.11.0

Release channel

Stable

How is it installed?

Desktop app

Platform

Windows

What is broken

An app whose manifest name is 251 or more kebab-case characters passes app_name_error, and then its install fails with an unhandled OSError. POST /api/apps/install answers 500 instead of a named 400, and nothing is installed. The expected result is that the name gate refuses the name with a message, or the install succeeds.

app_name_error is "The single app-name contract" and says "The name is an identity AND a directory component, so the same string has to satisfy both roles" (src/kiro_crew/apps/manifest_names.py:94-98 on main). Its checks (:100-129) cover emptiness, the kebab grammar, reserved names and Windows device stems, with no length bound. The longest component built from the name is the record lock (src/kiro_crew/apps/manager_records.py):

265:     return config_dir() / "app-record-locks" / f"{name}.lock"

A 251-character name makes that component 256 characters, past the 255-character limit NTFS and common POSIX filesystems apply per component. install_app then raises from the lock create (platform_lock_compat.py:427). The route runs install_app in an executor with no except and maps only result.ok == False to 400 (src/kiro_crew/apps/routes_install.py:452-464). The audit middleware logs the exception and re-raises it (dashboard/server_runtime/middleware_chain.py:199-208, :334-343), so aiohttp answers 500.

Name length app_name_error install_app app_data_dir
200 None ok created
250 None ok, app dir path 330 chars created (335 chars)
256, 3 runs None OSError(22, 'Invalid argument') OSError(22)

The 250-character control installs at 330 to 335-character paths, so the bundled interpreter has no MAX_PATH limit on this host. The failure rests only on the per-component limit.

Why it matters

Every door that admits an app funnels through this function: manifest validation, external self-registration, builtin registration, scaffold and the registry pipeline. So a name the filesystem cannot hold is admitted everywhere and fails only at install, as an internal server error. The user cannot tell from a 500 that the name is the cause. Nothing is written, so the failure is closed. Severity is low. Workaround: shorten the app name.

Reproduction

Harness on Windows with the Desktop app's bundled interpreter and a scratch KIROCREW_HOME (third-party apps allowed). For a source folder whose app.json holds a 256-character kebab name, it calls the installed app_name_error(name), install_app(src) and app_data_dir(name). A fresh home is used for each run. Frequency: 3 of 3 runs at 256 characters failed, and the 200 and 250-character controls installed. The HTTP 500 is traced from source and was not driven through aiohttp.

Portable repro (any OS): assert app_name_error("a" * 251) is not None fails on main. A route test that posts a source whose manifest name is 251 characters gets 500 today.

Relevant log output

Tail of the harness traceback for a 256-character name (scratch home shown as <home>, name shortened):

  File "<install-root>\Lib\site-packages\kiro_crew\platform_lock_compat.py", line 427, in open_create_or_existing
    return os.open(name, flags | os.O_CREAT | os.O_EXCL, mode, dir_fd=dir_fd)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: '<home>\\app-record-locks\\abcdefghi-abcdefghi-...-abcdef.lock'

app_data_dir on the same name raised OSError(22, 'The filename, directory name, or volume label syntax is incorrect'), and the apps folder stayed empty. Through the route, the audit middleware records outcome=error with str(exc)[:200] (middleware_chain.py:204-206).

What would close it

Recommended fix: add a length bound to app_name_error that leaves room for every component derived from the name. Today the longest is <name>.lock, so the bound is 250 characters. Give the refusal its own wire code beside RESERVED_APP_NAME_CODE (:60-64), for example app_name_too_long, so the install route answers 400. Add a test that builds every derived component for a maximum-length name, which pins the bound when a longer derived name is added. Tradeoff: the bound has to track the derived names.

Declared behavior change: a name of 251 or more characters is refused at every admission door with a named error. Names of 250 characters or fewer behave as today.

Rule check: the module notes that tightening a name is a one-way door for apps already published under it (:54-57). A 251-character name cannot install on any common filesystem, so no installed app loses its name. Tests generate names of 1-60 characters (test/test_app_manifest.py:585), and no test pins a longer name.

Alternatives:

  • Catch OSError in install_app and return AppResult(ok=False). Second: the gate is the single admission point, and this leaves self-registration, scaffold and external-app paths admitting the name.
  • A tighter product cap such as 64. Second: it is the same one-way door for names between 65 and 250 that install today.

Sibling cases: the callers of app_name_error (manifest.py:470, manager_external.py:116, manager_builtins.py:290, registry_pipeline/install.py:286, registry_pipeline/recovery.py:258, scaffold.py:511, official_catalog.py:662, dashboard/chat_api/slot_create.py:289) all gain the refusal. Must not change: reserved names, device stems and the kebab grammar keep their messages and codes.

Acceptance criteria:

  1. app_name_error returns a message for a 251-character kebab name. Fails on main.
  2. POST /api/apps/install with a source whose manifest name is 251 characters answers 400 with the new code and creates nothing. Fails on main (500).
  3. Existing behavior unchanged: a 250-character name installs as today, and reserved names, device stems and grammar errors keep their current messages and codes.

Environment

Provenance

Found by reading the app-name gate for limits it does not enforce, then run with a disposable harness on the installed build's real gate and install functions. The route's 500 is traced from source. No live install was attempted.

Related

🤖 AI-assisted report 🤖

Activity

  1. added
    tier:T1Bug: behaviour does not match intent; fix keeps the design
    on Nov 2, 2026
  2. KiroCrewCaptain commented on Nov 2, 2026

    @KiroCrewCaptain
    Collaborator

    Thanks for the report. This issue has been triaged by Crew Captain and will be assigned to a maintainer, who will follow up here.

  3. mbriones98 commented on Nov 2, 2026

    @mbriones98
    Contributor

    🤖 Kiro Crew Auto-Pipeline [operator: mbriones98#091ded5d]: Confirmed on main. app_name_error in src/kiro_crew/apps/manifest_names.py sets no length limit. The longest path component built from the name is the record lock app-record-locks/<name>.lock in manager_records.py, so a name of 251 or more characters passes the gate. The install then raises OSError at the lock create, and the install route answers 500. The fix adds a 250-character limit to app_name_error, so every derived component fits in 255 characters. The refusal gets its own wire code next to RESERVED_APP_NAME_CODE, and the install route answers 400. A test builds every derived component for a maximum-length name, so a longer derived name added later fails the test. No name that installs today is refused: a 250-character name still installs. Reserved names, device stems and grammar errors keep their messages and codes. Labelled for an automated fix; the fix session will claim this issue when it starts.

  4. added
    auto-fixableTriage: mechanical fix, automated pipeline will handle
    and removed
    needs-triageAwaiting automated triage
    on Nov 2, 2026
  5. added a commit that references this issue on Nov 3, 2026
    8c204ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

auto-fixableTriage: mechanical fix, automated pipeline will handlebugSomething is not workingchannel: stableReported from a stable releasetier:T1Bug: behaviour does not match intent; fix keeps the design

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions