fix(v0.3.1): mechanical food/stuck fixes — bot reaches the chicken now

The wedge wasn't only in the manifesto layer; several mechanical bugs
kept the bot in a dead random-walk:

- storyline / manifesto / curriculum: "local food" now means an edible
  passive mob within <=32 blocks. A distant chicken or a cod no longer
  fools the bot into dispatching acquire-food (which then fails on
  no_path). Long-range food goes through scout-food instead.

- scout-food: partial approach to a target now counts as progress
  (approached_target, e.g. moved:14); a blocked heading is NOT counted
  as movement; added blind/tunnel fallback so it doesn't die when the
  pathfinder can't route cleanly.

- acquire-food: on no_path it now also tries a blind/tunnel approach to
  the animal; no_drop routes back into food scouting instead of giving
  up.

- explore.far / relocate / flee: fewer false "done" results (micro-steps
  no longer counted as success), more genuine escapes from stuck.

- scripts/show-story.js: live IPC now actually renders the current
  storyline step.

Verification: scripts/lint-patch.js clean; npm test 404/404 green; bot
relaunched in tmux `pepa`. Live logs show real progress — bot switched
to survive.scout-food, approached the chicken (approached_target
moved:14), then reached survive.acquire-food: hunting chicken. Food
isn't fully closed yet but the remaining issue is concrete pickup/drop,
not dead random-walk.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 09:20:07 +03:00
co-authored by Claude Opus 4.7
parent b68d4b3ee7
commit 1cf60f81e9
19 changed files with 548 additions and 106 deletions
+15 -8
View File
@@ -18,12 +18,13 @@ const { pathfinder, goals, Movements } = pathfinderPkg;
import { info } from "../log.js";
import { markRelocationStarted } from "../awareness/wedge-detector.js";
import { blindWalkOrTunnelOut } from "./explore-far.js";
const CARDINALS = [
{ name: "N", dx: 0, dz: -1 },
{ name: "E", dx: 1, dz: 0 },
{ name: "S", dx: 0, dz: 1 },
{ name: "W", dx: -1, dz: 0 },
{ name: "N", dx: 0, dz: -1, yaw: Math.PI },
{ name: "E", dx: 1, dz: 0, yaw: -Math.PI / 2 },
{ name: "S", dx: 0, dz: 1, yaw: 0 },
{ name: "W", dx: -1, dz: 0, yaw: Math.PI / 2 },
];
const DEFAULT_DISTANCE = 300;
const STEP_BLOCKS = 32; // re-path every N blocks for liveness
@@ -37,7 +38,7 @@ function ensurePathfinder(bot) {
}
function setMovementsForTravel(bot) {
const m = new Movements(bot);
m.canDig = false;
m.canDig = true;
m.allow1by1towers = false;
bot.pathfinder.setMovements(m);
}
@@ -100,9 +101,15 @@ export const skill = Object.freeze({
]);
} catch (e) {
errors.push(e?.message ?? String(e));
if (errors.length >= 3) break;
// brief pause then keep trying
await new Promise((r) => setTimeout(r, 500));
info("action", `relocate: path step failed (${e?.message ?? e}); blind fallback ${cardinal.name}`);
const blind = await blindWalkOrTunnelOut(bot, {
yaw: cardinal.yaw,
dirName: cardinal.name,
blindMs: 12_000,
minMove: 8,
reason: `relocate ${cardinal.name}`,
});
if (!blind.ok && errors.length >= 3) break;
}
// Measure actual progress (pathfinder might have routed around)
const dx = bot.entity.position.x - start.x;