[Bug]: Storage cleanup throws on Git status output >64 KiB instead of returning the intended safe KEEP
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
Observed read-only on an existing managed worktree with many untracked files, T3 Code 0.1.3 on macOS:
- The cleanup local-change predicate uses
git status --porcelain=v1 -z --ignore-submodules=none --untracked-files=all, withmaxOutputBytes: 65536and without opting into bounded/truncated output. - Capture that Git command without modifying the checkout. On the observed checkout it exits 0, with stdout 1,796,287 bytes, stderr 0, and 18,421 NUL records, all untracked.
- In the retained native cleanup trace, the shared Git collector throws as soon as the accumulated chunk count exceeds the limit (recorded counter 131072), before cleanup can inspect
stdoutTruncated.
No cleanup command or deletion was invoked to obtain the current Git reproduction.
Expected behavior
The cleanup-scoped bounded inspection should conservatively KEEP the worktree with the intended "local changes exceed the inspection limit" reason. This is not a request to ignore local changes or globally change the shared Git executor's defaults.
Actual behavior
The executor's default appendTruncationMarker: false throws first. The cleanup stdoutTruncated guard is unreachable on this path, so the candidate is recorded FAILED and retained. The ignored-files inspection has the same option/guard mismatch, although no overflowing ignored listing was observed here.
Impact
Minor bug or occasional failure: persistent failed cleanup result for affected checkouts, obscuring the intended safety refusal. No unsafe deletion was observed.
Version or commit
Installed/running 0.1.3. Relevant installed functions match pinned v0.1.3 source at d2c440312e5f39d59827ed466838a623516454d6.
Environment
macOS desktop app; Any local files protection enabled.
Logs or stack traces
git: Git output exceeded 65536 bytes and was truncated.
Only byte/record counts were emitted during investigation; no filenames, conversations, private branches or credentials are attached.
Workaround
No workaround that weakens local-file protection is recommended. Preserve local work.
References
This is separate from shared-owner KEEP behavior in #17816; fixing this error does not itself make protected worktrees eligible.
Still happens on 0.1.7 (Beta, macOS). In one sweep, 14 worktrees failed with GitCommandError: Git output exceeded 65536 bytes and was truncated in StorageCleanup.localChanges. The output lengths were 92–131 KB, mostly from untracked venv/ folders under evidence directories. They show up as failed in the report and in logWarning, when the intended result is kept: local changes exceed the inspection limit.