Skip to content

fix(api)!: align session credits, identity scope, and pairing - #23

Merged
moonyue-w merged 1 commit into
mainfrom
codex/fix-session-usage-identity-pairing
Oct 20, 2026
Merged

moonyue-w merged 1 commit into
mainfrom
codex/fix-session-usage-identity-pairing

Conversation

@moonyue-w

@moonyue-w moonyue-w commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Managed Session budgets still serialized the old money object, usage types missed credit fields, and several Forward resource methods could not send Identity ownership in the query. Existing channel pairing also required a code even when a pending pairing ID was available.

  • Replace the shared Session/Deployment budget with {"type":"limit","max_credit_cost":"100.00"}; preserve update omission and explicit null semantics.
  • Add Session credit snapshots, Managed top-level session.usage fields, per-call model credits, and compaction credits while retaining legacy response usage fields.
  • Add query-only identity_id to existing Environment, Skill/Version, Vault/Credential, and File operations, including multipart uploads and downloads. SAT callers must omit it.
  • Support pairing by either code or channel_pairing_id and expose pairing scope fields. This change does not add endpoints.

Why

Align the existing public surface with the official Session schemas, Forward resource ownership, and channel pairing contract, checked on 2026-10-20.

Verification

  • npm run build
  • npm run typecheck
  • npm test
  • npm run docs:check
  • Relevant examples run or import successfully
  • Account-backed integration tests run, or not required

Commands and results:

npm run build                       PASS
npm run typecheck                   PASS
npm test                            PASS (3850 tests)
npm run docs:check                  PASS
npm pack --dry-run                  PASS
python3 .github/scripts/release_notes.py check  PASS
python3 -m unittest discover -s .github/scripts -p 'test_*.py'  PASS (19 tests)

The offline suite includes public export checks and new type/wire tests. Examples are unchanged and were not independently executed against the service.

Targeted CN PAT live validation on 2026-10-20 passed using temporary resources and short auto model requests: budget create/update/omit/clear, current-turn completion and HTTP 400 rejection of the next message after budget exhaustion, Managed Session/history/SSE credits, Forward Session/model-event credits, scoped resource operations, downloads, and cross-Identity rejection. Temporary resources were deleted or archived. These targeted local harness runs are separate from the complete repository live suite; account logs and identifiers are not published.

Not live-tested: SAT restrictions, channel pairing (no dedicated code/pending ID), compaction events, or thread-specific SSE. Offline contract tests cover request/response shapes for those cases; they do not establish server-side SAT behavior.

Impact

  • Public API or behavior changed
  • User-facing changes added to CHANGELOG.md under Unreleased
  • CommonJS, ESM, and subpath exports remain valid
  • Generated API documentation updated
  • Migration notes added for a breaking change
  • No credentials, .env.live, logs, or generated test output committed
  • Cross-SDK parity considered: go, python
  • Contract expectations updated with independent wire tests and narrow compatibility overrides for the frozen upstream budget baseline.

Breaking change: Use max_credit_cost: "100.00" instead of max_list_cost. Methods place identity_id in the query even for create/update/multipart requests; no-body operations accept IdentityScopeOptions. The budget now limits cumulative model and sandbox credits. This requires a minor release while pre-1.0; versioning and publication are a separate release step.

Additional context:

Companion PRs: go #19, python #21.

Match QCA Session budget and usage schemas, route Forward identity ownership through query parameters, and support pairing by record ID. Include wire contract and public type tests, generated references, and migration notes.

BREAKING CHANGE: replace max_list_cost currency objects with max_credit_cost decimal strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant