feat: commit OpenAPI spec with CI freshness check#220
Merged
declan-scale merged 5 commits intomainfrom May 5, 2026
Merged
Conversation
Adds agentex/openapi.yaml as the source-of-truth Stainless input, plus a CI job that regenerates the spec on every PR touching agentex/ and fails if the committed file is stale. Downstream consumers (Stainless build workflow in scaleapi/agentex) can read this file directly via the public submodule mirror without re-running spec generation themselves.
- Split the dual-method /forward/name route into separate GET and POST handlers. The previous single function with methods=["GET","POST"] produced two operations with identical operationIds, making the generated spec non-deterministic between runs (route iteration order is unstable). - Pin pyyaml as a real dependency (>=6.0,<7) instead of resolving it ad-hoc with --with pyyaml, which would re-resolve to the latest release on every CI run and could spuriously fail the freshness check if pyyaml ships a serialization change. - Add timeout-minutes: 10 to the openapi-spec job so a hung uv sync or app import can't consume the 6-hour default.
smoreinis
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agentex/openapi.yamlas the source-of-truth OpenAPI spec for the AgentEx backend.agentex/scripts/generate_openapi_spec.pyto regenerate the spec from the FastAPI app.agentex/and fails if the committed file is stale./forward/name/{agent_name}/{path}route into separate GET and POST handlers so each operation has a uniqueoperationIdand the generated spec is deterministic.pyyaml>=6.0,<7as a real dependency.Test plan
openapi-specCI job passes on this PRGreptile Summary
agentex/openapi.yamlas the committed source-of-truth spec, agenerate_openapi_spec.pyscript to regenerate it, amake gen-openapitarget, and a pre-commit hook that auto-regenerates and stages the file on relevant source changes.openapi-specCI job that regenerates the spec and fails if the committed file is stale; wires the result into the existingci-statusrequired check. The job now hastimeout-minutes: 10./forward/name/{agent_name}/{path}route from a single dual-methodapi_routeinto dedicated@router.getand@router.posthandlers, giving each a uniqueoperationIdin the generated spec.Confidence Score: 5/5
Safe to merge — only a P2 style/consistency suggestion on missing
--frozenflags in CI.No P0 or P1 findings. The single P2 comment is about adding
--frozentouv syncanduv runin CI for consistency with the Makefile; it doesn't affect correctness in the common case. The route split, spec generation script, freshness check logic, and dependency pinning are all correct..github/workflows/ci.yml— the missing--frozenflags on the install and run steps.Important Files Changed
openapi-specjob (withtimeout-minutes: 10) that regenerates and diff-checks the spec; wires it intoci-status.uv syncruns without--frozen, creating a subtle inconsistency with the Makefile's--frozenusage.api_routeinto separate@router.getand@router.posthandlers for the/forward/name/{agent_name}/{path}endpoint; both handlers delegate identically toforward_agent_request, which is correct.agentex-openapi-spechook that runsmake gen-openapi && git add openapi.yamlon changes toagentex/src/or the generator script. Useslanguage: systemwhich requiresuvandmakeon PATH.gen-openapitarget usinguv run --frozen; clean and consistent with project conventions.pyyaml>=6.0,<7as a proper pinned runtime dependency so CI resolves it from the lockfile rather than ad-hoc.operationIdvalues.Sequence Diagram
sequenceDiagram participant Dev as Developer participant PC as pre-commit hook participant CI as CI openapi-spec job participant Repo as Repository Dev->>PC: git commit (agentex/src/** changed) PC->>PC: cd agentex && make gen-openapi PC->>PC: git add openapi.yaml PC-->>Dev: commit proceeds (spec auto-staged) Dev->>Repo: push PR Repo->>CI: trigger (agentex changes detected) CI->>CI: uv sync CI->>CI: uv run generate_openapi_spec.py CI->>CI: git diff --exit-code openapi.yaml alt spec is fresh CI-->>Repo: openapi-spec job = success else spec is stale CI-->>Repo: openapi-spec job = failure end Repo->>CI: ci-status checks openapi-spec.resultPrompt To Fix All With AI
Reviews (4): Last reviewed commit: "chore(pre-commit): don't update uv.lock" | Re-trigger Greptile