Build a Production Permit for a Free-Model Write Job
说明与用途
创建 JSON 许可文件和检查脚本,确保 LLM 作业仅在满足所有证据和规则时才执行,从而实现失效关闭和回滚功能。
问题
Free-model LLM jobs can falsely report success, risking unintended writes to production data. There is no built‑in fail‑closed mechanism to ensure that a job only runs when all safety checks pass.
结果
The permit system prevents accidental writes by requiring a signed JSON contract and evidence files. It provides clear rollback paths and enforces strict output validation against golden fixtures.
工作流
- Create a folder structure with permit.json, check_permit.py, job.sh, fixtures, sandbox, out, and evidence directories.
- Write permit.json with fields: version, job, owner, lane, created_at, blast_radius (root, glob, max_files, max_bytes_out, deny_globs), evidence paths, and fail_closed rules.
- Add a golden fixture (good_note.md) and a thin fixture (thin_note.md) to test success and failure modes.
- Implement check_permit.py to read permit.json, verify evidence files exist, enforce lane and glob rules, and refuse if any check fails.
- Run check_permit.py before executing job.sh. If it exits with code 0, the job proceeds; otherwise it aborts.
- Use human_double_ack files to confirm real writes, enabling rollback by deleting permit.json or restoring previous output hash.
证据
The permit is one JSON file plus a checker. The model does not start until every gate has evidence.
Rollback is one permit file on disk. Delete permit.json and the job must refuse.
- 记录日期: 2026-09-22T04:30:32.695Z