Skip to content

fix(agent): 팬이 먼저 끊으면 통화 타이머를 바로 멈춤 - #28

Merged
Lee-Soyeon merged 1 commit into
mainfrom
fix/agent-stop-timer-on-hangup
Oct 20, 2026
Merged

Lee-Soyeon merged 1 commit into
mainfrom
fix/agent-stop-timer-on-hangup

Conversation

@Lee-Soyeon

Copy link
Copy Markdown
Contributor

요약

팬이 통화 도중에 먼저 끊으면 에이전트 작업이 바로 끝나도록 고칩니다. 지금은 끊은 뒤에도 3분 타이머가 남아 있다가 강제 종료됩니다.

목적

휴대폰 전화 테스트(#26·#27)에서 9초 만에 끊었는데, 로그는 이렇게 이어졌습니다.

09:33:16 closing agent session due to participant disconnect
09:33:53 entrypoint did not exit in time, cancelling

세션은 닫혔는데 run_call_timer가 계속 sleep 중이라 entrypoint가 반환되지 않았고, livekit이 약 37초 뒤 강제로 취소했습니다. 영상통화에서도 똑같이 일어납니다. 그동안 프로세스 하나를 쓸데없이 붙잡고, 로그에 "did not exit in time" 경고가 남습니다.

변경 사항

  • 통화 타이머를 task로 돌리고, AgentSession의 close 이벤트에서 그 task를 취소합니다.
  • 팬이 먼저 끊으면 "Agent session ended before call limit." 로그를 남기고 바로 반환합니다.
  • 3분을 다 채운 경우의 동작(마무리 → 작별 인사 → 종료)은 그대로입니다.

테스트

  • make unit-test 통과, mypy·pyright 오류 0, pylint 10.00
  • 통화 중 먼저 끊었을 때 "did not exit in time" 경고 없이 바로 끝나는지 확인 (다음 실제 전화 테스트에서 확인 예정)
  • 3분을 다 채우면 작별 인사 후 종료되는지 확인

🤖 Generated with Claude Code

팬이 통화 중에 나가면 세션은 닫히지만 3분 타이머가 남아, 작업이 끝나지
않다가 livekit이 entrypoint를 강제 취소했다. 세션 close 이벤트에서 타이머를
취소해 바로 끝나게 한다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Lee-Soyeon
Lee-Soyeon requested a review from ywkim October 17, 2026 00:39

@ywkim ywkim left a comment

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.

@Lee-Soyeon 소연님, 감사합니다! 🙌

실제 전화 테스트 로그에서 원인을 짚어 주시고, close 이벤트로 타이머 task를 취소하는 최소한의 변경으로 깔끔하게 해결해 주셨습니다. 3분을 채우는 기존 종료 흐름도 그대로 유지돼서 안심하고 승인합니다.


Generated by Claude Code

@Lee-Soyeon
Lee-Soyeon merged commit 1a0537d into main Oct 20, 2026
1 check passed
@Lee-Soyeon
Lee-Soyeon deleted the fix/agent-stop-timer-on-hangup branch October 20, 2026 00:06
Lee-Soyeon pushed a commit that referenced this pull request Oct 21, 2026
Hedra 아바타 삭제는 별도 PR로 분리한다. main(#21, #28)을 병합하고
Fish Audio -> ElevenLabs TTS 교체만 남긴다 (hedra extra와 코드 유지).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtQpw2nbQZLwzSJGbw5E3C
Lee-Soyeon added a commit that referenced this pull request Oct 21, 2026
## 요약

AI 아이돌 통화의 음성을 Fish Audio에서 **ElevenLabs TTS**로 바꿉니다. Hedra 아바타 삭제와
LiveKit Agents 1.8 업그레이드는 리뷰 요청에 따라 이 PR에서 **뺐습니다** (각각 별도 PR).
`livekit-agents`는 1.2.18 그대로입니다.

## 변경 사항

### 음성 (TTS)
- Fish Audio → **ElevenLabs** (`eleven_flash_v2_5`).
`FANCALL_ELEVENLABS_MODEL`로 모델 변경 가능.
- API 키는 `ELEVEN_API_KEY` (`ElevenLabsSettings` 추가).
- extra를 `fishaudio` → `elevenlabs`로 교체 (`hedra` extra는 유지).
`poetry.lock`은 main 대비 fish 플러그인 의존성 제거와 `livekit-plugins-elevenlabs`
추가만 바뀝니다.
- 기본 페르소나(은우)의 Fish voice ID 제거. voice ID가 없으면 ElevenLabs 기본 목소리 사용.

### 호출하는 쪽에 영향
- `create_worker_options()`: `fish_settings` → `elevenlabs_settings`.
호스트 앱이 직접 호출하면 함께 수정 필요. `hedra_settings`는 그대로입니다.
- `voice_id`는 ElevenLabs voice ID여야 함 (README, `schemas.ts` 주석에 안내).

### 이 PR에 없는 것
- Hedra 삭제: 별도 PR
- LiveKit Agents 1.8 업그레이드: 별도 PR (`feat/livekit-agents-1.8`)

main(#21, #28)을 병합해 충돌을 풀었습니다.

## 테스트
- [x] `make -C backend lint` 10/10, `type-check` 오류 0, `unit-test` 23/23
통과
- [x] (이전 커밋 기준) 로컬 LiveKit dev 서버에서 ElevenLabs 음성으로 응답 확인
- [ ] 브라우저 실제 통화 화면 확인
- [ ] 은우용 ElevenLabs voice ID 지정 확인

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01HtQpw2nbQZLwzSJGbw5E3C

---------

Co-authored-by: Claude <noreply@anthropic.com>
Lee-Soyeon added a commit that referenced this pull request Oct 23, 2026
ElevenLabs 교체는 main(#15) 쪽을 따르고, #22 고유 변경(wait_for_answer)만 main의 worker.py 위에 다시 얹었다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

ywkim commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

@Lee-Soyeon 소연님, 팬이 먼저 끊어도 통화 타이머가 3분까지 남아 있던 문제를 고쳐 주셔서 감사합니다 🙏 실제 전화 테스트 로그로 원인을 짚어 두셔서, 무엇이 왜 바뀌는지 바로 따라갈 수 있었습니다.

이 변경은 buppy 모노레포로 옮겨 algorima/buppy#1502 에 들어갔습니다. 소연님 커밋을 경로만 바꿔 cherry-pick해서 작성자와 커밋 메시지가 그대로 남아 있습니다. 그 PR에 리뷰도 요청드렸으니 시간 되실 때 봐 주세요.


Generated by Claude Code · session session_01T5SeyErbjJvce4P8rjmZzs


Generated by Claude Code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants