Repository navigation
feat(mcpx): live API-spec add/remove over /v1 + CLI parity (#2118 item a) - #4637
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91021b4eb9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Correction to the test summary above: the full |
- daemon: compare the API name against servers resolved namespaces (mcpx.namespace), not their names, before persisting (P1) - cli: resolve local --spec paths against the CLI working directory before sending them to the daemon (P2) - config: decode API/adapter declaration documents with UseNumber so editing apis/adapters cannot round exact sibling numbers such as a tool-view pinned ID above 2^53 (P2); regression test TestAPIEditsPreserveExactNumbers (oracle: exact literal round-trip) Task 13398 (lane code-v), issue #7297.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f26f0e973
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…m a)
Add apis_add (POST /v1/apis) and apis_remove (DELETE /v1/apis/{name})
following the adapters_add pattern from PR #2565: persist the
declaration into the first paths.apis file that names API files and
reload, so the API is callable immediately and survives restart;
refuse with a remedy when no API file is configured, on cross-file
duplicates, and on server-namespace collisions.
CLI: mcpx api add <name> --spec <doc> [...] and mcpx api remove
<name> go through the daemon like adapter add/remove. Regenerated
ops.gen.ts and docs/parity.md; the api manual entry now lists
add/remove and drops the stale local-only note.
- daemon: compare the API name against servers resolved namespaces (mcpx.namespace), not their names, before persisting (P1) - cli: resolve local --spec paths against the CLI working directory before sending them to the daemon (P2) - config: decode API/adapter declaration documents with UseNumber so editing apis/adapters cannot round exact sibling numbers such as a tool-view pinned ID above 2^53 (P2); regression test TestAPIEditsPreserveExactNumbers (oracle: exact literal round-trip) Task 13398 (lane code-v), issue #7297.
…(PR #4637) Codex P1 round 2: the namespace collision check compared only the RESOLVED namespace, so an API named exactly like a configured server whose mcpx.namespace differs (backend -> pets) was persisted and then rejected by augmentAPIs at reload. Exact-name collisions are now refused independently, with the API-generated exemption kept. Regression: TestAPIAddRefusesExactServerNameWithForeignNamespace (backend and pets both 409, nothing persisted). Branch rebased onto current main (parity ops count 89) and plugin/core/ops.gen.ts regenerated. Verified: daemon suite pass; api/cli parity pass; internal/config TestServerKeysAnotherHostWritesAreRecordedNotRefused and conformance TestMessagesClient subtest fail identically on clean main (pre-existing, unrelated).
6f26f0e to
130a155
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 130a155405
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
🤖 Agent note · picked up (resume) — task 13398, lane code-d
|
) Codex round-3 P2 on 130a155: the apis_add collision check re-sanitized an already-resolved namespace before comparing (SanitizeNamespace(resolved) == want). Resolve preserves an explicit mcpx.namespace verbatim and ResolveAll compares resolved namespaces exactly, so the extra sanitization invented collisions: a server with explicit namespace "pets$" falsely blocked an API named "pets_". Compare resolved == want directly, matching ResolveAll semantics. Regression test TestAPIAddAllowsNameThatOnlySanitizesToAnExplicitNamespace (oracle: ResolveAll's exact owners-map comparison, plus the Codex example): server backend with mcpx.namespace "pets$" now allows API "pets_" (200, persisted). Tests: go test ./internal/daemon/ ./internal/cli/ pass; ./internal/config/ has one failure (TestServerKeysAnotherHostWritesAreRecordedNotRefused) that reproduces identically on clean main - pre-existing, tracked on issue #8007, untouched by this change. Task 13398, lane code-d (resume of the code-v / any-b dispositions).
|
@codex review Re-review head 4eb8e85: the round-3 P2 (re-sanitized resolved-namespace comparison in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4eb8e85fc2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… live aliases (PR #4637) Two Codex round-4 P2s on 4eb8e85, both accepted: 1. Disabled servers were counted as namespace owners in the apis_add collision check, but ResolveAll skips disabled servers entirely, so a disabled `backend` with mcpx.namespace "pets" falsely refused API "pets" with 409. The namespace hit is now gated on the server being enabled; the independent exact-server-name refusal is unchanged. 2. apis_remove deleted the declaration before reloading, so an enabled server aliasing the API (pets-view aliasOf pets) stranded the config: every later reload and daemon start failed in Resolve with the entry already gone. Removal now refuses with 409 BEFORE writing when an enabled configured server's aliasOf names the API; a disabled alias (skipped by ResolveAll) does not gate removal. Regression tests (oracles: ResolveAll's disabled-skip and exact owners semantics, and Resolve's unknown-alias rejection): TestAPIAddAllowsNamespaceOwnedByADisabledServer, TestAPIRemoveRefusesWhenAnEnabledAliasDependsOnIt, TestAPIRemoveAllowsWhenOnlyADisabledAliasDependsOnIt. Tests: go test ./internal/daemon/ ./internal/cli/ -count=1 pass (full suites). Task 13398, lane code-d.
|
@codex review Round 5, head 76420e0: both round-4 P2s are fixed and dispositioned on their threads (disabled servers no longer own namespaces in the apis_add check; apis_remove refuses with 409 before writing while an enabled alias depends on the API), each with regression tests; full daemon + cli suites pass. Please confirm. |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
🤖 Agent note · done — merged (task 13398, lane code-d, resume)
|
Implements #2118 item (a): the API-spec write side.
What
apis_add) + DELETE /v1/apis/{name} (apis_remove) inpkgs/mcpx/internal/daemon/routes_settings.go, following theadapters_addpattern (PR feat(mcpx): live add/remove for adapter declarations (#2118) #2565): persist the declaration into the firstpaths.apisfile and reload, so the API is callable immediately and survives restart. Refuses with remedy when no API file is configured, on cross-file duplicates, and on server-namespace collisions.AddAPIEntry/RemoveAPIEntry/APIDefinedInininternal/config/write.go, preserving bare-array vs{"apis": [...]}shape and sibling sections of combined documents.Command: "api add"/"api remove"(PermissionAdmin,Admin,Mutating, +Destructive/Idempotenton remove), so the routes are also reachable over MCP (mcpx_apis_add/mcpx_apis_remove) and the plugin client (ops.apisAdd()/ops.apisRemove()).mcpx api add <name> --spec <doc> [--base-url ...] [--include ...] [--exclude ...] [--methods ...] [--deprecated] [--header K=V]... [--description ...] [--replace]andmcpx api remove <name>, through the daemon like adapter add/remove.plugin/opencode/mcpx/ops.gen.ts,docs/parity.md,flagindex_generated.go;apimanual entry lists add/remove and drops the stale local-only note (already false since augmentAPIs, PR feat(mcpx): declared OpenAPI APIs are first-class servers (#2118) #2514).Tests
internal/config:write_apis_test.go(create/duplicate/replace, bare-array shape, sibling-section preservation)internal/daemon:api_routes_test.go(validation, no-file remedy, cross-file dup, replace-edits-defining-file, add+remove round trip, 404 on unknown, concurrency, namespace collision)internal/cli:api_add_test.go(flag hoisting,--headerparsing)go test ./...green on the laptop for all ofpkgs/mcpx; targeted e2e generated-command tests pass.Closes #2118 item (a). Recipe live-add was already present (verified, untouched); bare-binary generated declarations remain with the sibling packet coordinating with #1962.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.