Align validation error fields and malformed IDs with official responses - #45
Merged
Merged
Conversation
A malformed path identifier on Session-family, Environment, Template, Credential, Agent update and Skill routes returned 400 "Invalid resource identifier or request limits." where a well-formed missing identifier returned 404, and some routes rejected the identifier before validating the body or query. Resolve malformed path identifiers to the maximum UUID, which Core never assigns, so each request follows exactly the missing-identifier path, including body, query and storage checks. Routes whose lookup is the next check keep their direct not-found response. Malformed list cursors and request-body references keep their existing errors (SES-28).
Metadata limits and value types, Agent names and Template network rejections now return 400 invalid_request_error with the observed param and message instead of local codes with a null param (VA-07/08/09, SFT-20). A non-string metadata value is reported in document order before the generic body error; limit checks keep their position, and Vault metadata still has no pair or length limits. PostgreSQL text and jsonb cannot store U+0000, which produced 500s (VA-10). Metadata rejects it explicitly with its metadata.<key> param; other stored strings map the untranslatable-character errors to 400 invalid_request_error. The failing statement aborts its transaction, so nothing is written. This is a documented local limit: the official service accepts U+0000.
Add the dated batch section to the official semantics alignment document with the row matrix, evidence, design decisions and deferred items, register the batch in the operation evidence inventory, and update CONTRIBUTING, the contract README and the list query deferred list where they described the previous behavior.
PostgreSQL error 22021 also reports invalid UTF-8 in text parameters, such as a Session list agent_id filter of %ff, so the U+0000-specific message was wrong there. Keep status 400, code invalid_request_error and a null param with a message that covers both causes. The explicit metadata U+0000 errors and their metadata.<key> param are unchanged.
Record that the official service abbreviates long metadata keys in the M2 message while Core quotes the full key, since one uniform sample cannot reveal the rule. Limit M4 to Vault create, as neither Core nor the pinned SDK has a Vault update. Describe duplicate metadata keys accurately: the pre-decoding scan checks only the last value, while typed decoding rejects a non-string at any occurrence. No behavior changes.
Replay POST /v1/skills/{skill_id}/versions with malformed, missing and
foreign Skill IDs, using valid and invalid archives and default fields,
and require byte-identical responses without writes.
SaladDay
force-pushed
the
codex/validation-error-fields
branch
from
September 23, 2026 09:04
07a568b to
efe5c91
Compare
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.
Core already rejected these invalid requests, but with generic codes and null params. It also returned 500 for text PostgreSQL cannot store, and returned 400 instead of 404 for malformed resource IDs. This batch aligns the error fields with owned official observations. It does not change any limit or accepted value. The pinned baseline is unchanged (SDK 3.13.0 / d7c41ef /
agents=v1).Behavior
Metadata validation on Agents and Sessions:
metadata;metadata.<key>;metadata.<key>;metadata.<key>.All use code
invalid_request_errorwith the observed official message format. Vault metadata still has no size limits, as on the official service.Agent
nameover 128 characters: paramname, codeinvalid_request_error.U+0000 and invalid UTF-8:
metadata.<key>.invalid_request_errorinstead of 500, and nothing is written.Malformed path IDs: a malformed (non-UUID) ID now follows exactly the missing-ID path on every Beta, Files and Skills route, so it gets a byte-identical response, including when the body or query is invalid. The ID is resolved to a UUID that Core never assigns (malformed Skill version paths resolve to version 0, which the database forbids). Malformed list cursors and body ID references keep their current behavior.
Template network rejections: these (and the shared inline Session network check) use code
invalid_request_errorwith a null param. The accepted hostname forms are unchanged and not widened. Unknown-field errors are now reported before network errors, so the result no longer depends on map order.Evidence
Campaign scan 1 findings VA-07/08/09/10, SES-28 and SFT-20 (owned official requests, request IDs retained privately), plus the Sept 22 official Session metadata type error. Recorded in
contracts/agents-api/official-semantics-alignment.mdandoperation-evidence.md.Validation
make -o check-web checkplus Web typecheck, core-doctor, 301 client tests, 602 Web tests and the build all pass. The Playwright browser cases were not run on the server (no Google Chrome there; skip approved by the user).make openapiis byte-identical. No SQL changes.Documented differences and deferred items
No full protocol compatibility is claimed.