Skip to content

Commit dadc7cc

Browse files
committed
fix: 允许 inactive-by-config 受约束恢复配置引用
缺失顶层 model_instructions_file 不再只能手工改 config.toml。 --reactivate 在 manifest/MD 指纹匹配时只补回该字段并备份 live config, 不改写提示词、hooks 或 manifest。deploy 仍保持 blocked。 GUI 管理页提供同一预览门禁入口,修复 Windows GUI 无法重新激活 (#36)。
1 parent ae068de commit dadc7cc

20 files changed

Lines changed: 707 additions & 43 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ All notable changes to this project are documented here. The format follows [Kee
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- `inactive-by-config` now has a constrained `--reactivate` path. When the manifest and managed Markdown remain healthy and only the top-level `model_instructions_file` is missing, preview/confirm restores that field into the current live `config.toml` after a timestamped backup. Deploy stays blocked; Markdown, hooks, and the manifest are not rewritten. The GUI Manage page exposes the same preview-gated action, and Dashboard/Deploy point inactive-by-config users there instead of a full deploy (#36).
12+
913
## [0.3.8] - 2026-08-19
1014

1115
### Fixed

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- `python3 codex-instruct.py --version` 输出、Release tag 和 commit SHA;
1414
- 操作系统、Python 版本和 Codex CLI 版本;
1515
- 最小复现步骤、预期结果和实际结果;
16-
- 脱敏后的 `--status` / `--dry-run` 输出,以及是否涉及 deploy、recover、restore-hooks 或 uninstall;如果存在 durable journal,只报告 transaction ID 和节点类型,不粘贴完整内容。
16+
- 脱敏后的 `--status` / `--dry-run` 输出,以及是否涉及 deploy、recover、restore-hooks、uninstallreactivate;如果存在 durable journal,只报告 transaction ID 和节点类型,不粘贴完整内容。
1717

1818
公开内容必须删除 token、cookie、用户名、私人路径、完整配置和 Prompt Bank 响应。安全漏洞请按 [安全政策](SECURITY.md) 私密报告。
1919

@@ -61,7 +61,7 @@ git diff --check
6161

6262
当前完整测试集为 400+ 项;不要通过删除测试、缩小覆盖范围或降低合并后的 branch coverage 81% 门槛让 CI 通过。Release 验证必须使用完整、非 shallow 的 checkout 并取得全部 tags。候选构建必须使用完整 `--source-commit` 并精确匹配 HEAD,并能以非交互、有限超时方式验证每个已配置 remote 的同名 tag;remote 不可达、需要认证或与本地 tag/候选 commit 不一致时必须 fail closed。如果 `v$VERSION` 已存在于其他 commit,builder 必须拒绝且不得生成同版本资产。正式发布构建必须省略该参数,并要求版本 tag 已存在且精确指向 HEAD。Release 相关改动必须验证 ZIP、tar.gz、独立脚本、密封 `codex-keysmith-scenarios-v<VERSION>.bundle` 和 `SHA256SUMS` 可重复构建、内容完整且版本一致。不可变 tag 的恢复发布不得重写 tag 或沿用旧 run;必须从 `main` 输入完整 tag object/peeled commit,令同一 run 的所有阻断测试与 publish job checkout 该 tag,并按 numeric Release ID 操作 draft。
6363

64-
Pull Request 需说明改动原因、用户可见影响、文件写入与恢复边界、验证结果和文档/CHANGELOG 影响。Windows fresh deployment 已按 `EXPLICIT_BETA` 开放;相关改动必须保留 preview/执行路径的 beta 警告,并确保 status、recover、uninstallrestore-hooks 不误报。P0 原生后端与阻断式 recovery/lifecycle CI 不构成正式支持徽章或无边界兼容性声明。P1 仍需逐阶段硬中断、路径别名、长路径、本地化目录与 cleanup double-fault 证据,P2 正式支持边界仍未关闭。Live Prompt Bank 不属于 PR gate,不要在 PR 中加入 API 凭证或产生付费调用。
64+
Pull Request 需说明改动原因、用户可见影响、文件写入与恢复边界、验证结果和文档/CHANGELOG 影响。Windows fresh deployment 已按 `EXPLICIT_BETA` 开放;相关改动必须保留 preview/执行路径的 beta 警告,并确保 status、recover、uninstallrestore-hooks 与 reactivate 不误报。P0 原生后端与阻断式 recovery/lifecycle CI 不构成正式支持徽章或无边界兼容性声明。P1 仍需逐阶段硬中断、路径别名、长路径、本地化目录与 cleanup double-fault 证据,P2 正式支持边界仍未关闭。Live Prompt Bank 不属于 PR gate,不要在 PR 中加入 API 凭证或产生付费调用。
6565

6666
---
6767

@@ -74,7 +74,7 @@ Before opening a bug report, search existing issues and use the bug form. Includ
7474
- `python3 codex-instruct.py --version`, the Release tag, and commit SHA;
7575
- operating system, Python version, and Codex CLI version;
7676
- minimal reproduction steps, expected behavior, and actual behavior;
77-
- redacted `--status` / `--dry-run` output and whether deploy, recover, restore-hooks, or uninstall is involved. If a durable journal exists, report only its transaction ID and node types, not complete content.
77+
- redacted `--status` / `--dry-run` output and whether deploy, recover, restore-hooks, uninstall, or reactivate is involved. If a durable journal exists, report only its transaction ID and node types, not complete content.
7878

7979
Remove tokens, cookies, usernames, private paths, complete configuration, and prompt-bank responses from public content. Report vulnerabilities privately through [SECURITY.md](SECURITY.md).
8080

@@ -90,4 +90,4 @@ For a contribution:
9090

9191
The current full suite contains 400+ tests. Do not remove tests, narrow measured source, or lower the combined 81% branch-coverage gate to make CI pass. Release verification requires a complete, non-shallow checkout with all tags. Candidate builds must pass a full `--source-commit` that exactly matches HEAD and must verify the same tag on every configured remote with non-interactive access and a finite timeout. An unreachable or authentication-gated remote, or any disagreement with the local tag/candidate commit, must fail closed. If `v$VERSION` already exists at another commit, the builder must refuse without generating same-version assets. A formal build must omit that option and require the version tag to exist at HEAD. Release changes must verify reproducible ZIP, tar.gz, standalone-script, sealed `codex-keysmith-scenarios-v<VERSION>.bundle`, and `SHA256SUMS` assets with complete content and consistent versions. Recovery publication for an immutable tag must not rewrite the tag or reuse an older run; it must start from `main` with the full tag-object and peeled-commit SHAs, make every blocking and publish job check out that tag in the same run, and address the draft by numeric Release ID.
9292

93-
A pull request must describe the reason, user-visible impact, file-write and recovery boundary, verification evidence, and documentation/CHANGELOG impact. Windows fresh deployment is open under `EXPLICIT_BETA`; related changes must preserve the beta warning on preview and execution without emitting it from status, recover, uninstall, or restore-hooks. The native P0 backend and blocking recovery/lifecycle CI are not a formal support badge or an unbounded compatibility claim. P1 still requires per-phase hard interruption, path aliases, long paths, localized profiles, and cleanup double-fault evidence, while the P2 formal-support boundary remains open. Live prompt-bank calls are not a PR gate; never add API credentials or paid calls to a pull request.
93+
A pull request must describe the reason, user-visible impact, file-write and recovery boundary, verification evidence, and documentation/CHANGELOG impact. Windows fresh deployment is open under `EXPLICIT_BETA`; related changes must preserve the beta warning on preview and execution without emitting it from status, recover, uninstall, restore-hooks, or reactivate. The native P0 backend and blocking recovery/lifecycle CI are not a formal support badge or an unbounded compatibility claim. P1 still requires per-phase hard interruption, path aliases, long paths, localized profiles, and cleanup double-fault evidence, while the P2 formal-support boundary remains open. Live prompt-bank calls are not a PR gate; never add API credentials or paid calls to a pull request.

README.en.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ The commands below use the Release single file. For a source checkout, replace t
8585
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --restore-hooks --lang en
8686
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --uninstall --lang en
8787
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --uninstall --yes --lang en
88+
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --reactivate --lang en
89+
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --reactivate --yes --lang en
8890
```
8991

90-
Each uninstall peels one layer. For an interrupted transaction, run `--status`, preview with `--recover`, then add `--yes`. Do not delete journals, backups, or the manifest by hand.
92+
Each uninstall peels one layer. If `--status` reports `inactive-by-config`, use `--reactivate` to restore only the missing top-level `model_instructions_file`. Do not edit `config.toml` by hand or run a full deploy just to put the field back. For an interrupted transaction, run `--status`, preview with `--recover`, then add `--yes`. Do not delete journals, backups, or the manifest by hand.
9193

9294
### Platforms and Beta limits
9395

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@ python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --yes --lang zh-CN
8585
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --restore-hooks --lang zh-CN
8686
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --uninstall --lang zh-CN
8787
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --uninstall --yes --lang zh-CN
88+
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --reactivate --lang zh-CN
89+
python3 codex-instruct-vX.Y.Z.py --codex-dir ~/.codex --reactivate --yes --lang zh-CN
8890
```
8991

90-
卸载每次只撤销最新一层。中断事务先 `--status`,再 `--recover` 预览,确认后加 `--yes`。不要手工删除 journal、备份或 manifest。
92+
卸载每次只撤销最新一层。`--status` 显示 `inactive-by-config`,用 `--reactivate` 只补回缺失的顶层 `model_instructions_file`,不要手工改 `config.toml`,也不要为补字段再走一遍完整部署。中断事务先 `--status`,再 `--recover` 预览,确认后加 `--yes`。不要手工删除 journal、备份或 manifest。
9193

9294
### 平台与 Beta 限制
9395

SECURITY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Live runner 使用临时工作目录、隔离 `HOME` / `CODEX_HOME`、`--ignore-
4242
- **中断事务恢复**:status 检出 durable journal 后,先运行 `--recover` 预览,再用 `--recover --yes` 按 journal `operation` 恢复该 transaction ID 的全部部署或卸载参与目录。不要编辑 `journal.json` 或删除快照来强制继续。
4343
- **用户配置卸载**:使用当前受信任脚本运行 `--uninstall` 预览,再用 `--uninstall --yes` 撤销最新一层 manifest-owned MD/config 状态;只有实际 isolated hooks 与 archived legacy 才属于该层。卸载在首次修改前发布 durable journal,硬中断后使用 `--recover` 恢复卸载前状态;重复 `--uninstall` 才会继续撤销更早层。
4444
- **仅恢复 hooks**:使用 `--restore-hooks``hooks.json.disabled` 恢复为 `hooks.json`;它不卸载 Markdown,也不更新 config。
45+
- **恢复缺失的配置引用**:当 status 为 `inactive-by-config` 且 manifest/MD 完好时,使用 `--reactivate` 预览,再用 `--reactivate --yes` 只把顶层 `model_instructions_file` 补回当前 live `config.toml`。它会备份当前配置,不改写受管提示词、hooks 或 manifest。不要手工编辑 `config.toml` 来绕过所有权检查。
4546
- **所有权冲突**:如果 manifest、受管理节点或必要备份发生漂移,工具会 fail closed。不要为了继续而编辑 manifest 或覆盖冲突文件;先复制整个配置目录并在私密报告中提供脱敏指纹与最小复现。
4647

4748
journal、intent、manifest companion、部署 manifest 与 cleanup marker 是防止意外漂移和普通并发竞态的一致性证据,不是带密钥的密码学认证。同一账户若协同改写多份证据或随机 cleanup claim,超出工具可证明的互斥边界。journal `mkdir` 到首份 intent 发布、以及单步骤 `mkdtemp` 到 residue record 持久化之间的极窄硬中断窗口,也会 fail closed 并要求人工核对,不会按前缀自动删除。
@@ -88,6 +89,7 @@ Code rollback and user-configuration recovery are separate operations:
8889
- **Interrupted-transaction recovery:** after status detects a durable journal, preview with `--recover`, then run `--recover --yes` to restore every deploy or uninstall participant selected by the journal `operation`. Do not edit `journal.json` or remove snapshots to force progress.
8990
- **User-configuration uninstall:** preview with `--uninstall`, then run `--uninstall --yes` to undo the newest manifest-owned MD/config layer. Only actually isolated hooks and archived legacy content belong to that layer. Uninstall publishes a durable journal before its first mutation; after a hard interruption, use `--recover` to restore the pre-uninstall state. Repeat `--uninstall` only to remove an earlier layer.
9091
- **Hooks-only restore:** `--restore-hooks` restores `hooks.json.disabled` as `hooks.json`; it does not uninstall Markdown or edit config.
92+
- **Missing config-reference restore:** when status is `inactive-by-config` and the manifest/Markdown are healthy, preview with `--reactivate`, then run `--reactivate --yes` to restore only the top-level `model_instructions_file` into the current live `config.toml`. It backs up the current config and does not rewrite the managed prompt, hooks, or manifest. Do not hand-edit `config.toml` to bypass ownership checks.
9193
- **Ownership conflict:** manifest, managed-node, or required-backup drift fails closed. Do not edit the manifest or overwrite conflicting files to force progress. Copy the complete configuration directory first and include only redacted fingerprints and a minimal reproduction in the private report.
9294

9395
Journal, intent, manifest-companion, deployment-manifest, and cleanup-marker data is consistency evidence against accidental drift and ordinary races, not keyed cryptographic authentication. Coordinated same-user edits to multiple evidence files or a random cleanup claim are outside the provable mutual-exclusion boundary. The narrow hard-interruption windows between journal `mkdir` and first-intent publication, and between per-step `mkdtemp` and durable residue registration, also fail closed for manual inspection rather than authorizing deletion by prefix.

0 commit comments

Comments
 (0)