What 's the new usage of get_quota?
After upgraded:
copilot_versionfrom1.0.12to1.0.68copilot_sdk_versionfromv0.2.2tov1.0.5
The get_quota fails.
result = await client.rpc.account.get_quota()
failed, and report:
ServerAccountApi.get_quota() missing 1 required positional argument: 'params'
Reference: #1151
Investigation findings
This is a confirmed bug in the Python SDK v1.0.5.
What I investigated
python/copilot/generated/rpc.py— the generatedServerAccountApi.get_quota()signaturescripts/codegen/python.ts— theisParamsOptional()function andemitMethod()logic controlling how method signatures are generatedpython/e2e/test_rpc_e2e.pyline 70 — the SDK's own e2e test, which callsget_quota()with no argumentsnodejs/src/generated/rpc.ts— the TypeScript equivalent for comparison
Root cause
The Python codegen marks params as required unless the schema uses the Zod optional-params pattern (anyOf: [{ not: {} }, { $ref }]). The account.getQuota schema does not use this pattern, so the generated signature becomes:
async def get_quota(self, params: AccountGetQuotaRequest, *, timeout: float | None = None) -> AccountGetQuotaResult:
However, AccountGetQuotaRequest has only one optional field (git_hub_token: str | None = None), so there is no meaningful scenario where passing params would be required. The SDK's own e2e test (test_rpc_e2e.py, line 70) calls it without any argument:
result = await client.rpc.account.get_quota()
This confirms the no-args form was the intended API design.
Workaround (until fixed)
Import AccountGetQuotaRequest and pass an empty instance:
from copilot.rpc import AccountGetQuotaRequest
result = await client.rpc.account.get_quota(AccountGetQuotaRequest())
# or with a custom token:
result = await client.rpc.account.get_quota(AccountGetQuotaRequest(git_hub_token="your-token"))
Fix needed
The account.getQuota schema should use the optional-params pattern so the codegen produces:
async def get_quota(self, params: AccountGetQuotaRequest | None = None, ...) -> AccountGetQuotaResult:
Generated by Bug Handler for issue #1946 · sonnet46 1.7M · ◷
async def get_quota(self, params: AccountGetQuotaRequest | None = None, ...) -> AccountGetQuotaResult:
async def get_quota(self, params: AccountGetQuotaRequest, *, timeout: float | None = None) -> AccountGetQuotaResult:
The Python generator did carry the optional-request wrapper, but account.getQuota declares its params as a $ref, and the optionality check only inspected the unresolved reference — so the wrapper inside AccountGetQuotaRequest was never seen. #2556 resolves the schema before that check, which fixes the same defect on models.list, plugins.marketplaces.refresh, sessions.list, and sessions.stopRemoteControl too. Verified against the real CLI with wheels installed outside the repo: unpatched main raised missing 1 required positional argument: 'params', the patched wheel returned real quota snapshots, and explicit requests plus required-params methods behaved unchanged.
— kondv's Copilot 🤖
Thanks for the detailed original report and investigation. After digging further, I don't think this should be fixed in the Python (or TypeScript) codegen.
account.getQuota's params schema is a $ref to a named type that itself is marked optional, rather than being marked optional at the call/argument position the way most other list-style RPC methods are. Both representations accept identical JSON payloads on the wire, so nothing was ever incorrectly rejecting valid calls — but the current codegen only recognizes the "optional at the argument position" form (which is how e.g. session.agent.list and session.model.list are declared, and those already generate correctly as omittable). Teaching the codegen to also infer omittability by following a $ref to a named type would only be safe as long as that named type is never reused in a context where it should be required — which the schema doesn't guarantee, so we don't want to build that assumption into the generator.
In the meantime, the existing workaround remains correct and supported:
from copilot.rpc import AccountGetQuotaRequest
result = await client.rpc.account.get_quota(AccountGetQuotaRequest())
The right long-term fix is for the account.getQuota (and similarly-shaped) request schemas to declare optionality inline at the parameter position, matching the pattern already used elsewhere. That's a runtime/schema change, not an SDK codegen change, so I'm closing this issue — please reopen or file against the runtime if you'd like to track that schema change specifically.