fix(coding-agent): request low reasoning for session title generation - #1266
fix(coding-agent): request low reasoning for session title generation#1266ImStillBlue wants to merge 2 commits into
Conversation
Unset reasoning on the background title request made token-based
providers fall back to their disabled mapping (reasoning:
{ effort: "none" } on OpenRouter-format models). Reasoning-mandatory
endpoints such as Z.ai GLM 5.x reject that with HTTP 400 'Reasoning is
mandatory for this endpoint and cannot be disabled.', surfacing as a
repeated session_title_generation runtime error in every session on
those models. Ask for low reasoning explicitly and raise maxTokens so
reasoning tokens leave room for the <title> output.
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…ry errors Review follow-up: forcing reasoning: "low" on every title call taxes all reasoning-capable models on a cosmetic background call, and some catalogs map low to full effort (DeepSeek low -> "high" in openai-completions.ts). Keep the default request reasoning-free and instead retry once with low reasoning + maxTokens 1024 only when the provider answers with the reasoning-mandatory 400. Healthy endpoints keep the zero-reasoning path.
|
Valid review — pushed 94960ba addressing it. Confirmed both claims: Redesign per your suggestion: the default title request stays reasoning-free with Validation: |
Summary
The background session-title request left
reasoningunset inbuildTitleOptions(). For reasoning-capable models, pi-ai's OpenAI-completions layer then fills the gap with the provider's "disabled" mapping — on OpenRouter-format models that isreasoning: { effort: "none" }. Endpoints that mandate reasoning (observed with Z.ai GLM 5.x models, e.g.z-ai/glm-5.3-flash) reject that with:Regular agent turns are unaffected because they always carry the session's thinking level — only the background title call (and therefore every fresh session on such a model) failed. The same behavior is publicly documented against OpenRouter in openclaw#24851.
What changed
packages/coding-agent/src/core/session-title-generator.ts—buildTitleOptions()now sendsreasoning: "low"explicitly, and raisesmaxTokensfrom 64 to 1024 so low-effort reasoning tokens don't consume the budget needed for the<title>output on token-based providers.packages/coding-agent/test/session-title-generator.test.ts— deterministic regression test asserting the title request carriesreasoning: "low"andmaxTokens: 1024via a fakestreamFn(no network, no tokens).packages/coding-agent/src/core/changes.md— fork-ledger entry per the changes.md contract.Non-reasoning models are unaffected: pi-ai clamps the level per model and the OpenRouter reasoning branch only fires for
model.reasoning === true.Validation
bunx vitest run test/session-title-generator.test.ts— 12/12 pass (including the new regression test).bun run check— pass (Biome, pinned-deps, ts-imports, shrinkwrap, install-lock, claude-sdk-platform-lock,tsc --noEmit, browser-smoke).omo5.0.0-0.beta.31 / senpi 2026.8.31: patchingbuildTitleOptionsthe same way eliminated the recurringsession_title_generation400 on OpenRouterz-ai/glm-5.3-flashsessions.Residual risk
maxTokens: 1024). An alternative would be retrying with a low effort only when the endpoint rejects disabled reasoning, but the simple explicit level avoids a second round trip for a known-broken class of endpoints.Summary by cubic
Fixes session title generation on reasoning-mandatory endpoints by retrying once with low reasoning when the provider rejects the default reasoning-free title request, so new sessions on models like Z.ai GLM 5.x no longer fail with a 400 error.
maxTokens: 64, so healthy endpoints pay no reasoning cost.reasoning: "low"andmaxTokens: 1024, leaving room for the<title>output once reasoning tokens count against the budget.Written for commit 94960ba. Summary will update on new commits.