Skip to content

fix(cli): surface commit-message generation errors - #13108

Merged
johnnyeric merged 1 commit into
mainfrom
johnnyeric/commit-message-surface-errors
Aug 13, 2026
Merged

fix(cli): surface commit-message generation errors#13108
johnnyeric merged 1 commit into
mainfrom
johnnyeric/commit-message-surface-errors

Conversation

@johnnyeric

@johnnyeric johnnyeric commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Issue

N/A — surfaces real commit-message generation errors instead of masking them behind generic 500s.

Context

The SCM generate-commit-message button often fails with Unexpected server error. Check server logs for details. Timeouts, provider errors, and auth failures all die as untyped defects and get masked as HTTP 500. The backend already knows the real reason; the toast does not.

This change maps those generation Errors to a typed 422 so the existing VS Code client shows the real message. It does not raise the 30s timeout or make slow small models finish.

Implementation

Follows the same pattern as the no-changes 422 from #12033. POST /commit-message now declares CommitMessageFailedError and the handler translates any remaining Error defect (after NoChangesError) into that typed failure.

The extension already displays getErrorMessage(error), so no VS Code package change is required. JetBrains and TUI do not call this endpoint.

Screenshots / Video

N/A — toast copy only, no visual layout change.

How to Test

Manual/local verification

  • Isolated HTTP test: bun run test commit-message-no-changes.test.ts from packages/opencode (2 pass)
  • Typecheck: bun turbo typecheck (30 packages passed)
  • SDK generation: ./script/generate.ts executed cleanly from repository root
  • Reproduced before/after against POST /commit-message:
    • before: HTTP 500 UnknownError / Check server logs for details
    • after: HTTP 422 { "message": "Commit message generation timed out after 30 seconds" } or { "message": "Failed to generate commit message: provider rate limited" }

Reviewer test steps

  1. Stage some files in a git repo and click the Kilo SCM generate-commit-message button.
  2. On a timeout or provider failure, the toast should show the real reason, not Check server logs for details.
  3. With no staged or unstaged changes, the toast should still say No changes found to generate a commit message for.

Blocked checks and substitute verification

  • The VS Code vitest spec was not run; no extension source changed.

Checklist

  • Issue linked above, or exception explained
  • Tests/verification described
  • Screenshots/video included for visual changes, or marked N/A
  • Changeset considered for user-facing changes
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

Get in Touch

@johnnyeric
johnnyeric marked this pull request as ready for review August 13, 2026 17:21
@kilo-code-bot

kilo-code-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/server/httpapi/handlers/commit-message.ts 32 Catch-all Error → 422 mapping has no server-side logging, so timeouts and unexpected bugs become silent client-facing failures that were previously visible as logged 500s (carried forward, still open)
Files Reviewed (6 files)
  • .changeset/commit-message-surface-errors.md - 0 issues
  • packages/opencode/src/kilocode/server/httpapi/groups/commit-message.ts - 0 issues
  • packages/opencode/src/kilocode/server/httpapi/handlers/commit-message.ts - 1 issue
  • packages/opencode/test/kilocode/server/commit-message-no-changes.test.ts - 0 issues
  • packages/sdk/js/src/v2/gen/types.gen.ts - 0 issues (generated, drift covered by CI)
  • packages/sdk/openapi.json - 0 issues (generated, drift covered by CI)

Incremental review since 1ecee38: the only change is removal of the unrelated --worktree docs line from cli-reference.md, which resolves the previous docs suggestion — the file is no longer in the PR. The handler, group, and test changes are unchanged and the previously raised logging suggestion remains open. No memory leaks introduced — the AbortController/setTimeout lifecycle is unchanged and cleaned up in finally.

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit 1ecee38)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 1ecee38)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/server/httpapi/handlers/commit-message.ts 32 Catch-all Error → 422 mapping has no server-side logging, so timeouts and unexpected bugs become silent client-facing failures that were previously visible as logged 500s (carried forward, still open)
packages/kilo-docs/pages/code-with-ai/platforms/cli-reference.md 142 New --worktree docs line is unrelated to this PR's stated purpose; content is accurate but consider splitting it out or noting the intent
Files Reviewed (7 files)
  • .changeset/commit-message-surface-errors.md - 0 issues
  • packages/kilo-docs/pages/code-with-ai/platforms/cli-reference.md - 1 issue
  • packages/opencode/src/kilocode/server/httpapi/groups/commit-message.ts - 0 issues
  • packages/opencode/src/kilocode/server/httpapi/handlers/commit-message.ts - 1 issue
  • packages/opencode/test/kilocode/server/commit-message-no-changes.test.ts - 0 issues
  • packages/sdk/js/src/v2/gen/types.gen.ts - 0 issues (generated, drift covered by CI)
  • packages/sdk/openapi.json - 0 issues (generated, drift covered by CI)

Incremental review since 11f43cd: the only new change is the unrelated --worktree docs line; the handler, group, and test changes are unchanged and the previously raised logging suggestion remains open. No memory leaks introduced — the AbortController/setTimeout lifecycle is unchanged and cleaned up in finally.

Fix these issues in Kilo Cloud

Previous review (commit 11f43cd)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/opencode/src/kilocode/server/httpapi/handlers/commit-message.ts 32 Catch-all Error → 422 mapping has no server-side logging, so timeout errors, pre-try errors, and unexpected bugs become silent client-facing failures that were previously visible as logged 500s
Files Reviewed (6 files)
  • .changeset/commit-message-surface-errors.md - 0 issues
  • packages/opencode/src/kilocode/server/httpapi/groups/commit-message.ts - 0 issues
  • packages/opencode/src/kilocode/server/httpapi/handlers/commit-message.ts - 1 issue
  • packages/opencode/test/kilocode/server/commit-message-no-changes.test.ts - 0 issues
  • packages/sdk/js/src/v2/gen/types.gen.ts - 0 issues (generated, drift covered by CI)
  • packages/sdk/openapi.json - 0 issues (generated, drift covered by CI)

The change is small, well-scoped, and follows the existing NoChangesError pattern. The new test exercises the real wrapping logic in generateCommitMessage (mocks sit only at the LLM boundary) and restores spies in finally. No memory leaks introduced — the AbortController/setTimeout lifecycle is unchanged and cleaned up in finally. Changeset is present with user-facing wording.

Fix these issues in Kilo Cloud


Reviewed by kimi-k3 · Input: 89K · Output: 3.1K · Cached: 224.3K

Review guidance: REVIEW.md from base branch main

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11f43cd60b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@johnnyeric
johnnyeric force-pushed the johnnyeric/commit-message-surface-errors branch 2 times, most recently from 35629cf to 1ecee38 Compare August 13, 2026 17:45
Comment thread packages/kilo-docs/pages/code-with-ai/platforms/cli-reference.md Outdated
Map generation failures to a typed 422 so the SCM toast shows the real
timeout or provider error instead of a generic check-server-logs 500.
@johnnyeric
johnnyeric force-pushed the johnnyeric/commit-message-surface-errors branch from 1ecee38 to a57045c Compare August 13, 2026 17:52
@johnnyeric
johnnyeric merged commit 738163b into main Aug 13, 2026
47 of 49 checks passed
@johnnyeric
johnnyeric deleted the johnnyeric/commit-message-surface-errors branch August 13, 2026 18:27
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
Map generation failures to a typed 422 so the SCM toast shows the real
timeout or provider error instead of a generic check-server-logs 500.
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.

2 participants