Skip to content

fix(images): retain canonical interception for alias choices - #2417

Open
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:fix/image-alias-canonical-interception
Open

fix(images): retain canonical interception for alias choices#2417
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:fix/image-alias-canonical-interception

Conversation

@luvs01

@luvs01 luvs01 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep the canonical synthetic image_gen name in the image-bridge interception set after an authorized alias-only tool choice arms the bridge.
  • Filter requested aliases before adding the canonical internal representation, so none and non-image choices still cannot activate the sidecar.
  • Cover named and allowed_tools aliases plus the handler boundary where the alias is rewritten to image_gen before the bridge loop runs.

Verification

  • Bun 1.4 focused image regressions: bun test --isolate tests/images/plan.test.ts tests/images/z-handler-activation.test.ts — 25 passed, 0 failed, 59 assertions.
  • The handler regression verifies an alias-only request is rewritten to canonical image_gen while both the authorized alias and canonical name remain interceptable.
  • bun run typecheck — passed.
  • Focused oxlint src/images/plan.ts tests/images/plan.test.ts tests/images/z-handler-activation.test.ts — passed.
  • bun run privacy:scan — passed.
  • git diff --check — passed.
  • Independent exact-diff review — no actionable findings.
  • Exact head f73f3d220868fa3ca1a5d376243e9f157b2865dc, based directly on dev at 4f41a8e936141af7ee828e335da314b9dc1ef761.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. This restores an internal alias-to-canonical bridge contract and adds no public API or configuration surface.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. Canonical interception is added only after an already-authorized image name arms the bridge; unrelated and disabled choices remain rejected.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • Bug Fixes
    • Improved image-generation tool selection when using aliases.
    • Ensured alias-only tool choices activate the image-generation bridge correctly.
    • Preserved both canonical and alias tool names while normalizing selections.
    • Improved streamed output handling for alias-based image-generation requests.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added bug Something isn't working review-ready labels Aug 22, 2026
@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

4/4 boxes ticked.

This pull request is already Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers: @lidge-jun @Ingwannu

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c0ee7334-e6c9-4fdf-b474-eebf58dff538

📥 Commits

Reviewing files that changed from the base of the PR and between 4f41a8e and f73f3d2.

📒 Files selected for processing (3)
  • src/images/plan.ts
  • tests/images/plan.test.ts
  • tests/images/z-handler-activation.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

planImageBridge now preserves the synthetic image_gen tool when an image-generation alias activates the bridge. Tests verify canonicalization, retained aliases, bridge activation, and streamed output.

Changes

Image bridge alias handling

Layer / File(s) Summary
Preserve image tool aliases
src/images/plan.ts, tests/images/plan.test.ts
planImageBridge filters hosted tool names and always adds IMAGE_GEN_TOOL_NAME after activation. Tests verify that alias selection retains both image_gen and generate_image, including required allowedTools selection.
Validate alias-only activation
tests/images/z-handler-activation.test.ts
Activation tests record planned tool names and normalized tool choice. A regression test verifies alias-only selection, bridge activation, canonical image_gen selection, both retained tool names, and streamed output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f73f3

The change preserves canonical image interception for authorized aliases while keeping unrelated choices inactive; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving canonical image-tool interception for authorized aliases.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 54 / 80

