fix(cli): return a typed 422 for commit-message with no changes - #12033
Merged
Conversation
A plain Error thrown when no changes are found became an untyped defect through EffectBridge.fromPromise, which the error middleware masked as a generic 500 "Unexpected server error". Declare a CommitMessageNoChangesError (Schema.ErrorClass, httpApiStatus 422) on the endpoint and translate the domain NoChangesError defect into that typed failure, so the real message surfaces. The extension now shows it directly instead of prepending a redundant prefix.
johnnyeric
approved these changes
Jul 8, 2026
Contributor
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (9 files)
Note: Fix these issues in Kilo Cloud Reviewed by claude-sonnet-5-20260630 · Input: 44 · Output: 14.1K · Cached: 1.7M Review guidance: REVIEW.md from base branch |
chrarnoldus
approved these changes
Jul 8, 2026
5 tasks
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
…-Org#12033) A plain Error thrown when no changes are found became an untyped defect through EffectBridge.fromPromise, which the error middleware masked as a generic 500 "Unexpected server error". Declare a CommitMessageNoChangesError (Schema.ErrorClass, httpApiStatus 422) on the endpoint and translate the domain NoChangesError defect into that typed failure, so the real message surfaces. The extension now shows it directly instead of prepending a redundant prefix.
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.
When generating a commit message with nothing to commit (nothing staged, or only lock files which are filtered out), the user saw a generic
Unexpected server error. Check server logs for details.(HTTP 500) instead of a clear, actionable message.Why
generate.tsthrows a plainError("No changes found to generate a commit message for"). The HTTP handler wraps it viaEffectBridge.fromPromise, but Effect maps unhandled promise rejections to Dies, so the plain error becomes an untyped defect. The error middleware treats untyped defects as 500 and masks the message, leaving the user with no idea why generation failed.The correct pattern for this API surface is to declare an explicit
Schema.ErrorClasson the endpoint and fail with that typed error so it surfaces as a real HTTP status with the actual message.What changed
CommitMessageNoChangesError(Schema.ErrorClass,httpApiStatus: 422,{ message }) on the commit-message endpoint error contract alongside the existingHttpApiError.BadRequest.Erroringenerate.tswith a recognizableNoChangesErrordomain class, so the handler can distinguish it from unexpected defects.EffectBridge.fromPromise(preserves Kilo instance/workspace contexts across the callback) and addEffect.catchDefectto translate theNoChangesErrordefect into the typedCommitMessageNoChangesErrorfailure (422). Unexpected defects are re-died so they still surface as masked 500s, which is correct for truly unexpected errors.Failed to generate commit message:prefix that doubled up the wording.CommitMessageNoChangesErrorand the 422 status are part of the typed client contract.All changes are in Kilo-owned paths (
packages/opencode/src/kilocode/,packages/kilo-vscode/); no shared upstream files were touched.