Skip to content

🖨️ fix: Regenerate the Agents OpenAPI Spec With repositoryInstructions - #16029

Merged
danny-avila merged 1 commit into
devfrom
lia/openapi-spec-drift
Sep 16, 2026
Merged

danny-avila merged 1 commit into
devfrom
lia/openapi-spec-drift

Conversation

@lia-by-librechat

Copy link
Copy Markdown
Contributor

Summary

Every job in the TypeScript type checks workflow fails on current dev at the OpenAPI spec drift check step, and with it every open pull request that rebases on dev: npm run -w @librechat/api openapi:check reports The committed OpenAPI spec does not match the code. The committed packages/api/openapi/agents.openapi.json is missing the repositoryInstructions field, because #16008 added that field to the agent schema and merged at 09:00 while #15928 committed a specification generated from a branch that predated it and merged at 19:50. This change regenerates the specification from the code, so the drift check passes again and the field appears in the published contract.

Nothing but the generated artifact changes; the field itself already exists in packages/api/src/agents/validation.ts and in the Mongoose schema.

How it works

The generator writes what the zod registry holds, so agentBaseSchema reaching AgentCreateRequest, AgentUpdateRequest and Agent puts the field in all three components:

+          "repositoryInstructions": {
+            "type": "string",
+            "enum": [
+              "prefer",
+              "defer",
+              "off"
+            ]
+          },
packages/api/src/agents/validation.ts   # repositoryInstructions: z.enum(['prefer','defer','off']).optional()
  → src/openapi/agents.ts               # registers the agent schemas
    → src/openapi/document.ts           # builds the document
      → openapi/agents.openapi.json     # the committed artifact, regenerated here

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

Regenerated on a clean worktree of dev at 69f0dd2 and re-checked:

npm run -w @librechat/api openapi:generate
npm run -w @librechat/api openapi:check   # The committed OpenAPI spec matches the code.

The regenerated file is byte-identical to dev's except for the three repositoryInstructions blocks, and its content matches the specification regenerated independently on #16028 (which differs only by that pull request's own text/html error responses). zod-openapi@4.2.4 is the version the lockfile resolves, so the output matches what CI generates. Prettier and git diff --check pass; the file is listed in .prettierignore as a generated artifact.

No TypeScript source changed, so no workspace typecheck applies. Not run: the agents route suites, which this artifact does not affect.

Note: #16028 also regenerates this file as part of a larger change. This pull request is the one-file subset, so dev can go green immediately; it can be closed as redundant if #16028 merges first.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes

Regenerates packages/api/openapi/agents.openapi.json from the code so
openapi:check passes again. #16008 added repositoryInstructions to the
agent schema and merged before #15928, whose committed spec was
generated from a branch that predated the field, leaving dev red.
@lia-by-librechat

Copy link
Copy Markdown
Contributor Author

Head cc139e88008d5ced0064338e8472bdd38356a2d7 carries one file: packages/api/openapi/agents.openapi.json, regenerated by npm run -w @librechat/api openapi:generate on a clean worktree of dev at 69f0dd2a1. The only content change is the three repositoryInstructions blocks in AgentCreateRequest, AgentUpdateRequest and Agent. openapi:check passes at this head; no source changed.

@danny-avila
danny-avila merged commit 96eae2b into dev Sep 16, 2026
26 checks passed
@danny-avila
danny-avila deleted the lia/openapi-spec-drift branch September 16, 2026 19:14
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.

2 participants