설명: 이 PR 은 그림 별명만 고른 요청에서, 브리지가 나중에 쓰는 표준 이름 image_gen 을 가로채기 집합에 남겨 둔다. 지금 CURRENT dev HEAD 는 4f41a8e93 이다. 이번 시간에 origin/dev 는 그대로다. 새 머지는 없다. 착지는 여전히 2396 사용량 CLI 오늘 비용이다. package.json 은 2.27.0 이다. src/config.ts 는 3975줄이다. src/runtime 폴더는 지금 HEAD 에 없다. 지금 HEAD 의 src/images/plan.ts 51줄은 호스트 별명과 표준 이름을 한 바구니에 넣고, tool_choice 가 허락한 이름만 남긴다. 별명이 generate_image 이면 표준 이름은 걸러진다. tests/images/plan.test.ts 119줄은 그 상태를 잠근다. 표준 이름이 없다고 기대한다. 그런데 src/server/responses/core.ts 4108줄은 별명이 계획에 있으면 tool_choice 를 image_gen 으로 바꾼다. src/images/loop.ts 332줄 mediaToolNames 는 계획의 toolNames 만 본다. 모델이 바꾼 표준 이름을 부르면, 가로채지 못하고 일반 도구로 흘린다. 그림 사이드카가 안 돈다. 이 PR 은 별명을 먼저 걸러 브리지를 켜고, 켜진 뒤에는 표준 이름을 무조건 넣는다. none 과 다른 도구 선택은 그대로 거절한다. allowed_tools 별명도 같은 시험을 더한다. 핸들러 시험은 별명만 고른 요청이 image_gen 으로 바뀌고, 두 이름이 같이 가로채지는지 잠근다. 작성자 로컬은 그림 시험 25개, typecheck, oxlint, privacy:scan 통과라고 적었다. 드래프트가 아니다. bug 와 review-ready 라벨이 있다. 체크리스트 네 칸이 채워져 있다. 작성자는 luvs01 이다. 베이스는 지금 HEAD 와 같다. Closes 가 없다. GitHub 위생은 초록이고 게이트는 READY 다. CodeRabbit 은 지적 없음이다. 사용자 길이로는 별명만 고르면 그림이 안 나오는 구멍이라서 54. 2083 엑사이 그림 오어스는 다른 길이고 WP8 이 잡고 있다. 카탈로그 팁은 Ox Alpha x-preview-f-free + deepseek-v4-flash-vision-exp. Cursor 정적 카탈로그는 opus-4-8-fast / opus-5-fast. 2334 CursorCredentialRouter 는 여전히 src/providers/cursor-pool.ts 모듈+테스트만 있고 어댑터에 연결되지 않았다. 2332 H2 는 discovery 전용. 2320 overflow + 2342 는 이미 dev. 2188 사이드카는 이미 dev. 2382 데스크톱 앱 재시작은 이미 dev. 2292 는 아직 연다.

src/images/plan.ts 라인 51 - 지금 HEAD 는 표준 이름도 tool_choice 필터에 넣는다. 별명만 고르면 image_gen 이 집합에서 빠진다
tests/images/plan.test.ts 라인 119 - 지금 시험은 별명 계획에 image_gen 이 없다고 잠근다. 이 PR 은 그 기대를 뒤집는다
src/server/responses/core.ts 라인 4108 - 별명이 계획에 있으면 tool_choice 를 image_gen 으로 바꾼다. 핸들러는 표준 이름을 부른다
src/images/loop.ts 라인 332 - 가로채기 집합은 계획의 toolNames 만 본다. 표준 이름이 없으면 사이드카가 안 돈다
tests/images/z-handler-activation.test.ts - 별명만 고른 요청이 image_gen 으로 바뀌고 두 이름이 같이 남는지 잠근다
GitHub CI - 위생과 게이트는 READY. Cross-platform CI 권위는 아직일 수 있다. 작성자 로컬은 25개 통과

메인테이너의 판단이 필요한 지점

  • GitHub 시험이 아직이면 기다릴지. 작성자 로컬은 이미 통과라고 적었다
  • 표준 이름을 두 번 넣는 줄을 한 줄로 줄일지. 지금은 허락되면 넣고, 브리지가 켜진 뒤 또 넣는다
  • 이 구멍을 이슈로 남길지. 본문에 Closes 가 없다. 2083 은 오어스 릴레이라 다른 길이다

너의 추천
GitHub 시험이 초록이면 머지한다. 가드를 더 넓히지 말 것. none 과 다른 도구 거절은 그대로 둔다. 2083 은 닫지 않는다. types.ts/config.ts 스플릿과 겹치지 않는다. 라벨은 그대로 둔다. 프리뷰 배포가 아니다.

이 댓글은 grok-bot이 작성했습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants