Skip to content

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

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

  • make lint
  • make build
  • make test
  • make docs-check
  • go build ./examples/...
  • Account-backed integration tests run, or not required

Commands and results:

make lint build test                  PASS
make docs-check                      PASS
go build ./examples/...              PASS
python3 .github/scripts/release_notes.py check  PASS
python3 -m unittest discover -s .github/scripts -p 'test_*.py'  PASS (19 tests)

The full Go checks ran on a clean copy of the changed source because the working checkout contained an unrelated ignored historical Go harness. No current-source tests were omitted. The docs check also passed on the staged commit before submission.

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
  • 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: python, ts
  • Contract expectations updated with independent wire tests and narrow compatibility overrides for the frozen upstream budget baseline.

Breaking change: Use MaxCreditCost: "100.00" instead of MaxListCost. No-parameter Forward methods accept forward.WithIdentityID(...); methods with params expose IdentityID. 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: python #21, ts #23.

Match QCA Session budget and usage schemas, route Forward identity ownership through query parameters, and support pairing by record ID. Include wire contract 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