-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Prerequisites
- I will write this issue in English (see our Language Policy)
- I have searched existing issues to avoid duplicates
- I am using the latest version of oh-my-opencode
- I have read the documentation or asked an AI coding agent with this project's GitHub URL loaded and couldn't find the answer
Bug Description
When a category has no entry in CATEGORY_MODEL_REQUIREMENTS (e.g. solana-re, solana-develop, or any user-defined category), the variant from oh-my-opencode.json user category config is silently dropped. The delegated task runs with the correct model but variant: undefined, falling back to the provider default reasoning effort instead of the configured one.
Steps to Reproduce
- Configure a custom category with a variant in
oh-my-opencode.json:
```json
{
"categories": {
"solana-re": { "model": "codex/gpt-5.2-codex", "variant": "xhigh" }
}
}
``` - Trigger a delegation with `category="solana-re"`
- Observe the child session uses `variant: undefined` (defaults to medium) instead of `xhigh`
Expected Behavior
The delegated task should use `variant: "xhigh"` as configured in `categories.solana-re.variant`.
Actual Behavior
The delegated task uses `variant: undefined` because `categoryModel` is never built with variant in the `!requirement` branch.
Root Cause
In `src/tools/delegate-task/category-resolver.ts`, the `resolveCategoryExecution()` function has two branches:
```typescript
if (!requirement) {
// Categories WITHOUT CATEGORY_MODEL_REQUIREMENTS entry
actualModel = explicitCategoryModel ?? overrideModel ?? resolved.model;
if (actualModel) {
modelInfo = ...;
}
// ❌ categoryModel is NEVER set here — variant is lost
} else {
// Categories WITH CATEGORY_MODEL_REQUIREMENTS entry
const parsedModel = parseModelString(actualModel);
const variantToUse = userCategories?.[args.category]?.variant ?? resolvedVariant ?? resolved.config.variant;
categoryModel = parsedModel ? variantToUse ? { ...parsedModel, variant: variantToUse } : parsedModel : undefined;
// ✅ categoryModel includes variant
}
```
The fallback at the bottom then creates `categoryModel` from `parseModelString(actualModel)` alone — without variant.
Suggested Fix
Build `categoryModel` with variant inside the `!requirement` branch, mirroring the `requirement` branch logic:
```typescript
if (!requirement) {
actualModel = explicitCategoryModel ?? overrideModel ?? resolved.model;
if (actualModel) {
modelInfo = ...;
const parsedModel = parseModelString(actualModel);
const variantToUse = userCategories?.[args.category]?.variant ?? resolved.config.variant;
categoryModel = parsedModel
? variantToUse ? { ...parsedModel, variant: variantToUse } : parsedModel
: undefined;
}
} else {
```
Verification
I patched `dist/index.js` locally with the above fix and confirmed via instrumented logging that:
- Before patch: `HTTP_prompt_async | variant=undefined`
- After patch: `HTTP_prompt_async | variant=xhigh` → `LLM.stream | resolved={"reasoningEffort":"xhigh"}`
Environment
- oh-my-opencode: latest (installed via npm)
- OpenCode: dev branch (custom build)
- OS: macOS (Apple Silicon)