Merge pull request #334 from iamitp/codex/last-run-config-state

Preserve clean mode for last run state
This commit is contained in:
Trevin Chow
2026-05-17 00:56:28 -07:00
committed by GitHub
3 changed files with 147 additions and 0 deletions
+20
View File
@@ -6,6 +6,7 @@ from __future__ import annotations
import argparse
import atexit
import datetime
import json
import os
import re
@@ -531,6 +532,24 @@ def _show_runtime_ui(
progress.show_promo(promo, diag=diag)
def _write_last_run(topic: str, report: "schema.Report") -> None:
try:
if env.CONFIG_DIR is None:
return
target = env.CONFIG_DIR
target.mkdir(parents=True, exist_ok=True)
counts = {source: len(items) for source, items in report.items_by_source.items()}
payload = {
"topic": topic,
"timestamp": datetime.datetime.now(datetime.timezone.utc).isoformat(),
"sources": counts,
"total": sum(counts.values()),
}
(target / "last-run.json").write_text(json.dumps(payload, indent=2))
except Exception:
pass
def main() -> int:
parser = build_parser()
# Use parse_known_args so setup sub-flags (--device-auth, --github,
@@ -870,6 +889,7 @@ def main() -> int:
report, progress, diag,
suppress_web_promo=bool(external_plan or comp_plan),
)
_write_last_run(topic, report)
if args.store:
counts = persist_report(report)
sys.stderr.write(