Support customer-operated enterprise identity, model access and deployment - #40
Open
turgaybulut wants to merge 35 commits into
Open
turgaybulut wants to merge 35 commits into
turgaybulut wants to merge 35 commits into
Conversation
Comment on lines
+92
to
+97
| field = { | ||
| "chat": None, | ||
| "responses": "instructions", | ||
| "messages": "system", | ||
| "generate_content": "systemInstruction", | ||
| }[prepared.protocol] |
There was a problem hiding this comment.
Bug: The _system_prompt_hash function will raise a KeyError if called with prepared.protocol as "count_tokens" because the protocol is missing from a dictionary lookup.
Severity: MEDIUM
Suggested Fix
Add an entry for the "count_tokens" protocol to the dictionary within the _system_prompt_hash function. Setting its value to None, similar to the "chat" case, would prevent the KeyError and make the function more robust against future changes.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: ee/src/shim_enterprise/gateway/pipeline/quota_reservation.py#L92-L97
Potential issue: The `_system_prompt_hash` function uses a dictionary to map
`prepared.protocol` to a field name, but this dictionary is missing an entry for the
`"count_tokens"` protocol. If this function is ever called for a token counting request,
it will raise a `KeyError`. While a guard in `admission.py` currently prevents this code
path from being reached, this is a fragile design. Future refactoring could easily
expose this latent defect, causing an unhandled exception.
Did we get this right? 👍 / 👎 to inform future reviews.
turgaybulut
added this pull request to stack #42
September 11, 2026 12:32
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
Enterprise installations can run the gateway, dashboard and workers with customer-controlled
identity, secrets and model endpoints. Administrators can provision plans, delegate team
access and register approved deployments while retaining native provider contracts,
one provider attempt, tenant isolation and durable accounting/audit behavior.
For example, an administrator can register an internal model alias, restrict a team's
key to that alias, and inspect the request's policy decisions and usage. If the model
has no known price, reports show an unknown cost rather than a fabricated free request.
Completed work
Operator provisioning and subscription retirement
ee/scripts/activate_plan.py.Diagnostic metadata and honest cost reporting
Durable policy decisions
Customer identity and secrets
Teams, scoped keys and quotas
Model registry and native token counting
count_tokens, including beta handling, authentication, rate/privacy policy and strict audit preflight/completion. Counting does not reserve billable quota, settle spending or create an inference lifecycle.Deployment, operations and recovery
Signed releases and offline packaging
Repository cleanup and reviewability
ee/.Validation
The final application tree is identical to the previously verified tree after history restoration.
Rollout and limits
Apply the additive team, OIDC and model-registry migrations and deploy the matching dashboard
management contract. Select OIDC explicitly and configure its tenant/group mappings, trusted
origins and Vault access. Reconcile existing billing obligations before retiring the external
subscription integration; removing a webhook does not cancel a customer's subscription.
Customer Entra/PKI interoperability, agreed performance/recovery thresholds, cross-version
upgrade compatibility and independent clean offline installation require deployment acceptance.
Direct LDAP, SCIM, SAML, local-password authentication and new licence-capacity reporting are
not included. Model tests use native protocol fixtures and do not certify every model server
or deliver model weights. No production deployment or approved release publication was performed.