Skip to content

Add action logger#773

Open
Wavy77 wants to merge 3 commits into
mindcraft-bots:developfrom
Wavy77:pr-action-logger
Open

Add action logger#773
Wavy77 wants to merge 3 commits into
mindcraft-bots:developfrom
Wavy77:pr-action-logger

Conversation

@Wavy77
Copy link
Copy Markdown

@Wavy77 Wavy77 commented May 12, 2026

This PR adds an optional action logger for structured bot action logs.

The logger records successful block and item actions when action_logging is enabled in settings.js. It is disabled by default and is intended to help debug bot behavior without changing normal bot execution.

Included changes:

  • Add action_logger.js
  • Add action logging settings
  • Add settings UI spec entries
  • Integrate logging into skills.js
  • Add ACTION_LOGGING.md documentation

This PR intentionally excludes unrelated experimental features such as neural networks, replay execution, causal DAG logic, and broader agent architecture changes.

Comment thread settings.js Outdated
"spawn_timeout": 30, // num seconds allowed for the bot to spawn before throwing error. Increase when spawning takes a while.
"block_place_delay": 0, // delay between placing blocks (ms) if using newAction. helps avoid bot being kicked by anti-cheat mechanisms on servers.
"action_logging": false, // when true, write structured ACTION logs for successful bot block/item actions.
"action_log_file_prefix": "andy_log", // prefix for action log files in ./bots/<bot>/logs/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be hard coded. Or just use log by default. Maybe also with a timestamp.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i made the log name log__.... instead of andy_log in the new commit.

Comment thread src/agent/library/skills.js Outdated
**/
if (x == null || y == null || z == null) throw new Error('Invalid position to break block at.');
let block = bot.blockAt(Vec3(x, y, z));
const targetCoord = new Vec3(Math.floor(x), Math.floor(y), Math.floor(z));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Irrelevant for PR scope?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i used this function for more consistent block coord displaying inside the log, but yeah, i shouldn't have changed the global block definition. in the new commit i defined the floor function only inside the logging system, so the global bot.blockAt is not changed

Comment thread ACTION_LOGGING.md Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not important enough to have its own file. Consider moving to README.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i removed the actionlogging md in the new commit and merged it more succintly in the readme

@uukelele
Copy link
Copy Markdown
Contributor

I think it feels a bit unnecessary though, instead of embedding an action log function call within each action you probably want to implement it using a middleware pattern instead to reduce the verbosity. And maybe make the middleware simply log the function name called and the arguments used.

@uukelele
Copy link
Copy Markdown
Contributor

I notice you still have a lot of seemingly unnecessary helpers in the logging file which are probably already existing elsewhere I'm the codebase, and belong in utils anyway.

Also, the middleware implementation is still very repetitive, id have expected you to place the middleware where the actions are called instead of where they are defined.

Finally I'm not exactly sure why you even added this in the first place because the terminal logs are decent enough.

I guess I'll leave it to the other maintainers to review.

@Wavy77
Copy link
Copy Markdown
Author

Wavy77 commented May 27, 2026

i made the action appear like ACTION function:.. arg:... clicked_block:... yaw:... etc. new function should work through this wrapper. I still want to perserve clicked_block:... yaw:... because they're extermely useful in identifying bugs about placing blocks and especially bucket when the bot is building the nether portal.

By the way, I forked the repo to start my own experiment where I used a replay feature to have the bot be able to find a lava cluster and build a lava pool (at least in superflat its consistently able to achieve success given that the lava pool is a rectangle, in real world most of the issue is pathfinding due to mineflayer behavior). I wanted somebody to take a look and give their thought. The link of the repo is below (I stated explicitly experimental functions if you want to check it out):

https://github.com/Wavy77/Minecraft-AI-Agent-Lab

@uukelele
Copy link
Copy Markdown
Contributor

i made the action appear like ACTION function:.. arg:... clicked_block:... yaw:... etc. new function should work through this wrapper. I still want to perserve clicked_block:... yaw:... because they're extermely useful in identifying bugs about placing blocks and especially bucket when the bot is building the nether portal.

I think this is niche enough to stay within your fork and probably doesn't need to be added to the main repository.

By the way, I forked the repo to start my own experiment where I used a replay feature to have the bot be able to find a lava cluster and build a lava pool (at least in superflat its consistently able to achieve success given that the lava pool is a rectangle, in real world most of the issue is pathfinding due to mineflayer behavior). I wanted somebody to take a look and give their thought. The link of the repo is below (I stated explicitly experimental functions if you want to check it out):

https://github.com/Wavy77/Minecraft-AI-Agent-Lab

Cool, I was also implementing this as a PR in #629. I did run into the same issues as you did but with a completely different implementation -- rather than a replay feature, I manually wrote algorithms to place blocks around the lava pool.

@Wavy77
Copy link
Copy Markdown
Author

Wavy77 commented May 27, 2026

yeah, that's fine, thanks for reviewing.

i was just wandering if you're still actively working on this project. it seems like a lot of pushes and pr are just bug fixes, and no new major feature are being prepared.

I took a look at your fork and its around september. i knew that emergent garden himself stopped working on this project, so i was just curious about the outlook of the project

@uukelele
Copy link
Copy Markdown
Contributor

yeah, that's fine, thanks for reviewing.

i was just wandering if you're still actively working on this project. it seems like a lot of pushes and pr are just bug fixes, and no new major feature are being prepared.

I took a look at your fork and its around september. i knew that emergent garden himself stopped working on this project, so i was just curious about the outlook of the project

Most of the primary development by the original developers has come to a standstill due to various factors but mostly due to burnout and giving up trying to fight mineflayer which has a lot of quirks and broken mechanics.

Me, I am a maintainer so my role is primarily just reviewing PRs and helping to close issues. Although I do contribute my own PRs from time-to-time, it is not as frequent as I used to before I became a maintainer.

I think it's mainly due to the difficulties and unpredictability of working with mineflayer which is why we stopped.

If you are interested, the @mindcraft-ce team (of which I am a member of) is working on a rewrite in Java as a Minecraft mod, which you can install with any typical mod loader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants