fix(harness): replace implicit .harness-active absence with explicit .harness-reflect marker for self-reflect triggering

Fixes two bugs:
- False positive: stale harness-tasks.json from previous runs triggered self-reflect when harness wasn't active
- False negative: self-reflect didn't trigger after harness completed all tasks

Generated with SWE-Agent.ai

Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
cexll
2026-03-02 00:30:34 +08:00
parent 683409464c
commit 08877af530
3 changed files with 54 additions and 14 deletions

View File

@@ -260,6 +260,11 @@ def main() -> int:
# If nothing left to do, allow stop
if not pending_eligible and not retryable and not in_progress_blocking:
_reset_block_counter(root)
# Signal self-reflect hook BEFORE removing active marker
try:
(root / ".harness-reflect").touch()
except Exception:
pass
try:
(root / ".harness-active").unlink(missing_ok=True)
except Exception: