Skip to content

Fix auth.json decoding for mixed provider schemas#69

Merged
kargnas merged 4 commits intomainfrom
codex/issue-64-auth-json-lossy
Feb 6, 2026
Merged

Fix auth.json decoding for mixed provider schemas#69
kargnas merged 4 commits intomainfrom
codex/issue-64-auth-json-lossy

Conversation

@kargnas
Copy link
Member

@kargnas kargnas commented Feb 6, 2026

Addresses #64.

Problem

OpenCode Bar reads OpenCode's auth.json and decodes it into OpenCodeAuth.
If any single provider entry has an unexpected schema (different object shape, string instead of object, numeric fields as strings, etc.), decoding fails for the entire file. This shows up as [auth.json] PARSE FAILED even when the file exists and other providers are configured.

Root Cause

OpenCodeAuth decoding was strict: a decoding error for one key (for example openai or openrouter) threw out the whole OpenCodeAuth decode.

Fix

  • Decode each top-level provider entry lossily (ignore per-key decode failures instead of failing the whole file).
  • Make OAuth decoding more tolerant:
    • expires accepts Int64, Int, Double, or String.
    • accountId accepts a String or a number.
  • Make API-key decoding more tolerant:
    • provider entries can be a raw string value.
    • accept common key field names: key, access, token, apiKey, value.
  • Add unit tests for the lossy decoding behavior.

Notes

  • Updated remaining non-English documentation/comments in touched areas to comply with the repo language policy.

Checks

  • make lint
  • xcodebuild build -scheme CopilotMonitor -configuration Debug
  • xcodebuild build -scheme CopilotMonitor -configuration Release

@kargnas
Copy link
Member Author

kargnas commented Feb 6, 2026

@opgginc/op-gg-ai-devops

@kargnas kargnas marked this pull request as ready for review February 6, 2026 15:55
@kargnas kargnas changed the title [codex] Fix auth.json decoding for mixed provider schemas Fix auth.json decoding for mixed provider schemas Feb 6, 2026
@op-gg-ai-devops
Copy link
Contributor

op-gg-ai-devops bot commented Feb 6, 2026

✅ AI Code Review Completed

Review finished. Check the PR for inline comments.


📋 View Logs | 🤖 Model: openai/gpt-5.2-codex

Copy link
Contributor

@op-gg-ai-devops op-gg-ai-devops bot left a comment

Choose a reason for hiding this comment

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

🤖 OP.GG DevOps AI Code Review

Summary

  • auth.json lossy 디코딩 때문에 스키마가 완전히 깨진 파일도 "성공"으로 처리되어 이후 경로 fallback이 막힐 수 있음. 아래 inline 제안처럼 최소 1개 유효 토큰 없으면 디코딩 실패로 처리하는 게 안전함.
  • 나머지 변경(영문화, 테스트 추가)은 별도 이슈 없음.

CI/CD Status

  • CI: 진행 중 (CI). Lint/Test/Build는 성공.

Local Verification

  • npm install
  • make lint-actions
  • 미실행: SwiftLint/빌드/테스트 (Xcode 프로젝트/Package.swift 미확인)

이 PR에 새 커밋이 push되면 봇이 전체 PR을 자동 재리뷰함. PR 코멘트에서 @opgginc/op-gg-ai-devops 멘션해도 재리뷰함. 예시: @opgginc/op-gg-ai-devops auth.json fallback 검증 다시 확인, @opgginc/op-gg-ai-devops 토큰 디코딩 케이스 테스트 추가 확인, @opgginc/op-gg-ai-devops 문서 영문화 누락 확인

kargnas and others added 2 commits February 7, 2026 01:23
Co-authored-by: op-gg-ai-devops[bot] <255644809+op-gg-ai-devops[bot]@users.noreply.github.com>
@kargnas kargnas merged commit 30249df into main Feb 6, 2026
15 checks passed
@kargnas kargnas deleted the codex/issue-64-auth-json-lossy branch February 6, 2026 16:51
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