fix(pipeline): scratch files leaked into agent commits; install a logger - #276
Merged
Conversation
Both found by actually running an agent from a column end to end, which is the only reason either was visible. The git exclude never applied in a worktree. `execute_spawn_cli` built the exclude path by joining `.git/info/exclude` onto the working dir, then guarded on `.exists()`. In a linked worktree `.git` is a *file*, not a directory, so that path never exists — the guard found nothing and silently skipped the whole exclusion. Every worktree-based agent run has therefore been committing `.task.md`, and `.agent.md` had just inherited the same fate: the first dogfood run produced a commit containing `.agent.md`, `.task.md`, `agent-proof.txt` and `math.js`, where only the last two belong. `git rev-parse --git-path info/exclude` resolves the real common-dir file for both a plain repo and a linked worktree. `exclude_from_git` now uses it, is idempotent per pattern, appends only what's missing, creates the parent directory, and no-ops outside a repo. Re-running the same pipeline afterwards produced a commit with only `agent-proof.txt` and `math.js`. Nothing was installing a logger. The `log` crate is a silent no-op until something registers one, and nothing did — no `tauri-plugin-log`, no `env_logger`, no `set_logger` anywhere. All 202 call sites across the app were discarded, including 19 `log::error!`. That is what made the first dogfood failure undiagnosable: a trigger that failed and a trigger that never fired looked identical from outside. `env_logger` now initializes in `run()`, defaulting to `kaitencode=warn` and controllable with `RUST_LOG`. Turning it on immediately showed the full trigger path — argv, working dir, tmux channel — and the rest of this session was debuggable as a result. Also records in the roadmap that critical-now is empty (the stale /usr/local/bin/claude is gone, verified), and notes the same duplicate-binary shape now present for codex: /usr/local/bin/codex is 0.130.0 while fnm's shim is 0.145.0, the version every codex behaviour here was verified against. The fnm path is per-shell and lives in tmpfs, so a reboot or a launcher start hands the app the stale one. Checked: not currently breaking anything — both carry the flags the app uses and both have `resume --last`.
This was referenced Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both bugs found by actually running an agent from a column end to end — dogfooding #275. Neither was visible any other way.
The git exclude never applied in a worktree
execute_spawn_clibuilt the exclude path by joining.git/info/excludeonto the working dir, then guarded on.exists(). In a linked worktree.gitis a file, not a directory, so that path never exists — the guard found nothing and silently skipped the whole exclusion.So every worktree-based agent run has been committing
.task.md. This is pre-existing, not new;.agent.mdhad just inherited it. First dogfood run:Only the last two belong there.
git rev-parse --git-path info/excluderesolves the real common-dir file for both a plain repo and a linked worktree.exclude_from_gituses it, is idempotent per pattern, appends only what's missing, creates the parent dir, and no-ops outside a repo. Same pipeline re-run after the fix:Nothing was installing a logger
The
logcrate is a silent no-op until something registers one, and nothing did — notauri-plugin-log, noenv_logger, noset_loggeranywhere in the tree. All 202 call sites were discarded, including 19log::error!:That is exactly what made the first dogfood failure undiagnosable: a trigger that failed and a trigger that never fired look identical from outside. I spent several rounds guessing at DB state before realising the diagnostics I was looking for had never been emitted.
env_loggernow initializes inrun(), defaulting tokaitencode=warn, controllable viaRUST_LOG. Turning it on immediately printed the full trigger path — argv, working dir, tmux wait-for channel — and everything after that was straightforward.What the dogfood run proved about #275
Real agent, real column, real repo, isolated data dir:
--model sonnetfrom the agent config, not the workspace default.agent.mdwritten and followed: the agent wrote the proof token the instructions asked foradd(2, 3)→5agent_complete→ auto-advance Todo → Fix → Donereturn a - b→return a + bRoadmap
Critical-now is now empty — the stale
/usr/local/bin/claudeis gone (verified:which -a claudereturns one path, 2.1.239).Recorded a new env-hygiene note: the same duplicate-binary shape now exists for codex.
/usr/local/bin/codexis 0.130.0 while fnm's shim is 0.145.0 — the version every codex behaviour in this repo was verified against. The fnm path is per-shell and lives in tmpfs, so a reboot or a desktop-launcher start hands the app the stale one. Checked: not currently breaking anything — both carry--skip-git-repo-checkand--dangerously-bypass-approvals-and-sandbox, and both haveresume --last. Logged as latent, not urgent.Checks
cargo clippy -D warnings·cargo test559 (+2) ·tsc·eslint·test:ipc·test:type-scale·vitest444.