Skip to content

[codex] Fix Kiro ACP image attachment errors#2793

Closed
declancowen wants to merge 23 commits into
pingdotgg:mainfrom
declancowen:codex/kiro-acp-image-errors
Closed

[codex] Fix Kiro ACP image attachment errors#2793
declancowen wants to merge 23 commits into
pingdotgg:mainfrom
declancowen:codex/kiro-acp-image-errors

Conversation

@declancowen
Copy link
Copy Markdown

@declancowen declancowen commented May 23, 2026

Summary

  • Preserve ACP JSON-RPC error data when providers return response errors so invalid image failures surface as provider request errors instead of Effect decode defects.
  • Add shared ACP image prompt capability checks and provider MIME allowlist support.
  • Wire Kiro image attachment support to PNG/JPEG/GIF/WebP and add regression coverage for core RPC, extension errors, capability rejection, and MIME rejection.

Validation

  • bun run test src/client.test.ts src/protocol.test.ts from packages/effect-acp
  • bun run test src/provider/acp/StandardAcpAdapter.test.ts from apps/server
  • bun fmt
  • bun lint (passes with existing unrelated warnings)
  • bun typecheck

Notes

The fix keeps native ACP image content blocks enabled for Kiro. The root issue was error-channel classification: provider JSON-RPC errors were decoded as defects and displayed as low-level decode stacks.


Note

High Risk
High risk: changes authentication-adjacent CORS behavior, adds a new provider driver/runtime (Kiro) and modifies ACP error/permission handling, plus updates release automation and desktop update install flow.

Overview
Adds end-to-end Kiro CLI provider support (driver, ACP runtime, adapter, provider snapshot/model discovery, home/env handling) and wires Kiro-specific ACP behaviors like session/set_model, active-prompt steering via _message/send, image MIME allowlisting, and continuation keying.

Hardens server credentialed CORS by replacing wildcard CORS middleware with per-request origin handling: only loopback + known hosted app origins receive Access-Control-Allow-Credentials, and auth routes now emit origin-scoped CORS headers; includes new unit/integration coverage.

Improves desktop release/update reliability: introduces a dedicated desktop-release.yml workflow for stable tags (tag/ref resolution, multi-platform artifacts, strict macOS signing requirement), limits the existing release.yml to nightly tags, and updates DesktopUpdates.install to stop the backend before quitAndInstall, prevent double-installs, and restart the backend on install-handoff failures (with added tests and updated menu “no updates” dialog copy).

Reviewed by Cursor Bugbot for commit 7d1ec6d. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix Kiro ACP image attachment errors and add full Kiro provider support

  • Adds the Kiro provider end-to-end: driver, ACP adapter, ACP runtime (KiroAcpSupport), text generation, settings schema, UI icon, and sidebar entry with a 'new' badge
  • Fixes ACP image attachment errors by wiring supported image MIME types (gif, jpeg, png, webp) into makeKiroAdapter and sending image content via the _message/send method
  • Fixes ACP protocol handling for non-numeric JSON-RPC request IDs by aliasing them to numeric IDs internally and restoring originals on responses in makeAcpPatchedProtocol
  • Improves ACP error messages by extracting structured detail from error data and suppressing generic 'Internal error' strings in favor of the data message
  • Infers ACP tool kind from the toolCall title when kind is omitted (e.g. 'editing:' → edit, 'running:' → execute) in parsePermissionRequest
  • Adds dynamic per-origin CORS header generation for browser API and auth endpoints, replacing static CORS config
  • Introduces Appearance settings page at /settings/appearance with theme mode control, font, contrast, motion, and translucent sidebar options driven by CSS variables and data-* attributes
  • Risk: primary accent color changes to #ff5c5c (red) and dark mode background changes to #101827; existing color-dependent tests or screenshots will differ

Macroscope summarized 7d1ec6d.

Copy link
Copy Markdown
Author

@codex review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fd3d55ff-059a-4066-8f5d-31f8915f9d41

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels May 23, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 657f253. Configure here.

Comment thread .github/workflows/desktop-release.yml Outdated
Comment thread apps/desktop/src/updates/DesktopUpdates.ts
Comment thread apps/web/src/components/chat/ComposerPrimaryActions.tsx
Copy link
Copy Markdown

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

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: 657f253c1d

ℹ️ 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".

Comment thread packages/effect-acp/src/protocol.ts Outdated
Comment thread packages/shared/src/shell.ts Outdated
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 23, 2026

Approvability

Verdict: Needs human review

1 blocking correctness issue found. Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

You can customize Macroscope's approvability policy. Learn more.

@declancowen
Copy link
Copy Markdown
Author

@codex review

Copy link
Copy Markdown

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

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: dd6e413d24

ℹ️ 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".

Comment thread apps/server/src/httpCors.ts Outdated
@declancowen
Copy link
Copy Markdown
Author

@codex review

Comment on lines +66 to +75
export function browserApiCorsPreflightHeadersForOrigin(origin: string | undefined) {
if (!isBrowserApiCorsOriginAllowed(origin)) {
return {};
}

return {
...browserApiCorsHeadersForOrigin(origin),
"access-control-max-age": String(browserApiCorsMaxAgeSeconds),
} as const;
}
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 src/httpCors.ts:66

When origin is not allowed, browserApiCorsPreflightHeadersForOrigin returns {} (no CORS headers), causing preflight requests to fail with CORS errors. However, browserApiCorsHeadersForOrigin returns permissive headers with "access-control-allow-origin": "*" for the same non-allowed origins on actual requests. This asymmetry allows simple requests from untrusted origins to succeed while blocking complex requests that require preflight.

 export function browserApiCorsPreflightHeadersForOrigin(origin: string | undefined) {
   if (!isBrowserApiCorsOriginAllowed(origin)) {
-    return {};
+    return browserApiCorsHeadersForOrigin(origin);
   }
 
   return {
     ...browserApiCorsHeadersForOrigin(origin),
     "access-control-max-age": String(browserApiCorsMaxAgeSeconds),
-  } as const;
+  };
 }
🤖 Copy this AI Prompt to have your agent fix this:
In file apps/server/src/httpCors.ts around lines 66-75:

When `origin` is not allowed, `browserApiCorsPreflightHeadersForOrigin` returns `{}` (no CORS headers), causing preflight requests to fail with CORS errors. However, `browserApiCorsHeadersForOrigin` returns permissive headers with `"access-control-allow-origin": "*"` for the same non-allowed origins on actual requests. This asymmetry allows simple requests from untrusted origins to succeed while blocking complex requests that require preflight.

Evidence trail:
apps/server/src/httpCors.ts lines 16-20 (browserApiCorsHeaders with wildcard), lines 53-64 (browserApiCorsHeadersForOrigin returning wildcard for non-allowed), lines 66-75 (browserApiCorsPreflightHeadersForOrigin returning {} for non-allowed). apps/server/src/http.ts lines 46-69 (middleware using both functions for OPTIONS vs actual requests).

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ 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".

@declancowen
Copy link
Copy Markdown
Author

Closing this cross-repo PR. Replacement PR targets declancowen/t3code:main: declancowen#6

@declancowen declancowen deleted the codex/kiro-acp-image-errors branch May 23, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant