Skip to content

fix(google): steer Google models away from unrendered LaTeX math formatting (carry of #3480) - #3544

Merged
lidge-jun merged 2 commits into
devfrom
codex/260905-carry-3480
Sep 4, 2026
Merged

fix(google): steer Google models away from unrendered LaTeX math formatting (carry of #3480)#3544
lidge-jun merged 2 commits into
devfrom
codex/260905-carry-3480

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Google models emit $...$ / \\[...\\] LaTeX in ordinary chat answers, which Codex renders as raw source. This carry appends a LaTeX-avoidance guidance line to the Google systemInstruction in src/adapters/google.ts, with the escape bug from the earlier review fixed on the author's rebased head 74ef8faae (the CHANGES_REQUESTED review targets the superseded head 4f5b05468).

Supersedes #3480 (maintainer carry: original is a contributor draft whose readiness checklist would reset on any push; carry = PR head merged with origin/dev).

Stack (wp1 merge train, independent layers — each targets dev):

# PR Layer Review focus
1 this carry of #3480 this PR's diff only

Unit: devlog/_plan/260905_open_work_closeout/ (010, 011).

Verification

  • bun run typecheck — exit 0 on the carry head.
  • bun test tests/adapters/google/google-adapter.test.ts — 33 pass / 0 fail.
  • Exact-head CI on this branch is the merge gate.

Checklist

  • Targets dev
  • Focused regression test present and green
  • Original author credited via Co-authored-by trailer

Co-authored-by: benedictusrey 74437942+benedictusrey@users.noreply.github.com

Summary by CodeRabbit

  • Improvements
    • Google-generated responses now receive guidance to avoid LaTeX math delimiters and use plain text, Markdown, and Unicode symbols for formulas, variables, dimensions, and units.
    • Supported formatting commands are clarified for more consistent mathematical output.

benedictusrey888 and others added 2 commits September 5, 2026 07:34
…atting

Google-family models (Gemini/Antigravity/Vertex) frequently wrap coordinates, dimensions, variables, and math in LaTeX math delimiters ($...$, ..., (...), 	ext{}, etc.). Because Codex Desktop renders standard Markdown without KaTeX support, these delimiters show up as raw unrendered LaTeX strings in chat output.

Include explicit client formatting guidance in GOOGLE_BREVITY_INSTRUCTION so Google models output clean Markdown, plain text, and Unicode symbols instead.
Co-authored-by: benedictusrey <74437942+benedictusrey@users.noreply.github.com>
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 4, 2026 22:42
@lidge-jun lidge-jun added the bug Something isn't working label Sep 4, 2026
@coderabbitai

coderabbitai Bot commented Sep 4, 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: Team

Run ID: 0354b065-8cd8-4537-8821-f31f990a85d6

📥 Commits

Reviewing files that changed from the base of the PR and between 980a9fb and 368c513.

📒 Files selected for processing (2)
  • src/adapters/google.ts
  • tests/adapters/google/google-adapter.test.ts

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


📝 Walkthrough

Walkthrough

The Google adapter now instructs models to avoid LaTeX math delimiters and use plain text, Markdown, and Unicode symbols. A test verifies that the guidance appears in the generated system instruction.

Changes

Google formatting guidance

Layer / File(s) Summary
Formatting instruction and validation
src/adapters/google.ts, tests/adapters/google/google-adapter.test.ts
GOOGLE_BREVITY_INSTRUCTION now includes LaTeX delimiter guidance at line 55. The adapter test verifies the generated instruction contains the listed delimiters and supported commands at lines 177–186.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 368c5

Google-model responses will be guided toward Markdown, plain text, and Unicode rather than unrendered LaTeX delimiters. The focused regression coverage confirms the instruction is generated, with no current merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Google adapter change: preventing Google models from producing unrendered LaTeX math formatting. The carry reference is relevant and does not obscure the primary chang…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/260905-carry-3480

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.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 73 / 80

설명

이 PR은 Google 계열 모델(Gemini / Vertex / Antigravity)이 채팅 답에 $...$, $$...$$, \(...\), \[...\] 같은 LaTeX 수식 구분자를 자주 넣는데, Codex Desktop은 KaTeX가 없어서 그게 그대로 깨진 소스로 보이는 문제를 고칩니다. 고치는 방법은 새 파일을 만드는 게 아니라, 이미 dev에 있는 src/adapters/google.tsGOOGLE_BREVITY_INSTRUCTION 배열에 ‘LaTeX 구분자·마크업 쓰지 말고 평문·Markdown·유니코드 기호를 써라’는 한 줄을 붙이는 것입니다. 이 상수는 messagesToGeminiFormat 안에서 identifyRoutedModel(...)로 넘어가 systemInstruction에 합쳐지므로, google 어댑터로 나가는 요청에만 붙고 다른 프로바이더에는 영향이 없습니다.

지금 dev HEAD는 d6b457462입니다. 바로 전에 #3538devlog/_plan/260905_open_work_closeout/ 로드맵 유닛이 열렸고, 그 안의 002/006/010 문서는 원본 #3480을 LAND_AS_IS로 적어 두었습니다. 이 PR #3544는 그 원본을 메인테이너가 origin/dev 위에 다시 올린 캐리입니다. 본문에 적힌 대로 예전 리뷰가 지적한 이스케이프 버그(\\(...\\)가 잘못 나가던 문제)는 캐리 헤드에서 고쳤고, 테스트도 tests/adapters/google/google-adapter.test.ts에 정확히 그 문자열이 systemInstruction에 들어가는지 확인합니다. 원 작성자 benedictusreyCo-authored-by로 남아 있습니다.

현재 devGOOGLE_BREVITY_INSTRUCTION(대략 49–55행)은 도구 호출 사이 중간 말을 짧게 하라는 안내만 있고 LaTeX 이야기는 없습니다. git grep -i latex로도 HEAD에는 해당 안내가 없습니다. 그래서 이 PR의 테스트는 지금 dev에선 빨갛고, 머지 후에야 초록이 됩니다. 닫아 두지 말아야 할 중복이 아니라, closeout wp1 스택의 작은 런타임 델타(프롬프트 상수 한 줄 + 회귀 테스트)입니다. 제품 쪽 트레이드오프(LaTeX를 그릴 수 있는 다른 클라이언트까지 평문으로 밀어 넣는 점)는 원본 스레드에서 이미 메인테이너가 받아들인 방향입니다.

파일은 두 개뿐입니다. src/adapters/google.ts에 안내 한 줄, tests/adapters/google/google-adapter.test.tsString.raw로 구분자·\text{}/\times/\le/\ge 포함 여부를 보는 테스트 하나. 제어 흐름·라우팅·가격표는 건드리지 않습니다. CI는 이 글을 쓰는 시점엔 아직 대부분 pending이고, react-doctor / changes / keyring 일부만 통과한 상태입니다. 머지 게이트는 exact-head CI 초록을 기다리는 게 맞습니다.

원본 #3480은 아직 OPEN입니다. 캐리가 먼저 들어가면 원본은 Landed via #3544 at <commit> 댓글 + landed-via-maintainer 라벨 후 닫는 흐름이 맞습니다. 같은 Google 어댑터를 건드리는 #3469(location 에러 분류)와는 레이어가 달라 보이지만, 둘 다 google.ts를 만지면 나중에 리베이스 충돌만 조심하면 됩니다. types/config 분할 캠페인과는 무관합니다.

라인 44-48 - GOOGLE_BREVITY_INSTRUCTION 위 주석이 여전히 ‘중간 말을 짧게’만 설명해서, 이번 포매팅 안내가 같은 상수에 들어간 이유를 나중에 읽는 사람이 헷갈릴 수 있다. 한 줄이라도 ‘최종 답 포맷(LaTeX 회피)도 포함한다’고 주석을 고쳐 두면 좋다.
원본 PR #3480 - 캐리 #3544가 머지된 뒤에도 열려 있으면 열린 PR 숫자가 부풀고 기여자가 헷갈린다. 머지 직후 landed-via 처리가 필요하다.
CI 상태 - exact-head 샤드가 아직 pending이라, 코드가 작아도 초록 확인 전에 합치면 게이트를 건너뛰는 셈이 된다.

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

  • 원본 #3480을 캐리 머지 후 즉시 닫을지, 아니면 작성자가 ready/approve를 끝낼 때까지 잠시 둘지
  • LaTeX 회피 안내를 ‘모든 Google 최종 답’에 강제하는 제품 결정을 이 캐리로 확정할지(이미 스레드에서 긍정한 트레이드오프를 문서/주석에도 남길지)
  • #3469 등 같은 파일 터치 PR과 머지 순서를 어떻게 잡을지(충돌 비용만 보면 이 한 줄 PR을 먼저 넣는 편이 싸다)

너의 추천
CI(특히 gates / test * / hygiene)가 초록이면 #3544dev에 머지한다. 머지 커밋 SHA로 원본 #3480Landed via #3544 at <sha>를 남기고 landed-via-maintainer를 붙인 뒤 완료(또는 superseded)로 닫는다. 여유 있으면 google.ts 44–48행 주석에 포매팅 안내가 같이 실린다는 한 줄을 같은 PR이나 바로 다음 정리 커밋에 넣어 둔다.

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

@Ingwannu Ingwannu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed at exact head 368c5137a5e5760353cd57675df06fb8ebc91903.

The carry is bounded to the shared Google adapter instruction plus its focused regression. It tells Gemini/Vertex/Antigravity outputs to use plain Markdown and Unicode where Codex Desktop lacks KaTeX rendering, without changing wire conversion, tool calls, routing, or non-Google providers. The escaped instruction text is preserved correctly, and the test pins both the existing brevity contract and the new formatting clause.

Cross-platform CI run 33926622201 completed successfully on this exact SHA, including all Linux shards, both macOS shards, gates, storage/API-usage, keyring, and npm checks. CodeRabbit has no actionable finding. Approved.

@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer admin merge (ruleset bypass recorded per MAINTAINERS.md): carry of #3480, exact-head CI green on 368c513 (24 pass / 2 skipped / 0 fail). The single earlier macos 2/2 failure was tests/update/update-stop-first.test.ts readiness timeout (93s) in the update launcher — unreachable from this one-line google.ts prompt change — and passed on rerun of the same head. wp1 residual of the 260905 open-work closeout.

@lidge-jun
lidge-jun merged commit 4457429 into dev Sep 4, 2026
48 of 53 checks passed
@lidge-jun
lidge-jun deleted the codex/260905-carry-3480 branch September 4, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants