Skip to content

feat: auto reasoning effort with suffix#1515

Merged
looplj merged 1 commit into
unstablefrom
dev-tmp
Apr 27, 2026
Merged

feat: auto reasoning effort with suffix#1515
looplj merged 1 commit into
unstablefrom
dev-tmp

Conversation

@looplj

@looplj looplj commented Apr 27, 2026

Copy link
Copy Markdown
Owner

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

devin-ai-integration[bot]

This comment was marked as resolved.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the "Auto Reasoning Effort" feature, which normalizes model names with suffixes like -xhigh or -max into a base model name and an associated reasoning_effort value. The changes include a new UI setting, backend schema updates, and a middleware component in the orchestration pipeline, along with specific handling for DeepSeek models in the Anthropic transformer. Feedback suggests ensuring the middleware respects explicitly provided reasoning_effort values as documented, removing unused fields and parameters in the new middleware, and cleaning up redundant logic in the model splitting function.


originalModel := llmRequest.Model
llmRequest.Model = baseModel
llmRequest.ReasoningEffort = reasoningEffort

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The implementation currently overrides llmRequest.ReasoningEffort unconditionally. However, the documentation in internal/server/biz/system.go (line 260) states that the suffix should only be applied if the request did not already specify reasoning_effort explicitly. To align with the intended behavior, you should check if ReasoningEffort is empty before assigning the value from the suffix.

if llmRequest.ReasoningEffort == "" {
		llmRequest.ReasoningEffort = reasoningEffort
	}

type autoReasoningEffortMiddleware struct {
pipeline.DummyMiddleware

inbound *PersistentInboundTransformer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The inbound field is not used anywhere in the autoReasoningEffortMiddleware struct or its methods. It should be removed to keep the struct clean.

Comment on lines +21 to +25
func applyAutoReasoningEffort(inbound *PersistentInboundTransformer, systemService *biz.SystemService) pipeline.Middleware {
return &autoReasoningEffortMiddleware{
inbound: inbound,
systemService: systemService,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The inbound parameter is unused in the middleware implementation. You should remove it from the function signature and the struct initialization.

func applyAutoReasoningEffort(systemService *biz.SystemService) pipeline.Middleware {
	return &autoReasoningEffortMiddleware{
		systemService: systemService,
	}
}

Comment on lines +79 to +81
if base == "" {
return "", "", false
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This check is redundant. The condition lastDash <= 0 at line 69 already ensures that base (which is model[:lastDash]) will not be empty if the function proceeds to this point. If lastDash is 0, the function returns early.

// Add inbound middlewares (executed after inbound.TransformRequest)
middlewares = append(middlewares,
enforceQuota(inbound, processor.QuotaService),
applyAutoReasoningEffort(inbound, processor.SystemService),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If the inbound parameter is removed from applyAutoReasoningEffort as suggested, the call site here should be updated accordingly.

Suggested change
applyAutoReasoningEffort(inbound, processor.SystemService),
applyAutoReasoningEffort(processor.SystemService),

Comment on lines +115 to +125
name: "suffix reasoning effort overrides explicit request value",
settings: biz.SystemModelSettings{
AutoReasoningEffort: true,
},
request: &llm.Request{
Model: "gpt-5.4-xhigh",
ReasoningEffort: "high",
},
wantModel: "gpt-5.4",
wantEffort: "xhigh",
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If the middleware is updated to respect explicit ReasoningEffort values (as suggested in auto_reasoning_effort.go), this test case should be updated to reflect that the explicit value high should be preserved instead of being overridden by xhigh.

Suggested change
name: "suffix reasoning effort overrides explicit request value",
settings: biz.SystemModelSettings{
AutoReasoningEffort: true,
},
request: &llm.Request{
Model: "gpt-5.4-xhigh",
ReasoningEffort: "high",
},
wantModel: "gpt-5.4",
wantEffort: "xhigh",
},
{
name: "explicit reasoning effort is preserved over suffix",
settings: biz.SystemModelSettings{
AutoReasoningEffort: true,
},
request: &llm.Request{
Model: "gpt-5.4-xhigh",
ReasoningEffort: "high",
},
wantModel: "gpt-5.4",
wantEffort: "high",
},

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@looplj looplj merged commit c4f89d9 into unstable Apr 27, 2026
5 checks passed
looplj added a commit that referenced this pull request May 23, 2026
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