Skip to content

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

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

  • uv run make lint
  • uv run make typecheck
  • uv run make test
  • uv run make docs-check
  • Example --help smoke checks
  • Account-backed integration tests run, or not required

Commands and results:

uv run make lint typecheck test       PASS (3641 passed; 57 account-backed tests deselected)
uv run make docs-check               PASS
python3 .github/scripts/release_notes.py check  PASS
python3 -m unittest discover -s .github/scripts -p 'test_*.py'  PASS (19 tests)
QODER_RUN_LIVE=1 QODER_LIVE_ENV_FILE=.env.live uv run pytest tests/integration -m integration -k strict_response_contract -v
                                     PASS (6 passed; 27 deselected)

The six strict response checks cover Forward/Managed core lists. The new wire contracts cover both synchronous and asynchronous clients; targeted live execution used the synchronous client. Separate example --help smoke checks were not repeated because example code is unchanged.

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
  • Synchronous and asynchronous clients remain aligned
  • 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, ts
  • 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. Existing Forward operations accept the identity_id keyword in both clients. 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, ts #23.

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