Skip to content

fix(kb): fall back to Zcode GLM-5.3 when Claude Code is unavailable - #287

Merged
tzhouam merged 1 commit into
mainfrom
fix/kb-generator-zcode-fallback
Oct 2, 2026
Merged

tzhouam merged 1 commit into
mainfrom
fix/kb-generator-zcode-fallback

Conversation

@tzhouam

@tzhouam tzhouam commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

The knowledge updater repeatedly receives a Claude Code account-hold response and leaves upstream PR events queued. Add an opt-in KB_GENERATOR_FALLBACK=zcode:GLM-5.3 so generation tries the pinned Zcode model once when CC is unavailable, while Codex remains the judge.

Every attempt records the actual model and fallback origin; intake, refinement, and sweep changes record the generator that supplied the accepted draft, and rebuilds preserve that attribution. Both-generator failures keep events queued. Schema repair and calls with reserved spend thresholds retain their existing behavior.

Validation: 184 targeted offline tests passed. Both GitHub CI runs passed, including the full unit suite, packaged wheel checks, and document/SPEC/knowledge validators. Live checks confirmed CC account hold followed by Zcode serving GLM-5.3; the restarted KB updater has also recorded successful GLM-5.3 calls from its real event queue.

The new wheel is deployed to the KB service with KB_GENERATOR_FALLBACK=zcode:GLM-5.3. Snapshot activation remains subject to the existing provenance gate.

@tzhouam
tzhouam marked this pull request as ready for review October 2, 2026 02:21
@tzhouam
tzhouam merged commit ca12c56 into main Oct 2, 2026
2 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T02:23:29.034370Z 885e18d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 885e18dfb5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +142 to +145
logger.warning("Knowledge generator %s unavailable; trying configured fallback %s",
role.label(), role.fallback.label())
try:
return self._call_json(role.fallback, fallback_from=role.label(), **kwargs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recheck subscription billing before dispatching the fallback

When kb init runs with --subscription-generator, generate() verifies subscription_billing() only for the primary role and then calls this method without a spend threshold. If that primary fails and the fallback is Zcode configured through ZCODE_PROVIDER_ID to use a custom API provider, ZCodeTransport.subscription_billing is false, but this branch dispatches it anyway without reserving or charging the initialization budget. Preserve the verified billing mode for the fallback, or disable fallback on this path unless its transport also passes subscription_billing().

Useful? React with 👍 / 👎.

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