feat(runtime/pathfinder): stuck-replan watchdog — react to mid-path obstacles
Problem (live 2026-05-26 screenshot): player drops a block in front of the bot mid-path. mineflayer-pathfinder computes the path once when goto() is called and never recomputes for world changes. Bot pushes forward against the new block until the 30–60 s goto timeout fires, visible as the bot just standing there pressing W. Fix — runtime/pathfinder-watchdog.js: per-bot poll loop (2 s tick) that runs while bot.pathfinder.goal is non-null. Tracks horizontal position. If movement < 0.5 blocks for > 6 s after an initial 1.5 s grace, forces a replan: setGoal(null) + setGoal(<same goal>) on a 250 ms delay. That makes the planner rebuild the path against the current world, so it routes around the new block — or, with canDig=true in our profiles, digs through it. Capped at 3 replans per goal so a genuinely unreachable target still bubbles up to the caller's timeout. Side benefit: catches mineflayer-pathfinder issue #222 ("path hangs on unreachable goal") much earlier than our 45 s goto wrappers. Wired into bot.js on the "spawn" event and stopped on gracefulExit. 7 new unit tests cover the polling math + replan cap. 197/197 green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@
|
||||
"tui": "tsx tui/tui.tsx",
|
||||
"propose:apply": "node scripts/propose-apply.js",
|
||||
"stop": "bash scripts/stop.sh",
|
||||
"test": "node --test runtime/skills/contract.test.js runtime/skills/groups.test.js runtime/skills/compat.test.js runtime/skills/recovery-tunnel-out.test.js runtime/curriculum.test.js runtime/social/social.test.js runtime/social/conversation.test.js runtime/social/chat-history.test.js runtime/social/reply-pi.test.js runtime/stuck-incident.test.js runtime/compat.test.js runtime/reflex.test.js runtime/base-site.test.js runtime/locations.test.js runtime/watch-filter.test.js runtime/world-journal.test.js runtime/scenario-memory.test.js runtime/critic.test.js runtime/skill-library.test.js runtime/modes.test.js scripts/edit-scope.test.js scripts/lint-patch.test.js"
|
||||
"test": "node --test runtime/skills/contract.test.js runtime/skills/groups.test.js runtime/skills/compat.test.js runtime/skills/recovery-tunnel-out.test.js runtime/curriculum.test.js runtime/social/social.test.js runtime/social/conversation.test.js runtime/social/chat-history.test.js runtime/social/reply-pi.test.js runtime/stuck-incident.test.js runtime/compat.test.js runtime/reflex.test.js runtime/base-site.test.js runtime/locations.test.js runtime/watch-filter.test.js runtime/world-journal.test.js runtime/scenario-memory.test.js runtime/critic.test.js runtime/skill-library.test.js runtime/modes.test.js runtime/pathfinder-watchdog.test.js scripts/edit-scope.test.js scripts/lint-patch.test.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"canvas": "^3.2.3",
|
||||
|
||||
Reference in New Issue
Block a user