코드탭 로그에서 드러난 대화 저장소 복호화 오탐을 수정한다

- CryptoService 평문 JSON 판별을 UTF-8 디코드 성공과 BOM/공백 제거 후 JSON 시작 문자 확인으로 강화
- 암호문 선행 바이트가 '[' 또는 0xEF인 경우와 UTF-8 BOM 평문 대화 파일 복원 회귀 테스트 추가
- README와 DEVELOPMENT 문서에 2026-04-15 19:12 KST 기준 로그 원인 및 검증 결과 기록

검증:
- dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify_chat_storage_fix\\ -p:IntermediateOutputPath=obj\\verify_chat_storage_fix\\
- dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter ChatStorageServiceTests -p:OutputPath=bin\\verify_chat_storage_fix_tests\\ -p:IntermediateOutputPath=obj\\verify_chat_storage_fix_tests\
This commit is contained in:
2026-04-15 19:05:21 +09:00
parent 5ab04bc53e
commit 913b42b2f3
4 changed files with 194 additions and 29 deletions

View File

@@ -1484,3 +1484,23 @@ UI ?遺우쁽????域뱀뮆???귐뗫솯?醫딆춦 ???袁る퓮 ?臾믩씜 ??疫
- `src/AxCopilot/Services/Agent/AgentProgressSummarySanitizer.cs``SkillRuntime`, `allowed_tools`, 메인 루프 요청, 읽기 도구 조기 실행 준비, 스트리밍 도구 감지 등 저신호 내부 문구를 추가로 필터링해 본문/라이브 카드에 내부성 로그가 다시 노출되지 않도록 보강했습니다.
- 검증: `dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify_live_restore\\ -p:IntermediateOutputPath=obj\\verify_live_restore\\` 경고 0 / 오류 0
- 검증: `dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter "AgentLoopCodeQualityTests|AgentStatusNarrativeCatalogTests|AgentProgressSummarySanitizerTests" -p:OutputPath=bin\\verify_live_restore_tests\\ -p:IntermediateOutputPath=obj\\verify_live_restore_tests\\` 통과 131
업데이트: 2026-04-15 19:12 (KST)
### Code 탭 로그 분석: 대화 저장소 복호화 오탐 수정
- 2026-04-15 18:44 Code 실행(`convId=08179304`)은 메인 루프 11회 후 정상 종료됐고, 로그상 실제 경고는 별도의 `.axchat` 대화 파일 복호화 단계에서 반복되고 있었습니다.
- 문제 원인:
- `C:\Users\admin\AppData\Roaming\AxCopilot\conversations\0d65bb632d7b4fcea24b3d2cb0f900f0.axchat` 선행 바이트가 `0x5B`(`[`), `a0aa1206a20643959c710091e232d8be.axchat` 선행 바이트가 `0xEF`였습니다.
- 기존 `CryptoService.DecryptFromFile(...)`는 첫 바이트가 `{`, `[`, `0xEF` 중 하나면 평문 JSON으로 간주했기 때문에, 암호화 바이너리가 우연히 이 바이트들로 시작할 때 복호화하지 않고 `JsonSerializer.Deserialize<ChatConversation>(...)`로 바로 넘겨 `대화 메타 로드 실패`, `만료 대화 정리 실패` 경고가 반복됐습니다.
- 수정 내용:
- `src/AxCopilot/Services/CryptoService.cs`
- `StrictUtf8` 디코더를 추가해 평문 JSON 판별 전에 실제 UTF-8 디코드 성공 여부를 먼저 확인합니다.
- `TryNormalizePlainJson(...)`, `TryDecodePlainJson(...)` 헬퍼를 추가해 `UTF-8 BOM/공백 제거 후 첫 문자가 { 또는 [`인 경우만 평문 JSON으로 인정하도록 변경했습니다.
- 복호화 후에도 같은 정규화 경로를 사용해 구버전 UTF-8 BOM 평문 대화 파일이 그대로 복원되도록 보강했습니다.
- `src/AxCopilot.Tests/Services/ChatStorageServiceTests.cs`
- 암호문 선행 바이트가 `[` 또는 `0xEF`인 회귀 케이스를 생성해 `Load()``LoadAllMeta()`가 정상 복원되는지 검증합니다.
- UTF-8 BOM이 있는 레거시 평문 `.axchat`도 정상 복원되는지 검증합니다.
### 검증
- `dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify_chat_storage_fix\\ -p:IntermediateOutputPath=obj\\verify_chat_storage_fix\\` 경고 0 / 오류 0
- `dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter "ChatStorageServiceTests" -p:OutputPath=bin\\verify_chat_storage_fix_tests\\ -p:IntermediateOutputPath=obj\\verify_chat_storage_fix_tests\\` 통과 4