Skip to content

[fix] Gemini 경고 메시지의 글자수 표기 노출 제거 - #62

Merged
gihhyeon merged 2 commits into
developfrom
fix/gemini-warning-char-count-leak
Aug 30, 2026
Merged

gihhyeon merged 2 commits into
developfrom
fix/gemini-warning-char-count-leak

Conversation

@gihhyeon

Copy link
Copy Markdown
Member

close #61

📌 개요 (why, what)

Gemini가 생성한 경고 메시지에 문구(9자)처럼 글자수 표기가 붙어 사용자에게 그대로 노출되는 사례가 확인되어 이를 제거합니다. 프롬프트에서 부연 표기를 금지하고 있지만 모델이 간헐적으로 이를 어기며, 기존 normalize()는 25자 초과 여부만 검사할 뿐 이런 표기를 걸러내지 못했습니다.

🛠️ 구현 방법 (how)

  • 후행 글자수 표기(문구(9자), 문구 (9자), 전각 괄호 (9자) 포함)를 매칭하는 정규식 TRAILING_CHAR_COUNT를 추가
  • normalize()에서 길이 검사 전에 해당 표기를 제거하도록 순서 조정 → 표기 때문에 25자를 넘겨 정상 문구가 기본 문구로 대체되던 부작용도 함께 해결
  • 표기 제거 후 빈 문자열이면 기본 문구로 폴백
  • 프롬프트 규칙에 "글자수/길이를 함께 적지 않는다" 지시를 보강

🤔 검토한 대안과 선택 이유 (trade-off)

대안 장점 단점 선택 여부
프롬프트 지시 강화만으로 해결 코드 변경 없음 모델 출력이 확률적이라 재발 보장 불가 ❌
응답 후처리에서 표기 제거 + 프롬프트 보강 표기가 나와도 사용자 노출 차단, 재발 방지 정규식 유지보수 필요 ✅

💭 리뷰 포인트

파일/영역 검토 내용 리뷰 요청 사항
GeminiWarningMessageClient 후행 글자수 표기 제거 정규식과 normalize() 순서 정규식 패턴 범위가 적절한지 (다른 부연 표기 형태도 고려할지) 확인 부탁

📚 Reference (Optional)

모델이 프롬프트 지시를 어기고 "문구(9자)"처럼 글자수를 덧붙이는 경우가
있어, 길이 검사 전에 후행 글자수 표기를 제거하도록 수정
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 10cabec7-ab75-4f34-9a3f-a30fd0c9b443

Warning

Your free Security trial is over. An organization admin can activate billing to continue.


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.

@gihhyeon gihhyeon changed the title fix: Gemini 경고 메시지의 글자수 표기 노출 제거 [fix] Gemini 경고 메시지의 글자수 표기 노출 제거 Aug 25, 2026
@gihhyeon gihhyeon self-assigned this Aug 25, 2026
@gihhyeon gihhyeon added the 🐛 bug 버그 이슈 label Aug 25, 2026
@gihhyeon
gihhyeon requested a review from kyer5 August 25, 2026 11:50

@kyer5 kyer5 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

반영 감사합니다 ㅎㅎ 코멘트 확인 부탁드려요 !

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

지금 (9자)가 포함되어 나오는 현상이 약 700번 중 1번으로 드물게 나온 거라, 우선 프롬프트에 추가한 지시 "(9자)"처럼 글자수를 붙이지 않는다 만으로도 충분히 잡을 수 있을 것 같아요!
정규식 패턴 + 메서드 + blank 재검사까지 코드를 늘리기보다는, 프롬프트 수정만 반영하고 이후에도 계속 발생하면 그때 후처리를 추가하는 방향은 어떠신가용 ??

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

확실하게 처리하는 게 좋다고 생각을 해서 코드단에서도 잡는 걸 추가했습니다!
혹시 후처리 추가를 나중에 반영하는 쪽으로 말씀해주신 이유를 들을 수 있을까여??

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

빈도 대비 코드 유지 보수 비용이 상대적으로 크다고 생각합니다!
위에서도 말씀드렸다시피, 현재 발생 빈도가 700번에 1번 정도라 일단 프롬프트 수정만으로 충분히 개선할 수 있다고 생각했습니다. 지금 시점에서 바로 정규식 패턴, 별도 메서드, blank 재검사, 테스트까지 추가하는 것은 다소 과한 대응인 것 같다는 생각이 들었어요 ..!
일단 프롬프트 수정 먼저 반영하고, 로그를 통해 추이를 지켜보는 건 어떨까요? 이후에도 동일 이슈가 반복적으로 발생하면 그때 후처리 로직을 추가하는 방향으로 진행하는 것도 좋을 것 같다고 생각해요 !

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

좋습니다! 리뷰 반영해서 새로 커밋해놨습니다~

@gihhyeon
gihhyeon merged commit 6d46706 into develop Aug 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug 버그 이슈

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix] Gemini 경고 메시지에 글자수 표기가 노출되는 사례 발견

2 participants