Grokbot burns token because tools fail to pull files

Where does the bug appear (feature/product)?

Grok Bot

Describe the Bug

Annotations
1 error
Invalid workflow file: .patches.yml#L33
You have an error in your yaml syntax on line 33 >>

Agent file write of large sources commits @file: / LOAD_FROM_FILE: stubs; git HTTPS push fails; large bodies cannot MCP-push

entire grokbot token budget decimated due to file chunking issue with push pull and other tools use with the github integration. Mostly was character byte limits.

Steps to Reproduce

Use this as Steps to reproduce. It is the same failure, shrunk to something a Cursor reviewer can run.

Environment
• Cursor agent / Grokbot with file-write (or apply-patch) + git
• A source file larger than a small patch (100KB+ is how we hit it; ParserCore was ~173KB)
• git remote over HTTPS (not SSH), no gh auth / credential helper

Steps

  1. Open a git repo with a large text file, e.g. copy any ~150KB .c / .py / .ailang to big.ailang.

  2. Ask the agent, in one turn:

    │ Replace big.ailang with a full valid rewrite of the same file (keep it ~150KB). Then git add big.ailang, commit, and git push over HTTPS.

  3. After the agent says it wrote and pushed, do not trust the chat. On disk / in git run:

wc -c big.ailang
head -c 200 big.ailang
git show HEAD:big.ailang | wc -c
git show HEAD:big.ailang | head

  1. If push is involved, also run:

git push origin HEAD

Expected
• big.ailang on disk and in HEAD is the full ~150KB source.
• git push authenticates and updates the remote.

Actual
• File on disk / in the commit is a 34–68 byte placeholder, not the body, for example:
• @file:/tmp/pc_forparen_only.ailang
• LOAD_FROM_FILE:/tmp/aimacro_assemble_tip/py2aim_tip_direct.push.json
• @/workspace/repos/…/Library.AIMacroCodeGen1.ailang82
• The path is on the agent VM, so a pull on another machine cannot expand it.
• HTTPS push: could not read Username for https://github.com.
• MCP/push of small files still works; large bodies do not, so the agent starts chunking (restore_staging micros) or committing the stub.

Concrete hits (this repo)
Repo: GitHub - AiLang-Author/AIMacro-Language: AIMacro: Python-alike for AILang. Blocks are { } (end is retired). AOT transpiler aimacro.x. · GitHub

┌───────────────────────┬────────────┬──────────────────────────────────────────┐
│ Step the agent took │ Commit │ Result │
├───────────────────────┼────────────┼──────────────────────────────────────────┤
│ “Write ParserCore │ 75ad365 / │ 173 342-byte parser → 34-byte @file:/tmp │
│ with for_paren fix” │ 6e6fefa │ /pc_forparen_only.ailang (4855 lines │
│ │ │ deleted) │
├───────────────────────┼────────────┼──────────────────────────────────────────┤
│ “Write py2aim.py tip” │ fdc67a7 │ ~37 909-byte script → 68-byte LOAD_FROM_ │
│ │ │ FILE:/tmp/…push.json │
├───────────────────────┼────────────┼──────────────────────────────────────────┤
│ “Write CodeGen1 │ 05e8b10 │ ~1017-line emitter → 1-line @/workspace/ │
│ module_const” │ │ repos/…CodeGen1.ailang82 │
└───────────────────────┴────────────┴──────────────────────────────────────────┘

Restore (proves the real files existed locally and never made it through write/push): 339701a, 3e1bc93.

Notes for the reviewer
• Repro is size + write-then-git, not AIMacro syntax.
• If they only test a 20-line file, they will miss it.
• Check the committed blob, not the agent’s “I wrote the file” message.

Operating System

Linux

Version Information

grok bot via Web interface chrome.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the detailed report with commit hashes. That made it a lot easier to debug.

What’s happening: when Grok Bot writes a file via the GitHub connector, the entire file content has to fit into a single tool call. For files around 100KB and up, that call gets truncated, and the bot inserts a placeholder like @file:/tmp/... or LOAD_FROM_FILE:... instead of the real file body. Nothing expands those references later, so the connector commits the placeholder as-is. The HTTPS push then fails with could not read Username because the bot environment doesn’t have a GitHub username set by default. I’ve passed this to the team.

For now, here’s a workaround that fully avoids the size limit, because git pushes the file from disk rather than via tool call arguments:

  1. Ask the bot: “Run gh auth login on your computer and give me the device code.”
  2. Confirm the login when the approval card shows up, and enter the code on github.com.
  3. Ask it to clone the repo, make changes as small targeted edits instead of rewriting the whole file in one step, then commit and git push.
  4. Add to your request: “Before committing, run wc -c on each changed file and stop if it is much smaller than the original.”

The .patches.yml#L33 issue is probably from one of these placeholder commits, so it’s worth checking that file too with git show HEAD:.patches.yml.

If you have questions about the usage that got charged for those failed runs, email [email protected] and they can look it up for your specific account. Let me know if the workaround helped.

i re based from patches i got from grok bot then deleted the 2 bots, i saw you team banging on the repo this morning. I had grok format the exact failure mode for you, seemed easier than me trying to reconstruct it. Keep me in the loop I am discontinuing using grokbot for now until you guys fix the fragility issues.

Got it, thanks for coming back with an update. It makes sense to pause on large files via the connector until the truncation of large tool call arguments is fixed, since that’s where the root cause is.

I’ve passed this to the team and it’s on our radar. As soon as there’s an update, I’ll reply right here in the thread.

If you decide to switch back to the grok bot until the fix is out, going through gh auth login plus small targeted edits plus git push from disk avoids the limit entirely, because the file is sent from disk instead of through tool call arguments. Let me know if anything else comes up.

it might be advisable to just changes the way the tool works then imho, change the model prompt skill and tool. I did that with my api client.

Totally agree with the direction. The real root cause isn’t the file write itself, it’s that the whole body is being pushed through the arguments of a single tool call, and with large files that gets truncated. Changing the approach, how the tool works plus the prompt or skill around it, so large data goes through a file on disk instead of through the model context, is exactly what we need. Thanks for describing how you solved this in your API client, that’s a useful signal and I passed it to the team.

I can’t share an ETA yet, but as soon as I have an update, I’ll post it right here in the thread.

And just in case you decide to temporarily switch back to the grok bot until the fix, gh auth login plus small targeted edits plus git push from disk fully bypasses the limit, because the file is sent from disk instead of through tool call arguments. Let me know if anything else comes up.