fix(runtime): pin MC_VERSION=1.21.4 + ground-truth probe + close-loop dig

Two-pronged response to user-confirmed "bot stands still, doesn't actually
chop" on play.xmatic.team:

1. Pin protocol — .env now sets MC_VERSION=1.21.4. minecraft-data has
   wrong packet ID mappings for protocol 775 (server 26.1.2 via
   ViaBackwards 5.9.1) — see mineflayer#3888 and #3717. 1.21.5 also has
   an enchants decoder bug that breaks bot.dig. 1.21.4 is the last
   protocol mineflayer 4.37.1 can speak cleanly through VIA.

2. Don't trust dig success — runtime/actions.js chopNearestTree and
   runtime/skills/gather-stone.js now lookAt(face center)+forceLook,
   await collectBlock, then re-read the target block. If the log/stone
   is STILL there, return ok:false code:"silent_dig_failure" and
   blacklist the position. Prevents the curriculum from reporting
   "wood.16 in progress" while the world hasn't actually changed.

3. Defensive default — runtime/movement-profiles.js: canDig=false on
   every profile until dig is confirmed working live. Otherwise
   pathfinder schedules paths through must-dig blocks and the bot loops.

4. Ground-truth probe — runtime/skills/diagnose-physics.js dispatches
   forward/jump/dig probes and writes the result to the diary. New
   IPC command cmd:run-skill lets the operator (or a future curriculum
   trigger) fire any skill on demand; it waits for the current action
   to finish before dispatching. /tmp/pepa-runskill.mjs is a one-shot
   client.

Live probe on play.xmatic.team confirmed: forward Δ=0.003 over 2s
(BROKEN — server rejects movement packets), jump ΔY=0.42 (likely
physics jitter, not a real jump). Strongly suggests an anti-cheat
plugin gating bot-style movements server-side — beyond protocol pin.

npm test 124/124.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 11:51:43 +03:00
co-authored by Claude Opus 4.7
parent 19dc8e12c6
commit 86f0c1799e
9 changed files with 232 additions and 22 deletions
+23 -3
View File
@@ -372,6 +372,11 @@ export async function chopNearestTree(bot) {
});
if (!log) return { ok: false, detail: `no reachable log within ${SEARCH_RADIUS} blocks` };
// 2026-05-26: ground-truth verification + lookAt+force. On
// play.xmatic.team (1.21 via ViaBackwards) bot.dig/collect can return
// success even when the block survives — the server silently drops our
// serverbound packet (project_mineflayer_via_protocol_pin). We refuse
// to call it ok unless the block is actually gone from the world.
ensureCollectBlock(bot);
setMovementsForGather(bot);
const axe = await equipBestAxe(bot);
@@ -379,14 +384,29 @@ export async function chopNearestTree(bot) {
"action",
`chop: ${log.name} at ${log.position.x},${log.position.y},${log.position.z} (tool=${axe ?? "fists"})`,
);
const targetPos = log.position.clone();
const key = `${targetPos.x},${targetPos.y},${targetPos.z}`;
try {
try {
await withTimeout(bot.lookAt(targetPos.offset(0.5, 0.5, 0.5), true), 2_000, "lookAt(log)");
} catch {}
await withTimeout(bot.collectBlock.collect(log), 60_000, "collectLog");
return { ok: true, detail: { logType: log.name, at: log.position } };
const after = bot.blockAt(targetPos);
if (after && LOG_NAMES.includes(after.name)) {
warn("action", `chop reported ok but log still at ${key} — silent dig failure`);
blacklist.set(key, Date.now() + BLACKLIST_TTL_MS);
return {
ok: false,
code: "silent_dig_failure",
detail: "block still exists after collect — server dropped dig packet?",
blacklisted: targetPos,
};
}
return { ok: true, detail: { logType: log.name, at: targetPos } };
} catch (e) {
warn("action", `chop failed: ${e.message}`);
const key = `${log.position.x},${log.position.y},${log.position.z}`;
blacklist.set(key, Date.now() + BLACKLIST_TTL_MS);
return { ok: false, detail: e.message, blacklisted: log.position };
return { ok: false, detail: e.message, blacklisted: targetPos };
}
}