Codex Lid Keeper v0.2.1 App Alpha — Accurate Task Counts / 任务计数修复
Pre-releaseCodex Lid Keeper v0.2.1 App Alpha
MacBook testers wanted / 正在招募 MacBook 实机测试者
This patch focuses on one thing that must be trustworthy before a MacBook lid
closes: the running-task count.
这一版只盯住一个合盖前必须可信的问题:正在运行的任务数。
What was wrong / 原来的问题
A tester had three Codex tasks running at the same time. Open Island correctly
showed 3, while Codex Lid Keeper temporarily showed 2.
实机反馈中,同一时刻有三个 Codex 任务。Open Island 正确显示 3,但
Codex Lid Keeper 一度只显示 2。
The old runtime detector used Codex turn-state logs as its bootstrap source.
Those logs are accurate eventually, but a fresh turn may not emit the first
matching progress record until the agent reaches a later reasoning or tool
boundary. In the captured case:
- the missing task began at
10:52:34; - its first matching turn-state log arrived at
10:53:49; - the UI therefore lagged by about 75 seconds.
旧检测器依赖 turn 状态日志来补记任务。这类日志最后会变正确,但新任务可能要
等到后面的推理或工具节点才写出第一条匹配记录。实机里:
- 漏掉的任务在
10:52:34开始; - 第一条可用 turn 日志到
10:53:49才出现; - 界面因此慢了约 75 秒。
What changed / 现在怎么判断
Codex Lid Keeper now treats the lifecycle records already written to the local
rollout as the immediate source:
task_startedadds the matchingsession_id + turn_id;task_completeremoves it immediately;- the previous turn-state query remains as a compatibility fallback;
- trusted Hooks remain an independent safety path;
- all observations are deduplicated by Codex session.
现在会优先跟随本地 rollout 已经写下的生命周期标记:
task_started立即加入对应的session_id + turn_id;task_complete立即移除;- 原来的 turn 状态查询保留为兼容兜底;
- 受信任的 Hook 仍是一条独立安全链路;
- 所有来源最后按 Codex session 去重。
This also fixes the opposite failure: when a completion marker is already
present but an older log row still says “running,” the completed rollout state
wins. A finished task no longer stays counted just because the fallback log is
late.
反过来的误差也一起修了:如果 rollout 已经结束,但旧日志还停在“运行中”,以
结束标记为准,不会因为兜底日志慢半拍而继续多算。
Privacy boundary / 隐私边界
The new path is read-only and intentionally narrow:
- only recent non-archived thread identity, rollout path, working directory,
and update metadata are selected from Codex state; - no more than the final 4 MiB of each recent rollout is examined;
- ordinary lines are rejected before JSON decoding;
- the decoder models only the
event_msgenvelope, lifecycle event type, and
turn_id; - thread titles, previews, prompts, responses, and tool payloads are not
modeled or persisted; - the full working directory is reduced to its final component before it
enters Keeper state.
新链路是只读的,而且范围刻意压得很小:
- 线程库只取近期未归档任务的标识、rollout 路径、工作目录和更新时间;
- 每个近期 rollout 最多检查末尾 4 MiB;
- 普通行在 JSON 解码前就会被跳过;
- 解码结构只有
event_msg外层、生命周期类型和turn_id; - 任务标题、预览、提示词、回复和工具内容不会建立字段,也不会保存;
- 完整工作目录进入 Keeper 状态前只保留最后一级项目名。
Verification / 验证结果
45/45native Swift self-tests passed5/5Hook configuration tests passed- isolated dry-run lifecycle test passed
- Release build passed with warnings treated as errors
- app bundle plist and ad-hoc signature checks passed
- exact regression covered: three active rollouts while the fallback log sees
only two - completion regression covered: rollout completion suppresses a stale active
log record - same-moment local comparison matched Codex Desktop:
2 active / 2 active
after the third task finished
对应中文:
45/45项 Swift 自测通过;5/5项 Hook 配置测试通过;- 隔离 dry-run 生命周期测试通过;
- Release 构建在“警告视为错误”下通过;
- App plist 与 ad-hoc 签名检查通过;
- 已覆盖“三个 rollout 正在运行、兼容日志只看到两个”的精确回归;
- 已覆盖“rollout 已结束、旧日志仍显示运行”的回归;
- 第三个任务结束后,与 Codex Desktop 同刻对照均为
2 active。
Install or update / 安装或更新
This remains a source-built, ad-hoc-signed Alpha:
git clone https://github.com/Apex-Studio-He/codex-lid-keeper.git
cd codex-lid-keeper
./scripts/install.shIf you already cloned the repository:
git pull
./scripts/install.shThe installer asks for the administrator password through the normal macOS
Terminal sudo prompt. The app never reads or stores that password.
安装或更新时,管理员密码仍由终端里的 macOS 标准 sudo 流程询问。App 不会
读取或保存密码。
Please test / 希望你帮忙测试
The most useful test for this patch is:
- run two or three Codex tasks at the same time;
- keep Codex Lid Keeper open beside Codex Desktop;
- start one more turn and confirm the count changes within a few seconds;
- let one task finish and confirm the count drops again;
- only then proceed to the supervised closed-lid test in
TESTING.md.
这一版最希望大家帮忙验证:
- 同时运行两到三个 Codex 任务;
- 把 Codex Lid Keeper 与 Codex Desktop 放在一起对照;
- 再启动一个任务,确认几秒内加一;
- 等一个任务结束,确认数量及时减一;
- 数量稳定后,再按 TESTING.md 做有人看守的合盖测试。
Please include Mac model, chip, macOS version, Codex version, power mode, and
the before/after task counts in a
test report.
反馈时请带上 Mac 型号、芯片、macOS 版本、Codex 版本、供电模式,以及任务开始 /
结束前后的数量变化。
Alpha warning / Alpha 提醒
Codex Lid Keeper still depends on undocumented macOS behavior and is not
Developer ID signed or notarized. Never test a running closed MacBook in a bag,
sleeve, drawer, bed, sofa, or other poorly ventilated space. Keep the first
test supervised on an open desk and stop if the computer becomes unusually
warm.
项目仍依赖 macOS 未公开行为,也还没有 Developer ID 签名和 notarization。
不要把合盖运行中的 MacBook 放进包、内胆、抽屉、床铺、沙发或其他不通风环境。
第一次测试请放在开阔桌面并有人看守,机器异常发热就立即停止。