Skip to content

Commit d2bce2a

Browse files
committed
merge: one git status per stop and a plain unfinished-git warning
2 parents 5f75f2a + 87f88ab commit d2bce2a

12 files changed

Lines changed: 809 additions & 60 deletions

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ All notable changes to Token-Goat are documented in this file. Format follows Ke
1111

1212
### Fixed
1313

14+
- **A report that claims a change on a clean tree no longer makes git run twice for the same stop.** The stop warning and the report receipt each asked `git status` for the same stop, so a git that answered took two runs. They now share one answer per stop, and when git is still running at the end of the receipt's 5 seconds, the warning reuses that result instead of asking again, so on Claude Code, Codex and the other hosts the parent waits at most 5 seconds instead of about 5.05. On Copilot CLI the stop warning asks first within the 50 ms hint bound, so a git that never answers is still asked a second time within 5 seconds, and the wait stays at about 5.05 seconds as before. A complete answer is shared on every host, and the clean-tree line still reaches the parent at the end of the report. Tests now pin, for Claude Code, Codex, Copilot CLI and VS Code, that this verdict never comes back as a block, an exit 2 or extra context that would re-prompt the subagent, and a test that read the stats table before anything had created it no longer fails when the suite runs in a different order.
1415
- **The pre-push focus decision and the lock-file commit check no longer do nothing when their script is started through a symlinked folder.** Four helper scripts decide whether they were run directly by comparing the module's real path with the path they were started by, which differ when the folder is a symlink (every macOS temp folder is one, as `/var` and `/tmp` point into `/private`). The script then exited 0 without doing anything: the pre-push step read an empty record of failing tests and fell back to the full leg with a blank commit in its message, and the commit-msg check let a `package-lock.json` change through under any subject. They now resolve the path first through one shared check, `scripts/is-main-module.mjs`, which also covers the scripts that compared the paths without resolving them and falls back to the plain path instead of crashing when the entry path does not exist, and a guard fails any script that compares the bare paths.
1516
- **The pre-compact manifest no longer runs git in a folder that is not inside a git repository.** When the manifest outgrew its size cap it asked git whether the working tree was dirty, even for a folder with no repository, where the answer could only be "nothing". On a slow machine that git run was cut off at the 50 ms limit, and the probe was likely still holding the folder when a Windows test tried to delete its scratch folder (`EBUSY`); this cause was not reproduced locally. The probe now looks for a `.git` entry in the folder or a parent (following a junction or symlink to the real folder), and skips git when there is none. A set `GIT_DIR` still counts as a repository.
1617
- **A git command that times out on Windows no longer leaves a git process running.** With Git for Windows first on PATH, token-goat started the small launcher `cmd/git.exe`, and a timeout ended only that launcher, so the real git kept running with its folder open, which could block deleting the folder. It now starts the real git directly, for older installs and Scoop shims too, and for Git for Windows 2.56, which keeps its real git in a `ucrt64` folder instead of `mingw64` (on that version the first fix still started the launcher), and for a folder name it does not know. Helpers that git itself starts (such as a git-lfs filter) are not yet ended on a timeout.
@@ -27,6 +28,7 @@ All notable changes to Token-Goat are documented in this file. Format follows Ke
2728
- **A cached test, lint or `git status` result is no longer served as fresh when git was killed while the working tree was being read.** Two reads that both timed out at the same commit looked identical, so a stale result could come back; a read git did not finish now counts as an unknown state.
2829
- **The branch hint now leaves the answer to git when a tag has the branch's name, when `GIT_CEILING_DIRECTORIES` is set, or when a linked worktree points at a repository that is gone.** In those cases git prints something else or refuses, and the hint no longer guesses.
2930
- **The resume packet now says when git did not answer, and `pr-slice` says so too.** A `git diff --stat` that timed out left the uncommitted-changes section out, which read as a clean tree, and a timed-out `git remote get-url` was reported as "could not resolve a GitHub repo".
31+
- **A subagent's report now says when `git status` did not finish, instead of reading as if nothing was wrong.** When a subagent's report claimed a change, token-goat checked it against `git status`, and a `git status` that was cut off was treated like a clean tree or like no answer, so the claim went through unchecked without a word. The receipt on the report the parent receives now carries one plain line, "git status did not finish, so this report's change claim was not checked." It takes the place of the claimed-a-change-never-made line, so a report still gets at most three lines. The receipt and the stop warning now share one `git status` per stop instead of asking git twice, and a stop warning asked without the receipt waits for git as long as the receipt does (5 seconds) without holding up the rest of the hook.
3032

