For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Preserve the existing unknown third-party GLM image fail-closed behavior while leaving unknown glm-5.2-* suffixed variants fail-open without encoding any private identifier.
Architecture: Keep capability precedence and the existing GLM-family matcher unchanged. Add a public structural predicate in the bootstrap capability resolver, normalize only the final provider-visible model ID segment before matching a non-empty hyphen suffix, then cover the fallback boundary with neutral unit fixtures and keep N08 scoped to its explicit text-only E2E contract.
Tech Stack: TypeScript, Vitest, ZCode Protocol model catalog, conversation-session case catalog and coverage audit.
supportsImages: true and supportsImages: false precedence unchanged.GLM-5.2-variant.Files:
docs/conversation-session-case-catalog.md:275docs/testing/conversation-session-e2e-coverage-matrix.md:176Interfaces:
docs/superpowers/specs/2026-07-10-glm-52-suffixed-variant-media-fallback-design.md.Produces: an accepted explicit text-only GLM-5.2 provider-visible strip contract without claiming that the E2E covers the unknown provider-aware fallback.
[ ] Step 1: Update the N08 catalog row before code
Replace the N08 event text with:
用户切到第三方、明确声明 text-only 的 GLM-5.2 后继续发送
Keep the existing provider-visible placeholder expectation, then add this paragraph immediately after the N table:
N08 只覆盖明确声明 text-only 时的 provider-visible 媒体投影合同。能力 unknown 时,canonical `GLM-5.2` 触发 fail-closed、`GLM-5.2-*` suffixed variant 保持 unknown 的边界由 bootstrap capability unit test 覆盖;unknown 不被 capability projection 主动 strip 的语义由 core media capability unit test 覆盖,后续仍受统一 media-budget projection 约束。
Replace the N08 note with:
completed 历史含图片后切到第三方、明确声明 text-only 的 GLM-5.2,后续 provider-visible 请求把历史图片替换为 placeholder,且不携带 image block/data URL
Run:
node scripts/audit-conversation-session-case-coverage.mjs --check --json
Expected: exit code 0 and no stale catalog/matrix coverage error for N08.
Files:
apps/zcode-cli/packages/bootstrap/tests/model-selection.test.ts:136-220Interfaces:
resolveRuntimeModelInputCapabilities(modelRef, modelCatalog).Produces: regression coverage proving suffixed GLM-5.2 variants stay unknown while canonical and other GLM-family models remain fail-closed.
[ ] Step 1: Add a failing suffixed-variant test
Add inside describe("resolveRuntimeModelInputCapabilities", ...):
it.each([
"GLM-5.2-variant",
"vendor/GLM-5.2-variant",
"GLM-5.2-variant[1m]",
])("keeps unknown suffixed GLM-5.2 variant capability unknown for %s", (modelId) => {
expect(
resolveRuntimeModelInputCapabilities(
{ providerId: "custom-glm", modelId },
{ overrides: {} },
),
).toBeUndefined();
});
Add:
it.each(["GLM-5.2", "vendor/GLM-5.2", "GLM-5.2[1m]", "GLM-5.2-[1m]"])(
"keeps canonical GLM-5.2 image-unsupported for unknown non-official provider %s",
(modelId) => {
expect(
resolveRuntimeModelInputCapabilities(
{ providerId: "custom-glm", modelId },
{ overrides: {} },
),
).toEqual({ supportsImages: false });
},
);
Retain the existing GLM-5.1 and private-glm-next assertions unchanged.
Also assert that GLM-5.2-variant/other-model remains image-unsupported, proving a matching non-final path segment cannot trigger the exception. Cover explicit supportsImages: true and supportsImages: false on the neutral suffixed variant so capability precedence is locked down.
Run:
pnpm --filter @zcode/bootstrap exec vitest run tests/model-selection.test.ts
Expected: the three neutral suffixed-variant cases fail because the current broad GLM fallback returns { supportsImages: false }; existing tests remain green.
Files:
apps/zcode-cli/packages/bootstrap/src/app/model-input-capabilities.ts:1-179apps/zcode-cli/packages/bootstrap/tests/model-selection.test.tsInterfaces:
normalizeModelIdForProviderRequest(modelId: string): string from @zcode/adapters/model.Produces: isGlm52SuffixedVariant(modelId: string): boolean, used only by the provider-aware media fallback.
[ ] Step 1: Import provider-request model ID normalization
Extend the existing @zcode/adapters/model import with:
normalizeModelIdForProviderRequest,
Near the existing GLM provider-side media constants, add:
const GLM_5_2_SUFFIXED_VARIANT_PATTERN = /^glm-5\.2-.+$/i;
After isGlmFamilyModelId, add:
function isGlm52SuffixedVariant(modelId: string): boolean {
const finalModelIdSegment = modelId.trim().split("/").filter(Boolean).at(-1);
return finalModelIdSegment
? GLM_5_2_SUFFIXED_VARIANT_PATTERN.test(
normalizeModelIdForProviderRequest(finalModelIdSegment),
)
: false;
}
In applyProviderAwareMediaFallback, insert the exception after the existing GLM-family check and before the official-provider check:
if (isGlm52SuffixedVariant(modelRef.modelId)) return;
Add the required Chinese bug-cause comment immediately above it:
// 修复原因:最终模型 ID 段为 `glm-5.2-*` 时代表独立于 canonical `glm-5.2` 的真实变体;
// 仅凭共享的 GLM 家族命名,不能把未声明的图片能力判定为不支持。
Run:
pnpm --filter @zcode/bootstrap exec vitest run tests/model-selection.test.ts
Expected: all model-selection tests pass, including the new neutral suffixed-variant and canonical normalization cases.
Run:
pnpm --filter @zcode/core exec vitest run tests/media-capability.test.ts
Expected: all tests pass; explicit false still strips, while unknown remains unchanged by capability projection before the separate media-budget projection runs.
Files:
apps/zcode-cli/packages/bootstrap/src/zcode-protocol/workspace-model-catalog.ts:964-1056apps/zcode-cli/packages/bootstrap/tests/zcode-protocol.test.ts:3964-4141Interfaces:
resolveRuntimeModelInputCapabilities(...) and AgentRuntime.updateConfig(...) property-presence semantics.Produces: a ProviderModelLimits patch that explicitly carries modelInputMediaCapabilities: undefined when a newer registry revision removes the previous media capability facts.
[ ] Step 1: Write the failing active-session refresh test
Add a parameterized protocol integration test using the neutral model ID GLM-5.2-variant, with independent cases for supportsImages and supportsPdf. Create the session while the capability is unknown, update a second registry revision to { [capabilityKey]: false } so the fake runtime holds the same old state as production, then let a third revision omit the capability. Capture the runtime config patch and assert:
expect(runtimeModelInputMediaCapabilities).toEqual({ [capabilityKey]: false });
expect(runtimeUpdateConfig).toHaveBeenLastCalledWith({
contextWindow: undefined,
maxOutputTokens: undefined,
modelInputMediaCapabilities: undefined,
});
const lastPatch = runtimeUpdateConfig.mock.lastCall?.[0];
expect(Object.hasOwn(lastPatch ?? {}, "modelInputMediaCapabilities")).toBe(true);
expect(runtimeModelInputMediaCapabilities).toBeUndefined();
Run:
pnpm --filter @zcode/bootstrap exec vitest run tests/zcode-protocol.test.ts -t "clears active session"
Expected: both parameterized cases FAIL because the current patch omits modelInputMediaCapabilities, leaving each captured runtime value at { [capabilityKey]: false }.
ProviderModelLimitsMake modelInputMediaCapabilities a required property whose value may be undefined, then return it unconditionally:
interface ProviderModelLimits {
contextWindow?: number;
maxOutputTokens?: number;
modelInputMediaCapabilities: ModelInputMediaCapabilities | undefined;
}
return {
contextWindow: positiveInteger(model.contextWindow),
maxOutputTokens: positiveInteger(model.maxOutputTokens),
modelInputMediaCapabilities,
};
Add a Chinese bug-cause comment explaining that AgentRuntime.updateConfig(...) relies on property presence to clear stale false values when capabilities become unknown.
If resolveProviderModelLimits(...) cannot find the model, return { modelInputMediaCapabilities: undefined } so the required patch shape remains type-safe.
Run:
pnpm --filter @zcode/bootstrap exec vitest run tests/zcode-protocol.test.ts -t "clears active session"
Expected: PASS; the patch includes the key and the captured runtime capability becomes undefined.
Run:
pnpm --filter @zcode/bootstrap exec vitest run tests/zcode-protocol.test.ts -t "refreshes active session context window when provider registry changes the current model|clears active session"
Expected: both active-session refresh tests pass, including context/max-token clearing and media-capability clearing.
Files:
Interfaces:
Produces: focused, E2E-contract, type, lint, and whitespace evidence for handoff.
[ ] Step 1: Check the existing N08 fixture contract
Run:
pnpm --filter @zcode/desktop e2e:fixture:check -- --spec ./test/e2e/conversation-session/models/conversation-session-model-switch-image-strip.test.ts
Expected: fixture check passes; the explicit text-only GLM-5.2 request contract remains complete.
Run:
pnpm --filter @zcode/desktop typecheck:e2e
Expected: exit code 0.
Run:
pnpm --filter @zcode/bootstrap typecheck
pnpm typecheck
pnpm lint
Expected: all commands exit 0. If an unrelated dirty-worktree failure occurs, record the exact file and error separately without modifying unrelated work.
Run:
node scripts/audit-conversation-session-case-coverage.mjs --check --json
git diff --check -- apps/zcode-cli/packages/bootstrap/src/app/model-input-capabilities.ts apps/zcode-cli/packages/bootstrap/src/zcode-protocol/workspace-model-catalog.ts apps/zcode-cli/packages/bootstrap/tests/model-selection.test.ts apps/zcode-cli/packages/bootstrap/tests/zcode-protocol.test.ts docs/conversation-session-case-catalog.md docs/testing/conversation-session-e2e-coverage-matrix.md docs/superpowers/specs/2026-07-10-glm-52-suffixed-variant-media-fallback-design.md docs/superpowers/plans/2026-07-10-glm-52-suffixed-variant-media-fallback.md
Expected: audit and diff check exit 0.
Confirm the final diff contains only public GLM-5.2-* structural semantics and no private identifier. Do not stage or commit.