Skip to content

fix(windows): resolve test-lock runtime known folder in process - #7203

Draft
lidge-jun wants to merge 1 commit into
devfrom
fix/windows-nested-test-lock-identity
Draft

lidge-jun wants to merge 1 commit into
devfrom
fix/windows-nested-test-lock-identity

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Windows x64 now resolves the effective user's LocalAppData in-process with SHGetKnownFolderPath, removing a fresh PowerShell startup and Add-Type compilation from runtime namespace resolution. This fixes the avoidable helper deadline on the nested Bun lock controller's cold path while preserving SID scoping, canonicalization/reparse refusal, required ACL hardening, and the existing live-lock assertions.

Evidence and diagnosis:

The native path uses the same LocalAppData GUID, KF_FLAG_DEFAULT_PATH, and null token as the existing helper. Shell32/Ole32 load from the OS-resolved system directory. UTF-16 decoding is bounded and CoTaskMemFree runs even for a failed HRESULT or decoding error, as required by the Windows API contract. Unsupported FFI retains the existing bounded trusted helper; native API failures refuse without an environment fallback. The SID helper and its existing timeout are unchanged.

Verification

  • bun install --frozen-lockfile — passed.
  • bun test tests/codex-integration/codex-user-identity.test.ts tests/windows/windows-popup-fix.test.ts tests/ci-workflows/test-runner.test.ts — 85 pass, 4 platform skips, 0 fail, 475 assertions, macOS/Bun 1.4.3. Includes the unchanged Windows live-lock case (platform-skipped locally) and a new Windows x64 test requiring the real in-process lookup even when the helper callback throws.
  • bun test tests/codex-integration/codex-coordinator-doctor.test.ts tests/codex-integration/codex-write-lock.test.ts tests/clients/client-lifecycle-lock.test.ts tests/ci-workflows/file-size-ratchet.test.ts tests/test-layout.test.ts tests/test-layout-tooling.test.ts — 79 pass, 0 fail, 848 assertions.
  • Deterministic red/green: forcing the selector back to the helper makes bun test tests/codex-integration/codex-user-identity.test.ts --test-name-pattern 'native known-folder resolution avoids' fail (0 pass / 1 fail). Restoring native selection passes (1 pass / 0 fail). The fixture models a timed-out probe without sleeping. Additional portable tests cover GUID/flags/null token, Unicode including surrogate pairs, HRESULT failure, null output, decoding failure, bounded unterminated output, allocation cleanup, and refusal without fallback.
  • bun run typecheck, bun run structure:check, bun run privacy:scan, git diff --check — passed. Structure documentation stays within the existing 600-line codex-home budget; no ratchet caps or test-layout registrations changed (coverage extends an existing registered file).
  • Full suite / broad import-connected selection not run locally under the shared-worktree resource exception: this resolver is imported throughout the runtime, and concurrent implementation lanes share the host. Focused lock/namespace/doctor suites and gates passed; full Linux/macOS coverage and real Windows ABI/controller execution remain with CI. This PR stays draft pending that evidence and explicit security review. No new skip of an existing test, retry, rerun bypass, timeout widening, or workflow-trigger change.
  • Dispatched gh workflow run ci.yml --repo lidge-jun/opencodex --ref fix/windows-nested-test-lock-identity -f lane=all exactly once: run 38757309924, event workflow_dispatch, head a1d50db6378db59a7245a2afb031e26feef3b842, currently queued. The normal pull-request run 38757292102 is also queued at that head. Neither is passing evidence; Windows execution and required checks remain pending.

Security review scope: effective-user namespace identity and native memory/DLL handling. Author inspection checked the 16-byte GUID layout, x64 pointer output, 32-bit HRESULT/flags, null current-user token, trusted absolute DLL paths, matching allocator/free routine, and fail-closed API errors. Maintainer security sign-off remains required under MAINTAINERS.md; no claim of independent approval is made.

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. Author boundary review is documented above; explicit maintainer security review is pending.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

This branch has not been deployed

No deployments
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.

1 participant