3133
## [2.9.31] - 2026-10-16
3234

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ The fastest way to reduce AI token costs is fixing these six, not writing shorte
114114
| Subagent reads a ≥30 KB markdown file whole, on its first look at it | Off by default. Set `subagent_markdown_first_read_deny = true` under `[hints]` to block that read and answer with the heading tree instead. Only fires in a subagent, only on a first, un-ranged read of a `.md`/`.mdx`/`.markdown` file with at least three headings; a read that already asks for a line range, and every main-session read, pass through untouched |
115115
| Claude Code spawns an agent without `subagent_type` while tools-restricted agent definitions exist | Off by default. Set `agent_scoped_spawn_deny = true` under `[hints]` (or `TOKEN_GOAT_AGENT_SCOPED_SPAWN_DENY=1`) to refuse the first such spawn in a session and name the restricted agents, so the retry can pick one. An untyped spawn runs as general-purpose, whose context starts with every tool and MCP schema on the machine. Re-issuing the same call runs it: the refusal happens once per session. A spawn that names any `subagent_type`, `general-purpose` included, is never refused, and Copilot CLI and VS Code are left alone |
116116
| An agent ends its turn after editing source files that no test, lint, typecheck or build run has covered since | A one-time note at the Stop event names the unverified files and the checks that would cover them. It is an advisory, never a block, because a block at Stop can trap a session in a loop. Claude Code and Codex CLI show it; Copilot CLI's and VS Code's stop hooks accept only a block, so it stays silent there. Turn it off with `stop_verification_advisory = false` under `[hints]` (or `TOKEN_GOAT_STOP_VERIFICATION_ADVISORY=0`) |
117-
| A subagent finishes with a failed last check, source edited after its last passing check, or a report that claims a change it never made | Up to three lines are appended to the report the parent receives, saying which of those happened. A subagent with nothing to flag gets nothing added. On Copilot CLI the lines ride on the subagent report rewrite; the report part of that rewrite is the secret-redacted original, so a secret token-goat redacted stays redacted. Copilot's tool events carry no agent id, so there only the claimed-a-change-never-made check applies to a subagent (it reads the git tree), not the failed-check or unverified-edit flags. On Codex the lines ride on the result of the multi-agent v1 `wait_agent` tool, keyed on the subagent's thread id; Codex's v2 multi-agent tools return no report, so nothing is delivered there. VS Code Chat gets no receipt, because its SubagentStop payload carries no report text, and Visual Studio and JetBrains have no agent hooks. Turn it off with `agent_receipt = false` under `[hints]` (or `TOKEN_GOAT_AGENT_RECEIPT=0`) |
117+
| A subagent finishes with a failed last check, source edited after its last passing check, a report that claims a change it never made, or a report that claims a change when `git status` did not finish | Up to three lines are appended to the report the parent receives, saying which of those happened. When `git status` does not finish in time, the line says so ("git status did not finish, so this report's change claim was not checked"); that line takes the place of the claimed-a-change-never-made line, so the limit of three still holds. A subagent with nothing to flag gets nothing added. On Copilot CLI the lines ride on the subagent report rewrite; the report part of that rewrite is the secret-redacted original, so a secret token-goat redacted stays redacted. Copilot's tool events carry no agent id, so there only the claimed-a-change-never-made check applies to a subagent (it reads the git tree), not the failed-check or unverified-edit flags. On Codex the lines ride on the result of the multi-agent v1 `wait_agent` tool, keyed on the subagent's thread id; Codex's v2 multi-agent tools return no report, so nothing is delivered there. VS Code Chat gets no receipt, because its SubagentStop payload carries no report text, and Visual Studio and JetBrains have no agent hooks. Turn it off with `agent_receipt = false` under `[hints]` (or `TOKEN_GOAT_AGENT_RECEIPT=0`) |
118118
| Claude Code Bash command on Windows that contains two backslashes in a row | Run from a temp file when your permission rules already allow the command, otherwise refused before it runs, with the reason and what to do instead. Git Bash halves every run of two or more backslashes in the command it is handed, so an escaped path, a regular expression or a `printf` format string would run as different text with no error. A command that needs no prompt is written, as typed, to a file that deletes itself on its first line, and run from there; one that would prompt, or that uses `$`, a backtick, `eval`, rm or a protected path, is refused, because the prompt would show a file name and not the command. Then write the text to a file with the Write tool and run it by path, use the PowerShell tool, or use forward slashes in paths. A command over 7,000 characters with no such backslashes is left alone. Claude Code on Windows only; set `deny_bash_double_backslash = false` under `[hints]` (or `TOKEN_GOAT_DENY_BASH_DOUBLE_BACKSLASH=0`) to turn it off |
119119
| A source file is read whole for the first time, with no earlier copy to compare it against | Keeps each function's declaration and its first eight lines, replacing the rest with one line naming the symbol, the exact range removed, and the command that returns it. Set `fold_code_bodies = false` under `[hints]` to turn it off. Comment blocks of twelve lines or more fold to their first two on the same terms. Imports, signatures, type declarations, classes and interfaces are never folded, and a file whose index no longer matches what is on disk keeps its bodies. Measured on this repository's own source: 229 of 256 files fold, and 43% of what a read of them delivers is removed. A read that already names an offset or a limit, and any file holding something that looks like a secret, pass through untouched |
120120
| A source or markdown file of 50 KB or more is read whole for the first time, and token-goat has indexed its symbols or headings | The read goes through with a note naming the file's size, its symbol or heading count and the `read`, `outline` or `skeleton` command that returns just the part you need. Set `first_read_symbol_policy = "deny"` under `[hints]` (or `TOKEN_GOAT_FIRST_READ_SYMBOL_POLICY=deny`) to refuse the whole-file read instead, or `"off"` to say nothing. `first_read_symbol_bytes` sets the size (50000 by default, 0 turns the check off). Both can only be set in your global config or the environment: a repository's `.token-goat.toml` cannot set them |

0 commit comments

Comments
 (0)