Skip to content

Codex Bugs Fix Solution

修复 Codex 沙箱模式的 Bug:批量检查并修复Windows文件/文件夹的所有者,清理未知用户和权限,拦截本不应该有的巨量写入请求。 | Fix bugs in Codex sandbox mode: check and repair the owners of Windows files/folders in batches, clean…

Install

$git clone https://github.com/JupiterLyr/Codex-Bugs-Fix-Solution

Install command taken from the project's README or registry entry. Always review code before running it.

Codex Bugs Fix Solution

本公开项目涵盖以下内容:

  • 因 Codex 造成 ACL 污染,需清理的无效的、未知的 SID
  • 将文件和文件夹的权限恢复给本应所属的用户
  • 拦截本不该出现的、对 log_2.sqlite 文件的巨量写入请求

This public project covers the following contents:

  • Invalid and unknown SID that needs to be cleaned up due to ACL pollution caused by Codex.
  • Restore the user to whom the permissions of files and folders belong.
  • Intercept a huge amount of write requests to the log_2.sqlite file that should not have done.

最新版统一了脚本入口,支持以管理员身份运行 Run-SID-Tools.cmd

The latest version unifies the script entry and supports running run-sid-tools.cmd as an administrator

Content

  1. 【脚本使用前必读】脚本使用说明 | Scripts Instruction
  2. 【如果还有乱码请阅读】PowerShell 代码页设置 | PowerShell Code Page Settings

License

MIT License – Free to use, modify, and distribute. Use at your own risk.


脚本使用说明

简体中文 | English

重要说明

  • 不要用 Download ZIP,建议用 git clone 获取仓库,防止脚本被标记为 “从互联网下载” 而被 PowerShell 拦截运行!
  • 现在支持直接以管理员身份运行 Run-SID-Tools.cmd 作为三种不同脚本的入口了!

1. 拦截 logs_2.sqlite 的高频非 ERROR 日志写入

此处的拦截操作会保留 ERROR 级日志写入,仅丢弃其他级别的日志,可在减少无意义写入的同时保留排障所需的错误信息

  • 方式A:在 python 中运行 ./sqlite_fix/codex_log_repair.py,根据提示选择对 logs_2.sqlite 文件的拦截策略
  • 方式B:从 Release 发布页下载 codex-log-repair.exe 后直接运行(运行 EXE 程序可能引起杀毒软件误报,忽略即可)

2. 清理无效、未知的 SID,夺回文件/文件夹的用户所属权

  • 这个 bug 截至 2026.07.22 只在 Windows 系统上存在,其他系统或模拟器无需完成本节操作
  • 在管理员身份下打开 PowerShell,运行 ./sid_fix 中的 *.ps1 脚本
脚本名称 功能
Check-Owner.ps1 检查文件、文件夹的所属用户
Check-Unknown-SID.ps1 检查文件、文件夹是否存在已失效的、未知的 SID
Repaire-And-Clean.ps1 修复文件、文件夹所属用户权限,清理无效 SID

3. 关于输出文本

  • 如发现输出内容出现乱码,大概率是因为编码格式有误,请将 *.ps1 脚本设为 UTF-8 BOM,python 脚本设为 UTF-8

Scripts Instruction

简体中文 | English

Vital Notice

  • Use git clone to get the warehouse instead of Download ZIP to prevent the script from being intercepted by PowerShell when it is marked as "downloaded from the Internet"!
  • It is now possible to run Run-SID-Tools.cmd directly as an administrator, which serves as the entry point for three different scripts!

1. Intercept high-volume non-ERROR writes to logs_2.sqlite

This interception keeps ERROR level logs available for troubleshooting and drops other log levels to reduce unnecessary writes.

  • Method A: Run ./sqlite_fix/codex_log_repair.py in python, and choose the interception strategy for the logs_2.sqlite file according to the prompt
  • Method B: Download codex-log-repair.exe from the Release page and run it directly (Running EXE program may cause false positives of antivirus software, so just ignore it)

2. Clean up the invalid and unknown SID, reclaim the user ownership of files / folders

  • As of July 22, 2026, this bug only affects Windows systems; users of other operating systems or emulators do not need to follow the steps in this section.
  • Open PowerShell as an administrator and run the *.ps1 script in ./sid_fix
Script Name Function
Check-Owner.ps1 Check the owner of files and folders
Check-Unknown-SID.ps1 Check files and folders for invalid and unknown SID
Repaire-And-Clean.ps1 Repair the user rights of files and folders, and clean up invalid SID

Similar plugs

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

Open source Ghostty-based macOS terminal with vertical tabs and notifications for AI coding agents. Built for multitasking, organization, and programmability.

Orchestrate Claude, Codex and Grok in one app. Open-source (MIT), reuses the subscriptions you already pay for.

Superset is an agentic IDE to orchestrate 100+ coding agents in parallel. Run any agent with your own subscription.

Use Claude Code, OpenCode, Cursor CLI, and Codex on mobile and web with CloudCLI (aka Claude Code UI). CloudCLI is a free open source webui/GUI that helps you manage your…

Explore related