[kimi] feat: pre-cycle state validation for stale cycle_result.json (#661) #666
Reference in New Issue
Block a user
Delete Branch "kimi/issue-661"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #661
Changes
Adds
validate_cycle_result()toscripts/loop_guard.pyas a pre-cycle defense-in-depth measure:cycle_result.jsonif older than 2×CYCLE_DURATION(configurable env var, default 5min → 10min stale threshold)cycle_result.jsonif the referenced issue is closed on GiteaAlso adds
_load_cycle_result()(with markdown-fence handling) and_is_issue_open()helpers.Tests
15 unit tests in
tests/loop/test_loop_guard_validate.pycovering:_load_cycle_result(): missing, valid, markdown-fenced, malformed_is_issue_open(): open, closed, no token, API errorvalidate_cycle_result(): no file, stale removal, closed issue removal, API failure graceful degradation, no issue field, threshold boundaryca46a6061etocca979d30b