zai-org / zai-org/feedback

[Bug + Community Fix] ZCode GLM Coding Plan Login Failure After Update/Logout β€” deletedModels Blacklist Issue

Open
#290 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Bug Report & Community Fix Proposal

πŸ“‹ Summary

ZCode cannot log back into GLM Coding Plan after update or logout β€” browser authorization succeeds but app never completes login. Root cause: deletedModels blacklist corrupts provider config.

Community Fix Available: megamen32/zcode-coding-plan-login-fix


πŸ” Problem Description

Symptoms
  1. User updates ZCode to new version
  2. User logs out of GLM Coding Plan account
  3. User attempts to log back in (Settings β†’ Z.ai β†’ Log in)
  4. Browser authorization window opens βœ…
  5. User completes authorization on website βœ…
  6. App never logs in ❌ β€” provider appears empty/broken
Affected Users
  • All ZCode users on GLM Coding Plan who:
    • Updated ZCode recently, OR
    • Logged out and tried to log back in
  • Platform: macOS, Linux, Windows
  • Severity: HIGH β€” completely blocks access to Coding Plan features

πŸ”¬ Root Cause Analysis

Technical Details (Discovered by @megamen32)

After logout, ZCode incorrectly moves all Coding Plan models into a blacklist called zcode.deletedModels and empties the model list:

// BROKEN STATE in ~/.zcode/v2/config.json
{
  "builtin:zai-coding-plan": {
    "name": "Z.ai - Coding Plan",
    "enabled": true,
    "source": "custom",
    "models": {},                    // ← EMPTY! No models
    "zcode": {
      "deletedModels": [            // ← Models blacklisted here
        "glm-4.5-air",
        "glm-4.7", 
        "GLM-5-Turbo",
        "GLM-5.2"
      ]
    }
  }
}

Why this breaks login:

  • Provider has empty models β†’ App sees empty provider
  • deletedModels blacklist prevents model restoration on re-login
  • Authorization succeeds but provider initialization fails silently
  • User stuck in infinite login loop

πŸ› οΈ Community Fix (by @megamen32)

Repository: megamen32/zcode-coding-plan-login-fix

Author: @megamen32 (GitHub)

Discord Thread: https://discord.com/channels/1346756824233148527/1537719656574615592

Fix Components
File Purpose
zcode_fix.py Auto-fix script (Python 3.7+, cross-platform)
config.zai-coding-plan.json Ready-to-paste model config for manual fix
README.md Full documentation (EN/RU)

Quick Fix (One-Liner)

macOS / Linux / Debian:

# Quit ZCode COMPLETELY first (Cmd+Q + check tray)
curl -fsSL https://raw.githubusercontent.com/megamen32/zcode-coding-plan-login-fix/main/zcode_fix.py | python3 -

Windows (PowerShell):

# Quit ZCode from system tray first
python -c "import urllib.request;exec(urllib.request.urlopen('https://raw.githubusercontent.com/megamen32/zcode-coding-plan-login-fix/main/zcode_fix.py').read())"

What the Fix Script Does
  1. Backs up ~/.zcode/v2/config.json with timestamp
  2. Finds all affected providers (zai-coding-plan, bigmodel-coding-plan, etc.)
  3. Removes zcode.deletedModels blacklist block
  4. Restores full model list with correct specs:
    • GLM-5.3: 1M context, 128K output, reasoning variants (high/low/max)
    • GLM-5.2: 1M context, 128K output
    • GLM-5-Turbo: 200K context, 128K output, reasoning enabled/off
  5. Never touches API keys or other settings
Dry-Run Mode (Safe Check)
python3 zcode_fix.py --check   # Shows what would be fixed, changes nothing

πŸ“‹ Manual Fix (No Python Required)

  1. Quit ZCode completely (Cmd+Q + tray / system tray exit)
  2. Open config file:
    • macOS/Linux: ~/.zcode/v2/config.json
    • Windows: %USERPROFILE%.zcode\v2\config.json
  3. Backup the file β†’ config.json.bak
  4. Find builtin:zai-coding-plan section
  5. Delete entire zcode.deletedModels block
  6. Replace empty models {} with full model list from repo config file
  7. Save, validate JSON, restart ZCode, log in again

πŸ§ͺ Advanced Troubleshooting

Symptom Solution
Empty apiKey after login Close ZCode, re-authenticate through UI
Auth window opens/closes instantly Check popup blockers; try different default browser
Provider still broken Delete entire provider block; let ZCode recreate it
Cache corruption delete coding-plan-cache.json, re-login
Wrong auth mode Ensure setting.json has zai family mode = oauth not api-key

βœ… Official Fix Recommendations

Immediate (Hotfix)

Patch the logout flow to NOT move models to deletedModels:

// CURRENT (BROKEN):
function logoutCodingPlan(provider) {
  provider.models = {};
  provider.zcode.deletedModels = Object.keys(provider.models);
}

// PROPOSED FIX:
function logoutCodingPlan(provider) {
  // Clear session/auth only, preserve model definitions
  provider.apiKey = "";
  delete provider.zcode?.deletedModels;
}
Short-Term (Next Release)
  1. Validate provider state on login β€” auto-migrate if models empty but deletedModels exists
  2. Add Repair Provider button in Settings β†’ Z.ai β†’ Troubleshoot
  3. Show meaningful error instead of silent failure when provider broken
Long-Term (Architecture)
  1. Separate provider configuration from session state
  2. Server-side model list β€” fetch from API on login instead of cached config
  3. Config validation β€” detect corruption and offer repair on startup

πŸ“Š Impact Assessment

Metric Value
Severity HIGH β€” Complete feature blockage
Affected Users All Coding Plan users who updated/logout (widespread)
Platforms macOS, Linux, Windows
Workaround Available Yes (community script by @megamen32)
Official Fix Effort Small (logout logic patch)

πŸ™ Acknowledgments


Submitted by:
Regards,
Roman (Discord: bignavi_x)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up β€” it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the community repository's zcode_fix.py, config.zai-coding-plan.json, and README.md to understand the reported config corruption and affected providers. Then locate the ZCode logout and provider-login entry points; done means logout preserves model definitions, login restores a usable provider, and the empty-model/deletedModels case is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.