Skip to content

fix(runtime): a service without src/openapi.py starts without one - #112

Merged
antoinetoussaint-byte merged 1 commit into
mainfrom
fix/openapi-optional
Oct 26, 2026
Merged

antoinetoussaint-byte merged 1 commit into
mainfrom
fix/openapi-optional

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

Fixes a defect found in a live run. A python-fastapi service that ships no src/openapi.py could not start from a fresh checkout. Init failed with "cannot generate Open API document" because it ran uv run python src/openapi.py whenever src/main.py changed.

The model gateway hits this. It deleted its generator with its REST API (module-model-gateway 4d07bb7), under the decision that each module exposes one Connect face. Its HTTP endpoint (api: rest) now serves only the probes.

Fix

Init now runs the OpenAPI generator only when the project ships src/openapi.py.

  • The scaffold ships it, and the document it writes describes the app's REST routes. Nothing changes for those services.
  • A project without the generator publishes no OpenAPI document, and Init runs nothing for it.
  • The rest of Init is unchanged, including the src/main.py cache that skips regeneration when nothing changed.

Classification: fix, in the agent that owns the startup step.

Why the condition is the generator's presence, not the REST endpoint: the agent requires an HTTP (api: rest) endpoint on every service, because it maps uvicorn's port and the probes from it. The model gateway still declares one. What is optional is the OpenAPI contract on that endpoint, and the generator is how a project declares it has one.

Why the OpenAPI path is not deleted: REST is not gone. New scaffolds are REST FastAPI services that ship the generator.

Test

TestInitWithoutAnOpenAPIGeneratorRunsNone: a service with gRPC and the Connect face enabled, a probes-only HTTP endpoint and no generator. Init reaches READY and runs only uv sync. The test fails on main.

The existing Init test now gives its probe project a generator, so it still checks that a REST service runs it.

Checks

  • go build, go vet, go mod tidy -diff and go test ./... pass locally.
  • Not verified: a live codefly run of the model gateway with this agent. That needs the gateway's full composition (authority, hop, installation values).

🤖 Generated with Claude Code

Init ran `uv run python src/openapi.py` whenever src/main.py changed, so a
service whose API is on its gRPC and Connect faces alone, and which ships no
OpenAPI generator, failed Init on a fresh checkout ("cannot generate Open API
document"). The model gateway deleted the generator with its REST API.

Init now runs the generator only when the project ships it: the scaffold
does, and its document describes the app's REST routes. Without it the HTTP
endpoint publishes no OpenAPI document, and nothing is run.

TestInitWithoutAnOpenAPIGeneratorRunsNone (gRPC + Connect service, no
generator: Init READY, only `uv sync` runs) fails on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byte merged commit c43d3c3 into main Oct 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant