fix: address review — scratch file survives crash, cap read size, fix instruction (#262)

- Remove SCRATCH_FILE from action-agent cleanup() trap so it survives crashes
- Change instruction to note contents already injected (avoid wasted tool call)
- Cap scratch file read at 8KB via head -c 8192
- Move predictor scratch instruction after formula (consistent placement)
- Remove redundant FINAL_PHASE re-reads in planner/predictor

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-20 20:58:32 +00:00
parent 6405ac9837
commit 26d20af48c
4 changed files with 9 additions and 10 deletions

View file

@ -142,7 +142,7 @@ Periodically (every 10-15 tool calls), write a summary of:
- What remains to do
to: ${scratch_file}
If you find this file exists when you start, read it first — it is your previous context.
If this file existed at session start, its contents have already been injected into your prompt above.
This file is ephemeral — not evidence or permanent memory, just a compaction survival mechanism.
_SCRATCH_EOF_
}
@ -153,7 +153,7 @@ _SCRATCH_EOF_
read_scratch_context() {
local scratch_file="$1"
if [ -f "$scratch_file" ]; then
printf '## Previous context (from scratch file)\n%s\n' "$(cat "$scratch_file")"
printf '## Previous context (from scratch file)\n%s\n' "$(head -c 8192 "$scratch_file")"
fi
}