Skip to content

fix(cli): preserve Kilo gateway error statuses#10864

Merged
marius-kilocode merged 3 commits into
mainfrom
fix-10857-gateway-statuses
Jun 3, 2026
Merged

fix(cli): preserve Kilo gateway error statuses#10864
marius-kilocode merged 3 commits into
mainfrom
fix-10857-gateway-statuses

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

The OpenCode v1.14.42 migration removed the legacy Hono backend and made the Effect HttpApi handlers unconditional. Several Kilo gateway routes still normalized broad upstream failure classes into generic 400, 401, or 503 responses, which prevented clients from distinguishing authentication failures, missing sessions, rate limits, worker failures, and temporary server errors.

Preserve the upstream status and useful JSON error payload for cloud session list, preview, import, and KiloClaw status failures. Keep local missing-token failures as 401, retain cloud-session 404 responses, and map transport failures to the legacy 500 or 502 fallback while logging the original failure for diagnostics.

The raw HttpServerResponse path keeps arbitrary upstream statuses faithful without changing the declared HttpApi contract or weakening the successful cloud-preview schema passthrough.

Closes #10857

Comment thread packages/opencode/src/kilocode/server/httpapi/handlers/kilo-gateway.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No New Issues | Recommendation: Merge

Previous Suggestions — All Resolved

File Issue Status
kilo-gateway.ts logError used console.error instead of structured logger ✅ Fixed — now uses log.error() via Log.create
kilo-gateway.ts Effect.match success branch returned untyped response.json() ✅ Fixed — now validated with Schema.decodeUnknownPromise(ClawStatus)
kilo-gateway-statuses.test.ts globalThis.fetch mutation fragility note ✅ Addressed — comment added clarifying sequential execution assumption

New Changes (incremental)

Three new files changed since the last review:

  • public.ts — Adds nullable patches for profile, cloud-sessions, claw/status, and claw/chat-credentials response fields in the OpenAPI spec. Pattern is consistent with existing mutations in the same function.
  • httpapi-public.test.ts — Solid contract tests covering all newly-nullable fields across each gateway endpoint.
  • .changeset/nullable-kilo-gateway-sdk.md — User-facing changeset description is clear and appropriately concise.

The kilo-jetbrains i18n additions and kilo-vscode diff-viewer file-move refactor (agent-manager → diff-viewer directory) are mechanical with no logic changes.

Files Reviewed (6 files)
  • packages/opencode/src/kilocode/server/httpapi/handlers/kilo-gateway.ts - all previous issues resolved
  • packages/opencode/test/kilocode/server/kilo-gateway-statuses.test.ts - previous suggestion addressed
  • packages/opencode/src/kilocode/server/httpapi/public.ts - no issues
  • packages/opencode/test/kilocode/server/httpapi-public.test.ts - no issues
  • .changeset/nullable-kilo-gateway-sdk.md - no issues
  • packages/kilo-vscode/webview-ui/diff-viewer/* (file moves) - no issues

Fix these issues in Kilo Cloud


Reviewed by claude-4.6-sonnet-20260217 · 587,833 tokens

Review guidance: REVIEW.md from base branch main

@marius-kilocode marius-kilocode enabled auto-merge June 3, 2026 14:03
@marius-kilocode marius-kilocode merged commit 4ecef9e into main Jun 3, 2026
22 checks passed
@marius-kilocode marius-kilocode deleted the fix-10857-gateway-statuses branch June 3, 2026 14:31
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.

Preserve Kilo gateway upstream error statuses after HttpApi migration

2 participants