Repository navigation
feat(codex): choose reasoning effort and fast mode per turn - #8
Merged
Merged
Conversation
Codex's model/list reports each model's supported reasoning efforts and service tiers, but the app only read id and name, and turn/start carried neither setting, so the thinking chip never appeared for Codex and fast mode could not be turned on. - CodexModels fills variants from supportedReasoningEfforts (server order) and records the fast tier, its description, and each model's default effort and service tier - every turn sends explicit effort and serviceTier: the app-server applies them to subsequent turns too, so an omitted value would silently keep the previous turn's (resolveCodexTurnSettings) - a global fast-mode choice (null = follow each model's default) is persisted and exposed to the chat as fastModeAvailable/Enabled - composer gets a Fast chip next to the thinking chip; labels for the none/minimal/ultra efforts in all locales - verified against codex 0.163.0 generated app-server types and a live model/list response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Codex could not set reasoning effort or fast mode:
model/listwas read for id/name only andturn/startcarried neither setting.CodexModelsfillsvariantsfromsupportedReasoningEfforts(server order), and records the fast tier (serviceTiers"Fast"/priority, fallbackadditionalSpeedTiers), its description, and each model'sdefaultReasoningEffort/defaultServiceTiereffortandserviceTier(resolveCodexTurnSettings): the app-server applies both to subsequent turns as well, so omitting them would keep the previous turn's value (e.g.ultracarried onto another model, or fast left on after switching to a model without it)codexFastMode: Boolean?(null = follow each model's default), persisted;ChatUiState.fastModeAvailable/Enabled/Description,ChatViewModel.setFastMode; wired in both the AndCodeApp factory and Koinnone/minimal/ultra; small fast marker in the model picker; strings in all 8 localesCodexModelsTest(real 0.163.0 shape),CodexTurnStartParamsTest,CodexServiceTierTest,ChatViewModelTestfast casescodex app-server generate-ts+ a livemodel/list)Follow-up (not in this PR): a way to return fast mode to "follow model default" from the UI, and/or per-model storage.
Note: written without a local JDK; CI is the first compile.
Pre-PR review
Final review (approved at the brace fix). Earlier rounds requested changes: test package for
codexServiceTier, explicit per-turn effort/serviceTier, then a brace mismatch inCodexTarget.sendMessage; all fixed. The one follow-up commit after approval applies the reviewer's first suggestion only (setmodelsRefreshedon success).判定: APPROVE
ブロッカー
なし
提案(非ブロッキング)
modelsRefreshedは CodexTarget インスタンスの生存期間中ずっと立ったままです。このインスタンスは AndCodeApplication で1つだけ作られ、アプリ終了まで残ります。そのため、最初の再取得が失敗すると(app-server の起動直後など)、その後は1度も再取得しません。listProvidersが呼ばれればknownModelsが埋まるので、実害は小さいです。runCatching { ... }.onSuccess { modelsRefreshed = true })。あるいはlistProvidersが成功したタイミングでリセットする方法もあります。チェック済み項目
git diff/git statusと Gradle は実行していません。変更箇所は grep と Read で追跡しました。sendMessageは 269 行目でwithContextを閉じ、270 行目で関数本体を閉じています。resolveKnownModelはクラスのメンバー関数です。refreshModelsへの参照が残っていないことを grep で確認しました。var modelはOpenCodeModel?型として推論されます。runtime.modelList()は suspend 関数で、withContextのブロック内(suspend 文脈)から呼ばれています。(modelId ?: knownDefaultModelId)?.let(knownModels::get)は、bound reference でMap<String, OpenCodeModel>.getを指しており、正しい形です。@Volatile private varはクラスのメンバーなので有効です。knownDefaultModelIdが埋まり、その後のresolveKnownModelで既定モデルが解決されます。turn/startのmodelは従来どおりrequest.modelIdを送ります。モデルを指定しない場合は Codex 側の既定モデルに任せます。resolveCodexTurnSettingsの決め方と、それに対応するテストは前回確認した内容から変わっていません。CodexTurnSettingsの KDoc(CodexRuntime.kt:672)が型と一致していることを確認しました(effortだけが nullable)。isDefaultが生成型で確認済みであることが書かれていることを確認しました。CodexServiceTierTestのパッケージ、ChatViewModelTest の fast 関連ケース、PromptRequest が OpenCode に漏れないこと、OpenCodeModel の新フィールドの既定値です。