-
Notifications
You must be signed in to change notification settings - Fork 312
Description
Problem
The push_repo_memory safe-outputs tool rejects memory updates with:
Total memory size (29 KB) exceeds the allowed limit of 12 KB
(configured limit: 10 KB with 20% overhead for git diff format)
However, the actual files on the memory branch are tiny:
memory.json 190 bytes
state.json 161 bytes
Total: 351 bytes
The 29KB figure appears to be the accumulated git diff history across all commits on the memory branch, not the size of the current files or the current patch.
Root Cause
The memory branch (memory/repo-assist) accumulates one commit per workflow run. After 13 runs, the total diff history grew to ~29KB even though the actual files remain under 400 bytes. The push_repo_memory tool seems to calculate "total memory size" by summing all historical diffs rather than measuring the current file sizes or the size of the pending patch.
Impact
After enough workflow runs, push_repo_memory permanently fails with this error and the agent cannot save its memory. The agent job then fails with exit code 1.
Workaround
Force-push a squashed orphan commit to the memory branch to reset the diff history:
git fetch origin memory/repo-assist
TMP_DIR=$(mktemp -d)
git show origin/memory/repo-assist:memory.json > "$TMP_DIR/memory.json"
git show origin/memory/repo-assist:state.json > "$TMP_DIR/state.json"
git checkout --orphan squash-memory
git rm -rf .
cp "$TMP_DIR/memory.json" "$TMP_DIR/state.json" .
git add memory.json state.json
git commit -m "Squash repo memory to single commit"
git push origin squash-memory:refs/heads/memory/repo-assist --force
git checkout main
git branch -D squash-memory
rm -rf "$TMP_DIR"This is a one-time fix; the problem will recur after enough runs.
Suggested Fix
The push_repo_memory tool should validate against one or both of:
- Current file sizes on the memory branch (sum of all file sizes in the tree)
- Pending patch size (the diff being applied in this commit)
It should not sum the full git diff history of the branch, as that grows unboundedly with normal usage.
Alternatively, the tool could periodically squash the memory branch automatically (e.g., when the commit count exceeds a threshold) to keep the history compact.
Environment
- gh-aw version: v0.62.0
- Workflow: repo-assist (scheduled, runs ~daily)
- Memory branch had 13 commits when the error first appeared
- Config:
max_file_size: 10240, max_patch_size: 10240 - Observed in runs: 23405814621