Skip to content

fix(manifest): normalize Windows extended-length and device path prefixes (#4442) - #4465

Closed
maoxin1234 wants to merge 2 commits into
lidge-jun:devfrom
maoxin1234:fix/windows-history-path-normalization
Closed

fix(manifest): normalize Windows extended-length and device path prefixes (#4442)#4465
maoxin1234 wants to merge 2 commits into
lidge-jun:devfrom
maoxin1234:fix/windows-history-path-normalization

Conversation

@maoxin1234

@maoxin1234 maoxin1234 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #4442. On Windows, file pickers and editors can pass paths with extended-length or device prefixes (such as \\?\, \\.\, or \\?\UNC\). When comparing session history entries against disk paths, mismatched prefixes caused history manifest matching to fail.

This PR:

  • Introduces exported stripWindowsPathPrefix in src/codex/history-manifest.ts to normalize Windows path prefixes before identity calculation as a platform-independent pure string utility.
  • Preserves drive letter and root path semantics consistently.
  • Adds regression unit tests and platform-independent prefix tests in ests/codex-integration/codex-history-provider.test.ts (92 passing).

Verification

  • Ran �un test tests/codex-integration/codex-history-provider.test.ts (92 passed).
  • Linted with oxlint (0 errors, 0 warnings).

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 13, 2026
@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ All CI tests are green on my local testing.
  • ⬜ I pushed my PR to the latest dev commit.
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

@github-actions
github-actions Bot marked this pull request as draft September 13, 2026 05:43
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e5b497e5-0f65-4707-a815-3652beada36a

📥 Commits

Reviewing files that changed from the base of the PR and between 2df82f4 and 6ddd397.

📒 Files selected for processing (2)
  • src/codex/history-manifest.ts
  • tests/codex-integration/codex-history-provider.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change normalizes Windows extended-length and UNC path prefixes before computing Codex history path identities. Win32 integration tests cover local and UNC path equivalence.

Changes

Windows history path identity

Layer / File(s) Summary
Normalize Windows path identity
src/codex/history-manifest.ts
Adds stripWindowsPathPrefix for \\?\, //?/, and extended UNC prefixes on win32. codexHistoryPathIdentity resolves the normalized path.
Validate equivalent Windows paths
tests/codex-integration/codex-history-provider.test.ts
Adds win32-only tests for local paths, device-prefixed paths, forward-slash prefixes, and extended UNC paths. Tests check both argument orders where applicable.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 6ddd3

Equivalent Windows history paths are normalized for manifest checks, with no confirmed remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #4442 requires equivalent Windows path identities to match during history manifest checks. src/codex/history-manifest.ts adds stripWindowsPathPrefix and applies it before resolve and Windo…
Out of Scope Changes check ✅ Passed The changes are limited to Windows path identity normalization in src/codex/history-manifest.ts and regression tests in tests/codex-integration/codex-history-provider.test.ts. Both changes directl…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: normalization of Windows extended-length and device path prefixes in the manifest logic. It also references the linked issue.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 62 / 80

이 PR은 이슈 #4442를 고치려는 초안이다. Windows에서 Codex v2 히스토리 매니페스트 무결성 검사가, 같은 파일을 가리키는 경로만 표기가 다를 때 서로 다른 파일로 보고 doctor/restore를 막는 문제다. 보고 증상은 backup manifest or restore target failed integrity checks — manual review required이고, 워크어라운드는 syncResumeHistory=false로 검사를 건너뛰는 것이다. 즉 데이터가 깨진 게 아니라 경로 동일성 판정이 resume을 막고 있다.

지금 dev HEAD(2df82f412, #4464 문서 마감 이후)의 src/codex/history-manifest.ts를 보면 codexHistoryPathIdentityresolve(path) 후 Windows에서만 소문자로 만든다. sameCodexHistoryPath는 그 결과를 비교하고, 같은 identity가 codexHistoryStateDbIdentitycodexHistoryBackupIdhistoryBackupPathFor(src/codex/history-provider.ts)로도 흘러가 백업 파일 이름(해시)을 만든다. 롤아웃 경로 비교는 history-provider.ts의 integrity 검사에서 sameCodexHistoryPath(row.rollout_path, entry.rolloutPath)로 쓰인다.

이 PR은 stripWindowsPathPrefix를 넣어 \\?\\, \\.\\, \\?\\UNC\\(및 슬래시 변형)를 resolve 전에 벗긴다. 방향은 #4442의 핵심(18/20이 접두사만 다른 경우)과 맞고, 범위도 매니페스트 identity + 회귀 테스트 두 개로 좁다. 초안이고 readiness checklist는 0/4다. CI hygiene/resolve/label은 통과했지만 mergeState는 BLOCKED(초안 게이트)다.

라인 57~68 근처(PR diff 기준 stripWindowsPathPrefix / codexHistoryPathIdentity) - identity를 바꾸면 롤아웃 비교뿐 아니라 백업 파일 이름도 바뀐다. #4442 댓글에 이미 적힌 경계다. 예전에는 \\?\\C:\\...로 해시된 codex-history-backup-*.json이 있을 수 있는데, 정규화 후에는 c:\\... 해시로 다른 이름을 찾게 되어 기존 백업이 사라진 것처럼 보일 수 있다. 옛 접두사 identity로 만든 매니페스트를 찾아서 유지/보수적으로 처리하는 호환 픽스처가 이 PR에 없다.

tests/codex-integration/codex-history-provider.test.ts 새 테스트들 - if (process.platform !== "win32") return;이라 Linux CI에서는 바로 return한다. 작성자가 로컬에서 91개 통과했다고 해도, 기본 CI(비-Windows)는 이 회귀를 한 번도 실행하지 않는다. Windows 전용 동작이면 의도적으로 플랫폼 가드를 풀거나, 접두사 strip 로직을 순수 문자열 단위로 분리해 OS와 무관하게 assert해야 한다. 지금 형태면 머지 후에도 회귀가 조용히 깨질 수 있다.

stripWindowsPathPrefix UNC 분기 - \\?\\UNC\\server\\share\\...\\ + slice(8)로 되돌리는 골격은 맞다. 다만 \\?\\UNC\\ / //?/UNC/ 길이·대소문자·짧은 접두사만 있는 깨진 입력에 대한 단위 테스트가 Windows 밖에서는 없고, 문서화된 계약도 없다. 또한 #4442에 따로 적힌 sessionsarchived_sessions 이동(2건)은 표기 alias가 아니라 실제 위치 변경이라 이 PR 범위 밖인데, PR 본문이 “Fixes #4442”만 쓰면 아카이브 케이스가 같이 닫힌 것처럼 보일 수 있다.

메인테이너의 판단이 필요한 지점

  • 옛 extended-path 해시 백업과 새 정규화 해시가 둘 다 있을 때, 어느 쪽을 권위로 두고 충돌을 어떻게 거절할지(침묵 덮어쓰기 금지).
  • archived_sessions 불일치를 #4442에 남길지, 후속 이슈로 쪼갤지.
  • Windows-only early-return 테스트를 CI 게이트로 받아들일지, 플랫폼 독립 assert를 요구할지.

너의 추천
초안 유지. 머지 전에 (1) 옛 \\?\\ identity로 이름 붙인 매니페스트가 정규화 후에도 발견·유지되는지 호환 픽스처를 추가하고, (2) Linux CI에서도 도는 strip/동일성 단위 테스트를 넣으며, (3) #4442 본문/체크리스트에서 archived_sessions는 별도 미해결로 명시하고 Fixes 범위에서 빼거나 후속 이슈를 링크하라. readiness 4칸과 최신 dev rebase 후에야 리뷰 완료로 보면 된다. types.ts/config.ts 분할 캠페인과는 무관한 매니페스트 identity 수정이라 close-don't-rebase 대상은 아니다.

이 댓글은 grok-bot이 작성했습니다

lidge-jun added a commit that referenced this pull request Sep 13, 2026
Lane I1 of the contributor carry train: two Windows defects reported without a source branch.

#4425 (wanjinxingoo-bot) — the generated LogonTrigger omitted UserId, so a non-elevated ocx service install failed and the resulting Access is denied was reported as an elevation problem. UserId is now emitted and the guidance stops blaming elevation. Pre-fix registrations carry an unscoped LogonTrigger and keep working; the live validator deliberately does not mark them unhealthy, because that would strand them in preserved-for-manual-review instead of repairing them.

#4442 (SeanChengN) — the Windows history manifest integrity check treated C:\... and \\?\C:\... as different paths, so it failed after sessions were archived. Prefix normalization now lives in the shared identity leaf. Because a prefixed state-db path hashed to a different manifest filename before this fix, readers fall back to the legacy manifest name when no canonical file exists, and when both exist the canonical wins with the legacy file left in place rather than silently replaced.

Credit for #4442: draft #4465 by maoxin1234, opened 2026-09-13T05:43Z, proposed the same normalization in the same two files before this lane existed. This landing is the more complete implementation but it supersedes that proposal, so the author is credited here per AGENTS.md rather than left out of the contributor graph.

Evidence. Cross-platform CI run 34744702809 concluded success on d9faa02, the exact head merged here. Because platform-windows is gated on workflow_dispatch and never runs on a pull request, this lane also obtained workflow_dispatch run 34744707214 of ci.yml with lane=all on that same SHA: all six windows shards executed and passed. #4483 carries no ci check of its own; its head commit carries [skip ci] by design and the cumulative tip run covers its content.

Co-authored-by: maoxin1234 <275637173+maoxin1234@users.noreply.github.com>
@lidge-jun

Copy link
Copy Markdown
Owner

Closing as superseded, with credit rather than without it.

The Win32 extended-length prefix normalization for #4442 landed on dev through #4486 (merge commit a3ca64f). You opened this draft first, on 2026-09-13T05:43Z, proposing the same fix in the same two files, so the landing carries a Co-authored-by trailer naming you in the merge commit. That is what GitHub reads for the contributor graph; a sentence in a description is not equivalent, and CREDITS.md exists in this repository because that distinction was missed 27 times.

What landed is a superset rather than a different design. It adds the backup-id compatibility fallback, which matters because a prefixed state-db path hashed to a different manifest filename before the fix: readers now fall back to the legacy manifest name when no canonical file exists, and when both exist the canonical wins while the legacy file is left in place rather than silently replaced. It also covers the native-residue observation path and updates the structure document, and it was verified on Windows through a workflow_dispatch run of ci.yml with lane=all, where all six windows shards executed and passed.

Your diagnosis was correct and it was first. Thanks for filing it.

@lidge-jun lidge-jun closed this Sep 13, 2026
lidge-jun added a commit that referenced this pull request Sep 13, 2026
…epseek-flash-vision

Lane I3 of the contributor carry train: the remaining #3775 catalog defect, and the deepseek-flash native-multimodal fix carried from #4467 by jaychou0642-create.

#4467 was found by the dispatch-time ownership re-check rather than by the candidate harvest — it was opened after the harvest and before this lane, by the person who filed #4436 — so it is carried with a Co-authored-by trailer instead of being reimplemented. That check exists because lane I1 implemented #4442 fresh while contributor draft #4465 had already proposed it.

The #3775 link is an implementation with no source branch. It bounds custom native-id effort lists on gateways, which is what #3804 deliberately left open pending Desktop gateway evidence; the original report is that evidence, since Desktop names gpt-6-astra in the 400 rather than the provider prefix. #4349 and the #4409 ladders do not fix this catalog projection.

Cross-platform CI run 34751593123 concluded success on 9f318cb, the exact head merged here, and it covers both links because the lane is cumulative. #4499 carries no ci check of its own under the owner-authorized tip-only CI economy for this batch.
FacuM pushed a commit to FacuM/opencodex that referenced this pull request Sep 13, 2026
Seven of eight wave-1 lanes are on dev; lane S stays green and unmerged pending
security review. Records the credit defect the wave surfaced: contributor draft
lidge-jun#4465 proposed the lidge-jun#4442 fix after the candidate harvest and before the lane, so
the I1 landing carries a Co-authored-by trailer for its author. Also records the
two planned carries that were already satisfied on dev, both found by attempting
the work rather than by reading the plan.
FacuM pushed a commit to FacuM/opencodex that referenced this pull request Sep 13, 2026
lidge-jun#4436 has an owning contributor pull request, lidge-jun#4467 by jaychou0642-create, opened
after the candidate harvest and before this lane. Lane I3 carries it with a
trailer instead of implementing the fix fresh. This is the wave-1 lidge-jun#4465 lesson
applied as a dispatch-time check rather than a note.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants