feat: env 토글 기반 headless + lean Chrome 런치 (리소스 절감)#4
Merged
Conversation
브라우저는 DOM을 렌더하지 않고 in-page fetch(credentials:include)로 토스 cert API를 직접 호출 + App-Version 서명 호스트 역할만 한다. 따라서 GPU 컴포지터·이미지 디코드·창이 순수 오버헤드다. - resolve_browser_launch_options(): env 토글을 읽어 launch kwargs 빌드 - TOSS_BRIDGE_HEADLESS=on → headless=True (Playwright 신형 headless) - TOSS_BRIDGE_LEAN=on → LEAN_CHROME_ARGS (GPU/이미지/확장 비활성 등) - 기존 _env_flag + FINAL_SUBMIT 패턴 재사용. 잘못된 값은 안전하게 off - 토글 미설정 시 현행(headed + --window-size) 인자와 바이트 동일 → 회귀 0 - start_browser()는 **resolve_browser_launch_options()로 호출부만 교체 - 단위테스트(회귀 고정 포함) + README env 토글 문서 검증: clean env 전체 스위트 99 passed. headless 실측+RSS(Phase 2)는 토스 헤디드 1회 로그인 후 별도 진행. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
Author
Phase 2 — 라이브 실측 결과 (✅ 통과)financier-v2 격리 env( 플래그 실제 적용 확인 (main chrome cmdline)
봇 탐지 / 세션
조회 end-to-end (health 플래그 아닌 실데이터)
Chrome RSS (동일 ps 합산 방법, shared-page 중복 포함 — 전후 비교용)
→ 약 85% 감소. audio 프로세스 제거, 창/컴포지터 제거 효과. 비고
|
headless+lean 라이브 검증: 토스 차단 없음, 조회 4종 정상, Chrome RSS 6916.7MB → 1062.6MB (~85%↓). tasks/index 완료 처리. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
배경 (근본원인)
bridge가 띄우는 Chrome은 토스 화면을 렌더/스크레이프하지 않는다. 데이터는 페이지 안
fetch(url, {credentials:"include"})로 토스 cert API를 직접 호출해 가져오고(daemon.pyevaluate→fetch), 브라우저는 ① 로그인 세션 보관(persistent profile) ② 토스 JS 요청서명용App-Version추출 호스트 역할만 한다. 즉 GPU 컴포지터·이미지 디코드·1440×960 창 전체가 순수 오버헤드.그런데
start_browser()는launch_persistent_context(... headless=False, args=["--window-size=..."])로 하드코딩돼 있어 env로 못 바꿨다.변경
resolve_browser_launch_options()순수 함수 추가 — env 토글을 읽어 launch kwargs 빌드_env_flag+TOSS_BRIDGE_ENABLE_FINAL_SUBMIT패턴 재사용):TOSS_BRIDGE_HEADLESSon→headless=True(Playwright 신형 headless)TOSS_BRIDGE_LEANon→LEAN_CHROME_ARGS(GPU/이미지/확장 비활성 등)start_browser()는**resolve_browser_launch_options()로 호출부만 교체tests/test_browser_launch.py)하위호환
토글 둘 다 미설정이 기본이며, 그때 launch 인자는 현행(headed +
--window-size=1440,960)과 바이트 단위로 동일하다.test_no_toggles_matches_current_hardcoded_baseline로 회귀 고정. 잘못된 env 값(off/오타/빈값)은 전부 안전하게 off.검증
.envrc의TOSS_BRIDGE_*누출 제외 시)미완 (Phase 2 — 토스 로그인 필요)
이미지/GPU OFF·headless가 실제 토스 조회/주문에 통과하는지 라이브 실측과 Chrome RSS 전후 수치는 헤디드 1회 로그인 후 별도 진행. headless는 토스 anti-automation 차단 가능성이 있어 조회 4종(account-summary/positions/quote/completed) 검증 후 주문 확대 원칙. 이 PR은 backward-compatible scaffolding(기본 off)이라 머지해도 회귀 위험 0.
스펙:
tasks/20260617-bridge-headless-lean/spec/initial.md🤖 Generated with Claude Code