Skip to content

fix(sheets): Tenacity 공통 재시도와 90초 작업 예산 적용 - #174

Open
progresshans wants to merge 9 commits into
fix/bigchat-reaction-order-remindersfrom
fix/bigchat-bounded-read-retries
Open

progresshans wants to merge 9 commits into
fix/bigchat-reaction-order-remindersfrom
fix/bigchat-bounded-read-retries

Conversation

@progresshans

@progresshans progresshans commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

스택 4/5 · 검토 순서 #172 → #173 → #176 → #174 → #177 · 기반 #176

문제

저장소의 재시도·결과 확인 로직이 여러 곳에 흩어져 있었고, 기존 Sheets 클라이언트는 with_retry로 모든 예외를 3초 간격으로 10번 재시도했습니다. 시도 횟수만 제한하면 잠금 대기와 여러 요청·재시도 시간이 합쳐져 신청·취소가 오래 기다릴 수 있습니다. 리뷰에서 제안된 Tenacity 도입과 재시도 조건의 데코레이터 분리를 이 PR에서 적용합니다.

공통 재시도 정책

  • Tenacity 9.2.1로 오류 분류·대기·종료 정책을 integrations/sheets_retry.py에 모았습니다. BigchatStore._read와 기존 값·제목·탭 목록 조회에 @retry_reads를 적용합니다.
  • shared.utils.with_retry와 내부 helper의 중첩 재시도를 제거했습니다. 일시 오류는 1·2초 간격, 429는 5·10·20·30초 간격으로 재시도하며, 영구 오류와 프로그래밍 오류는 즉시 전파합니다.
  • 쓰기는 guarded_write에서 결과 확인을 먼저 수행합니다. 확인 조회의 실패가 원래 쓰기의 재시도로 처리되지 않도록 Tenacity 시도 컨텍스트 밖에서 확인합니다. 고유 ID·버전 필터는 유지합니다.
  • 모집글 metadata가 없을 때만 문서 접근 여부를 한 번 더 확인해, 문서 자체의 404를 일반 메시지로 오인하지 않습니다. 이미 연결된 모집글은 이 추가 조회를 하지 않습니다.

90초 작업 예산

  • BigchatStore 공개 작업과 기존 Sheets 클라이언트의 공개 읽기마다 90초 마감 시각을 시작합니다. 중첩 호출은 같은 마감 시각을 사용합니다.
  • 쓰기 잠금은 남은 시간만 기다립니다. 예산이 끝나면 새 요청·결과 확인·재시도를 시작하지 않으며, 다음 대기가 예산을 넘기면 중단합니다. 이미 끝난 쓰기와 이미 받은 응답은 마감 뒤라도 실패로 바꾸지 않습니다.
  • gspread/Requests의 매 HTTP 전송과 인증 토큰 갱신도 남은 예산을 사용합니다. 연결 최대 5초·응답 대기 최대 20초를 유지하면서 timeout을 줄입니다.

제한의 의미

90초는 저장소 작업 하나의 예산이며 Slack 처리나 전체 일괄 등록의 총 소요 시간 제한은 아닙니다. 회원 조회의 Sheets 읽기도 같은 정책을 사용합니다.

HTTP timeout은 DNS 조회와 계속 수신되는 응답의 총 시간을 엄격하게 제한하지 않습니다. 이미 전송된 Google 요청도 강제로 취소할 수 없으므로 모든 상황에서 정확히 90초 이내 반환을 보장하지는 않습니다. 불확실한 쓰기를 백그라운드에 남긴 채 잠금을 풀거나 결과 확인 없이 다시 보내지는 않습니다.

검증

  • 로컬 make ci 통과: 앱 테스트 668개, 포맷·린트·타입 검사.
  • 중첩 재시도의 호출 증폭, 영구 오류, 확인 실패 뒤 추가 쓰기 차단, 문서 404 안내, 느린 생성·신청·취소, 실제 스레드 잠금 만료, 중첩 호출의 예산 재설정 방지, 설치된 SDK의 인증 갱신·네트워크 timeout 전달, 마감 직후 끝난 쓰기의 보존을 검증합니다.
  • 429·503 주입을 포함한 실제 Sheets 검증은 #177에서 실행합니다.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T09:39:09.010720Z 86cbe65 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@progresshans
progresshans added this pull request to stack #175 November 4, 2026 08:19
@progresshans
progresshans force-pushed the fix/bigchat-bounded-read-retries branch from 761a9d6 to e582c2e Compare November 5, 2026 02:34
@progresshans progresshans changed the title fix(bigchat): 일시적인 Sheets 조회 실패에 제한된 재시도 적용 fix(bigchat): 일시적인 Sheets 조회 오류와 쿼터 초과 재시도 Nov 5, 2026
@progresshans
progresshans force-pushed the fix/bigchat-bounded-read-retries branch from e582c2e to c070dbf Compare November 5, 2026 03:47
@progresshans progresshans changed the title fix(bigchat): 일시적인 Sheets 조회 오류와 쿼터 초과 재시도 fix(bigchat): Sheets 재시도와 잠금·요청 시간 예산 통합 Nov 5, 2026
@progresshans
progresshans force-pushed the fix/bigchat-bounded-read-retries branch 2 times, most recently from 7ec71e2 to cf0bba0 Compare November 5, 2026 06:06
@progresshans progresshans changed the title fix(bigchat): Sheets 재시도와 잠금·요청 시간 예산 통합 fix(bigchat): Sheets 작업의 잠금·요청·재시도 시간 예산 적용 Nov 5, 2026
@progresshans
progresshans force-pushed the fix/bigchat-bounded-read-retries branch 2 times, most recently from 34e1354 to 7ad3817 Compare November 5, 2026 07:08
progresshans and others added 7 commits November 5, 2026 16:19
- Retry 429 reads after 5, 10, 20 and 30 seconds so the per-minute quota
  can refill; other transient errors keep the 1 and 2 second waits.
- Stop retrying once an operation would pass 90 seconds. Writes hold the
  process lock, so this also bounds how long other registrations wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Check the operation budget only before new work starts: attempts,
  waits, lock acquisition and each send. A write that already committed,
  or a response that already arrived, is no longer discarded and
  reported as unconfirmed near the 90 second limit.
- A late credential reply is kept, but the Sheets request after it is
  still refused before it reaches the network.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@progresshans
progresshans force-pushed the fix/bigchat-bounded-read-retries branch from 7ad3817 to 32cb338 Compare November 5, 2026 07:24
@progresshans progresshans changed the title fix(bigchat): Sheets 작업의 잠금·요청·재시도 시간 예산 적용 fix(sheets): Tenacity 공통 재시도와 90초 작업 예산 적용 Nov 5, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 32cb3385b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/integrations/sheets_retry.py Resolved
@progresshans
progresshans removed this pull request from stack #175 November 5, 2026 07:32
@progresshans
progresshans changed the base branch from fix/bigchat-identity-and-sheet-errors to fix/bigchat-reaction-order-reminders November 5, 2026 07:32
@progresshans
progresshans added this pull request to stack #178 November 5, 2026 07:32
progresshans and others added 2 commits November 5, 2026 17:24
- Treat ChunkedEncodingError as transient. Requests derives it only from
  RequestException, so the shared policy rejected it as permanent, while
  the previous read decorator and store write policy retried it.
- Writes still replay only after the confirmation read shows they were
  not applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant