Repository navigation
feat(runtime): support Start Plan through shared OAuth sessions - #251
Merged
Merged
Conversation
Reuse the existing ZCode account session for standalone Start Plan providers without aliasing Coding Plan identities, exchanging project tokens, or falling back to paid credentials. Guard account changes, cancellation and rejected sessions, and support JWTs without optional expiry claims. Follow up on #248 and #249; thanks to Erencv for investigating the standalone gates and identifying the ZCode JWT credential.
kingsword09
marked this pull request as ready for review
November 1, 2026 02:13
Contributor
|
pkg-pr-new preview for commit npx --yes https://pkg.pr.new/zcode-app-cli@ff5a28bThis preview uses the selected commit. PR updates publish automatically after CI succeeds; kingsword09 can also request a preview with |
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
Enable the bundled
account:zai-start-planandaccount:bigmodel-start-planproviders in standalone CLI/TUI mode using the existing shared ZCode OAuth session. Signing in once can supply both Coding Plan and Start Plan requests; there is no separate Start Plan login.The official runtime still constructs, signs and sends model requests. This change adds no dependencies and does not reimplement its transport or prompts.
Relationship to #248 / #249
This is a follow-up implementation of the feature investigated in #248 and proposed in #249. Thank you @Erencv for tracing the standalone catalog gates, identifying the required
zcodejwttokencredential, and validating the upstream request path.The feature direction and JWT selection agree with #249. This implementation adapts the account plumbing to the existing shared-OAuth reader:
expclaim. A read-only local check found this shape in an actual OAuth session; synthetic regression fixtures cover it without committing real credentials. Presentexp/nbfclaims are still checked, and the server remains authoritative.Refs #248 and #249; neither is automatically closed by this PR.
Implementation
src/start-plan.tsto read only the active OAuth family's profile and JWT, verify snapshot consistency, honor cancellation, and scope retries to the same provider/account/token.Compatibility / scope
Validation
bun run typecheckbun run sync:localagainst Desktop 3.17.1 / runtime 0.17.1bun scripts/check-runtime.tsbun run test:all: 74 unit + 15 TUI + 52 runtime + 17 Node tests (158 total)Tests cover patch drift/ambiguity/partial application, both account families, Desktop-only sessions, one OAuth login authorizing both plan types, stale manual identities, missing/expired/rejected/no-exp JWTs, account changes/logout, scope-safe retries and cancellation. Native-runtime tests use isolated credential stores and mock or disabled HTTP, not a real account's inference quota.
The first full-suite attempt hit a TUI terminal-exit startup timeout. Its isolated rerun (4 tests) and the complete suite rerun both passed; no TUI code was changed for that timeout.