[Bug]: Account Models (GLM-5.3-Flash) Cannot Be Selected via App-Server Protocol Due to Revision Type Mismatch
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Bug Description
In ZCode 3.12.3 (tested on macOS arm64), when using zcode.cjs app-server over stdio in hosted mode, account models (e.g. GLM-5.3-Flash under account:zai-individual-coding-plan) cannot be selected via the RPC protocol:
session/setModel {
"model": {
"providerId": "account:zai-individual-coding-plan",
"modelId": "GLM-5.3-Flash"
}
}
Error Returned:
→ -32603 Provider Registry 中不存在 Model
Additionally, turns initiated via session/send with a modelSelection override stall indefinitely with a provider_not_found event.
Root Cause Analysis (Confirmed via Bundle Disassembly)
- The desktop chat engine runs in standalone mode (initializing account providers directly from local credential stores).
- A CLI-spawned
app-serverchild process runs in hosted mode, where account providers must be received via aprovider/updateAccountConfigpush from the host. - While the RPC responds with
status: "received", the snapshot payload is silently discarded right before registry merge by this gate:if (snapshot.basedOnZCodeBuiltinRevision !== configSource.zcodeBuiltinRevision) { /* discard */ } - The Type Mismatch:
- The incoming wire schema enforces
basedOnZCodeBuiltinRevisionas a string (z.string().trim()). - The internal
configSource.zcodeBuiltinRevisionis stored as a number (e.g. value28). - Because of strict inequality (
!==), the condition evaluates totrueon 100% of payloads ("28" !== 28), guaranteeing that no snapshot can ever pass the gate and merge into the provider registry.
- The incoming wire schema enforces
Environment & Reproduction
- App Version: ZCode 3.12.3 (macOS arm64)
- Execution Mode:
zcode.cjs app-server(--stdio/--surface desktop) - Reported by:
박명철 [Z.ai]on Z.ai Community Discord - Discord Thread: https://discord.com/channels/1346756824233148527/1550166821707972658
Proposed Fix
- Normalize Revision Comparison:
Coerce both sides of the comparison to strings or numbers before evaluation:if (String(snapshot.basedOnZCodeBuiltinRevision) !== String(configSource.zcodeBuiltinRevision)) { ... } - Schema Coercion:
AllowbasedOnZCodeBuiltinRevisionin the wire schema to acceptz.union([z.string(), z.number()])or applyz.coerce.number(). - Optional Standalone Flag:
Provide a CLI argument (e.g.--standalone-providers) allowingapp-serverto read credentials directly from local credential storage.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the zcode.cjs app-server entry point and trace provider/updateAccountConfig handling through the revision comparison before registry merge. Reproduce the session/setModel or session/send request with the account model, then verify that the revision values compare consistently, the provider registry receives the snapshot, and no provider_not_found event occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100