Repository navigation
Conversation
…ted nodes On a request, a key's policy or a team: the chain keeps node models only with no cloud fallback, the auto-effort and shadow judges run only on nodes, the response cache is skipped, media calls of a restricted key need a node model and its batches are refused. Usage events carry it.
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Update RPCs keep the restriction unless told "unrestricted", so older clients cannot lift it; the header and gRPC metadata restrict every call through the context; callers cannot forge the usage attribute; values are case-insensitive and checked in one place; a restricted batch names the restriction only when it refused; keys list shows a team's restriction; the schema has the enum.
SetAPIKeyPolicy and UpdateTeam no longer read the stored classification and write it back: COALESCE keeps it in the same statement, so a racing lift is not undone. A batch item error carries one bad_request prefix, and the messageSchema doc comment is back on its function.
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.
data_classification: restrictedis a guarantee that a call stays on self-hosted nodes (VendorLocal,VendorOllama) with no cloud fallback.placement: nodes_onlywas only a request preference, and the auto-effort judge saw the prompt before placement applied.APIKeyPolicy.data_classification,Team.data_classification(+ Create/UpdateTeam), and per callGenerateTextRequest/ExplainRouteRequest,data_classificationon/v1/chat/completions, theX-KTMS-Data-Classificationheader on every HTTP endpoint andx-ktms-data-classificationgRPC metadata (both through the context, so media RPCs too). A call can restrict, never lift a key's or team's restriction. Migration adds the column toapi_keyandteam.SetAPIKeyPolicyandUpdateTeamkeep the current value when the field is empty, so an older console or CLI cannot lift a restriction by leaving it out;"unrestricted"lifts it, andconfig applysends that when the file drops the field.nodes_only(nodes_first,cloud_firstincluded;cloud_onlyisINVALID_ARGUMENT); no node model isFAILED_PRECONDITION no_capable_model, all nodes downUNAVAILABLE, the cloud is never tried. The auto-effort judge and the shadow evaluation judge run only on node models, else fall back / skip. The response cache is skipped, so a restricted answer cannot reach another key.planMedia);SubmitBatchtakes a node batch model or is refused.data_classification: restrictedin the event's meta; a caller's owndata_classificationattribute is stripped.ktms keys mint|policy set --data-classification,ktms route explain --data-classification,DATAcolumn inkeys list(a team's restriction shows asrestricted (team)), MCPmint_key/set_key_policy/explain_route, teams in the YAML file, schema regenerated with the enum.LATENT_ENCODER_URL(latent guardrails, semantic cache), MCP servers, and anollamamodel pointed at a hosted endpoint (nodes are vendorslocalandollama).Checked live on built binaries with two scripted vendors (cloud
openai, nodeollama): a restricted key, a key of a restricted team and the header all route to the node withcloud-first; with the node down a restricted key gets 503 while the cloud vendor receives nothing; an unrestricted key still falls back;cloud_onlyand an unknown value are 400;config planafter apply is empty.Up to date with main after #138:
/v1/messagestakes the header (no body field, the Messages API has none) and answers a bad value in the Messages error shape. Part 1 of ai-process/docs#80 (hedged requests and the corrective JSON retry stay open there).Review, second pass (with #141, docs#202 and docs#193)
Open, by severity:
GenerateTextRequest(17 here, 18–21 there) and touchgateway.pb.go,grpcapi/batch.goandserver/openai_test.go;git merge-treereports conflicts in those four files. Whichever lands second must be rebased andmake protore-run.bad_request:prefix inSubmitBatch(internal/grpcapi/batch.go).classifyalready returnsbad_request: data_classification ..., and the batch loop wraps it asbad_request: item %q: %s, so an item withdata_classification: "secret"yieldsbad_request: item "x": bad_request: data_classification "secret": .... feat: pass temperature, top_p, stop and seed to the model #141 trims the prefix at the same place; do the same here.internal/grpcapi/admin.go,SetAPIKeyPolicyandUpdateTeam). The currentdata_classificationis read withGetAPIKeyByName/ the team read, then written by a separateUPDATEoutside a transaction. An old console sendingSetAPIKeyPolicy{}(readsrestricted) racing an admin'sdata_classification: "unrestricted"writesrestrictedback after the lift, or the other way round. Fix: oneUPDATEwithCASE/COALESCEfor the keep-and-lift semantics, orSELECT ... FOR UPDATEinside the mutation.internal/declarative/schema.go).keyPolicySchemaanddataClassSchemawere inserted between the// messageSchema describes a message as protojson reads it...comment andfunc messageSchema, so godoc shows the protojson description onkeyPolicySchemaandmessageSchemahas none.classify(internal/grpcapi/restricted.go) is 4.Resolved in e141aab:
buf generatere-run.bad_request:prefix, with a test.SetAPIKeyPolicyandUpdateTeamno longer read the stored value first. A nil classification keeps it throughCOALESCE($n, data_classification)in the sameUPDATE, so a racing lift cannot be undone. The DB-backed keep and lift tests pass against Postgres.messageSchemadoc comment is back on its function.classifyis down to 3 lines.Checked and fine: the restriction reaches the auto-effort judge, the shadow judge and the shadow model (
withRestricted+nodes_onlyplacement), both caches are skipped beforelookupCache, and the HTTP stream context carries the flag.