Skip to content

fix(claude): omit --model in completeOneShot when alias resolves empty#3

Open
Antisophy wants to merge 2 commits into
CyberShadow:masterfrom
Antisophy:fix/completeoneshot-empty-model-alias
Open

fix(claude): omit --model in completeOneShot when alias resolves empty#3
Antisophy wants to merge 2 commits into
CyberShadow:masterfrom
Antisophy:fix/completeoneshot-empty-model-alias

Conversation

@Antisophy

@Antisophy Antisophy commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Problem

completeOneShot (title generation) passes --model resolveModelAlias(modelClass) unconditionally. An empty model_aliases entry makes resolveModelAlias return "", so it runs claude --model "" and fails with API Error 400 ("String should have at least 1 character"), surfacing as failed to generate title: claude exited with status 1. The session-spawn path already guards this (config.model.length > 0); completeOneShot is the one spot that doesn't.

Motivation

After Fable 5 was shut down I wanted cydo to stop pinning a model and instead defer to claude's own configured default, so it would fall back gracefully rather than stay pointed at an unavailable model. The way to express that is empty model_aliases entries, but that config wasn't actually runnable: completeOneShot passed --model "" and broke title generation on the next cydo task I started. This PR's change is what makes the empty-alias / defer-to-claude config work end to end.

Fix

Append --model only when the resolved model is non-empty (matching the session-spawn guard), and collapse the duplicated cmdPrefix / non-cmdPrefix arg lists into one.

the session spawn path guards with config.model.length > 0, letting an
empty model_aliases entry suppress the flag so claude falls back to its
own configured default; completeOneShot (used for title generation)
passed --model unconditionally, so an empty alias produced
`claude --model ""` which fails with API Error 400 ("String should
have at least 1 character") and surfaced as "failed to generate title:
claude exited with status 1"
@Antisophy Antisophy force-pushed the fix/completeoneshot-empty-model-alias branch 2 times, most recently from a48d9db to 5373e42 Compare June 25, 2026 02:17
completeOneShot spawns a process, so its argument list cannot be observed directly. Extract the arg construction into a pure static buildOneShotArgs and unit-test that an empty model alias omits --model while a real alias passes --model <x>. No behavior change.
@Antisophy Antisophy force-pushed the fix/completeoneshot-empty-model-alias branch from 5373e42 to 2130c33 Compare June 25, 2026 04:06
@Antisophy

Copy link
Copy Markdown
Contributor Author

Split into two commits so the behavior fix stands on its own: the first commit is just the --model omission, and the second extracts the argument construction into a pure static buildOneShotArgs and adds the unit test.

Reason for the extraction: completeOneShot spawns the claude process, so its argument list can't be observed from a unit test in place. Pulling the arg-building into a pure function lets the test assert that an empty alias omits --model (and a real alias still passes --model <x>) without launching anything. The extraction is behavior-preserving; the fix commit plus the refactor produce exactly the tree that was here before.

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