Repository navigation
Conversation
appendJsonLine and appendJsonLineSync opened history with a+ and followed hard links and symbolic links, so quota, checkpoint, and closeout appends could mutate an inode outside the goal runs directory. Open only an exclusive regular file, and fail closed when checkpoint history is shared. Signed-off-by: Duang777 <duangjl007@gmail.com>
|
独立评审(native Windows)——代码与实测均通过,暂不给正式批准 精确核对 head: 代码评审
实测(native Windows,Node 24.20,NTFS)
CI 该 head 上 Python 分片被跳过(kernel-contracts 类型检查失败的连锁,3834 个错误属仓库级、与本 PR 无关),无完整套件结果——按我的惯例不给正式批准,但代码与实测均无发现,机器人评审通过后维护者可放心合并。 未验证:POSIX 运行; |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
需要依靠当前 Goal 的本地运行记录判断额度、监控和 checkpoint 的操作者。 追加或读取已有运行历史时,路径可能指向共享文件。 当前提交的七个反例均按预期拒绝,测试确认关联文件保持原字节,独占文件的创建与未终止尾部追加通过。 交付范围是共享 JSONL 追加和 checkpoint index 的读回,执行丢失收口的既有匹配读取单独保留。 执行丢失收口对已有匹配行的信任边界仍待单独验证。
改动思路 / Approach
复用现有同步和异步追加入口,打开前检查目录项,打开后校验实际描述符的常规文件、引用数和可用的文件身份,再追加或读取。 追加规则由共享 I/O 层持有,checkpoint 保留自己的不确定提交诊断和原 Turn 读回要求。 交付范围是共享 JSONL 追加和 checkpoint index 的读回,执行丢失收口的既有匹配读取单独保留。 appendJsonLine appendJsonLineSync readExclusiveHistory evaluateQuotaMonitorPollCommit
具体改动 / Changes
精确提交 715ca39,基线 811c1a1。核对了全部 5 个净路径(+381/-13)。两处生产文件处理打开前后身份及已有记录读取,另三处测试覆盖追加、checkpoint 和 monitor-poll。
- EXCLUSIVE-JOURNAL-APPEND。同一组 115 项测试用于基线时,七个软链、硬链以及 checkpoint 读回反例未按预期拒绝。其余 108 项通过。当前提交的七个反例均按预期拒绝,测试确认关联文件保持原字节,独占文件的创建与未终止尾部追加通过。
- CHECKPOINT-REPLAY-READBACK。精确头五个 TS 套件 115 项通过、无跳过。两端三份 Python 套件各 80 项通过。checkpoint 保持 checkpoint_commit_unknown 和读回原 Turn 的要求。已有准入、回执、锁和幂等重试继续由现有 owner 处理。
原生 monitor-poll 提交及 checkpoint 读回的反例通过。已有 CLI 侧的收口和额度正反例在基线与精确头各 80 项通过。 控制面 TypeScript 类型检查、Git 净差及标准本地预合并通过。 验收依据
对主干的风险 / Risks
匹配的既有收口历史读取仍在本切片之外。作者已披露描述符检查后目标引用数仍可能变化。两者均不作为已修复范围。 本轮用 macOS/Node 在隔离合成文件验证,未复测 Windows 和并发换址窗口,也未查询远端 CI。 checkpoint 保持 checkpoint_commit_unknown 和读回原 Turn 的要求。已有准入、回执、锁和幂等重试继续由现有 owner 处理。 精确头五个 TS 套件 115 项通过、无跳过。两端三份 Python 套件各 80 项通过。
我的整体评价 / Verdict
APPROVE。 主干 7 个预期拒绝反例在当前提交全部通过。认可追加与 checkpoint 读回这两个交付边界。
本地运行记录的既有 CLI 入口与恢复方式继续可用。
English verdict: APPROVE at 715ca39. The seven scoped regressions fail on the base and pass here. Healthy append, replay, and accounting checks pass. Pre-existing closeout read coverage and post-check races remain outside this fix.
Goal And Delivered Outcome
atomicWriteText/durableWriteJsonalready retarget the directory entry. PRs fix(quota): reject hard-linked quota artifacts inside the runs directory #9466 and fix(control-plane): reject hard-linked checkpoint artifacts #9512 closed exclusive-file holes on some artifact readers and writers, and accounting already rejects a hard-linked run index, butappendJsonLine/appendJsonLineSyncand the checkpoint, monitor-poll, and closeout history appends did not.inspectCheckpointReplayaccepted a hard-linked or symlinkedindex.jsonlas committed history. After, those appends and that replay fail closed, the outside sentinel is unchanged, and an exclusive file is still created and still accepts a row after an unterminated tail.mainat811c1a1f66652d3fc3b9830d467e14b45b7423c1.Author Declaration
Implemented against
nlink === 1) and symbolic links (O_NOFOLLOWwhen available, pluslstat/fstat)appendJsonLine,appendJsonLineSyncinloopx/control_plane/effect_runtime_io.tstests/control_plane_ts/effect_runtime_io.test.tsindex.jsonlevaluateQuotaMonitorPollCommitvia the shared helpertests/control_plane_ts/quota_monitor_poll_commit.test.tsindex.jsonlso replay cannot trust shared historyindexBytesinloopx/control_plane/goals/checkpoint_commit.tstests/control_plane_ts/checkpoint_commit.test.tscommitCheckpointalready maps any append throw tocheckpoint_commit_unknown; the helper throws before writingrowsinloopx/control_plane/quota/execution_loss_closeout.tsloopx canary premerge.Scope And Continuation
rows()reader can still treat a pre-seeded hard-linked or symlinked index or event log as already recorded and skip the append. That reader was left unchanged.Validation
715ca39a2df31d1d053a70030051457de1d76db9regression_parityfailedappendJsonLine/appendJsonLineSynccases and the monitor-poll commit case reportedMissing expected rejection; twoinspectCheckpointReplayindex cases reportedMissing expected exception. A separate reproduction showed the outside sentinel gaining the JSON line and checkpoint replay returning success.unitpassednode --no-warnings --experimental-sqlite --experimental-strip-types --test --test-concurrency=4oneffect_runtime_io.test.ts,checkpoint_commit.test.ts,quota_monitor_poll_commit.test.ts,quota_spend_commit.test.ts, andquota_void_commit.test.ts: 115 tests, 115 passed, 0 failed.staticpassednpx tsc --project tsconfig.control-plane.json --noEmitexited 0.staticnot_runloopx canary premergenot run.See validation disclosure guidance.
Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).Residual risks
fstatand before the append write can still alias the inode.O_NOFOLLOWcloses a symlink swap on platforms that provide it; where it is absent,lstatthenopenstill has that window.nlinkis not a reliable hard-link count, and tests skip hard-link cases whenlinkfails (EPERM,ENOTSUP,EOPNOTSUPP,EXDEV,ENOSYS).execution_loss_closeoutstill readsindex.jsonland the goal event log without an exclusive-file check. The append now fails closed when the row is absent, but a pre-seeded matching row can still be trusted and the append skipped.Written by: duang777 (@Duang777)