fix: feat: SessionStart compact hook re-injects phase protocol after context compaction (#274)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-20 23:27:32 +00:00
parent 5c960f1b6e
commit e3895ad3ac
7 changed files with 86 additions and 8 deletions

View file

@ -267,9 +267,16 @@ When all work is done and verify confirms zero tech-debt:
On unrecoverable error:
printf 'PHASE:failed\nReason: %s\n' 'describe error' > '${PHASE_FILE}'"
# Write phase protocol to context file for compaction survival
write_compact_context "$PHASE_FILE" "## Phase protocol (REQUIRED)
When all work is done and verify confirms zero tech-debt:
echo 'PHASE:done' > '${PHASE_FILE}'
On unrecoverable error:
printf 'PHASE:failed\nReason: %s\n' 'describe error' > '${PHASE_FILE}'"
# ── Reset phase + result files ────────────────────────────────────────────
agent_kill_session "$SESSION_NAME"
rm -f "$PHASE_FILE" "$RESULT_FILE"
rm -f "$PHASE_FILE" "${PHASE_FILE%.phase}.context" "$RESULT_FILE"
touch "$RESULT_FILE"
# ── Create tmux session ───────────────────────────────────────────────────