Repository navigation
feat(preallow): redact saved output, cap judge calls, log every ask - #33
Merged
Merged
Conversation
Three weeks of the log on two machines, about 90,000 judged calls, showed where the plugin still cost a session something. The full output a large result leaves in a file was withheld whole when the file held a credential-shaped value, most often a full process listing in which one process carries a token in its arguments. A hook can read and write that file, so the file is now redacted where it lies, after the file, the text, and the record have all been scanned, and each value found in one is redacted in the others. Only a file directly in the session's own `tool-results` directory is rewritten: a result is a tool's or a hook's to fill and could name any file the user keeps. The output is still withheld when the file cannot be read or rewritten. A first-stage model call that stalled held the tool call for the judge's whole 90 seconds before the second stage answered in a few. Each model call now has at most 45 of them and one that runs them out is made once more, as an empty reply is. The engine reports a call cut by its time limit and one the person interrupted the same way, so the time it took tells them apart: every stalled call in the log ended past its limit and every interrupt well before it. The log could not answer why some outputs were withheld, how often a redacted call was run again, or what auto mode denied among the calls the judge never saw. Every ask the plugin is shown in auto mode now ends in one line with the same fields whichever way it went, a query without a `tool_use_id` included; a call run again after its output was redacted or withheld is logged as `rerun`; `denied` is logged for any ask left to auto mode; a `withheld` line carries the caught failure's own message in `error`; a `judged` line counts the user's messages the judge read; and a `redacted` line says whether the saved file was redacted. The mod's AGENTS.md states what a line is for and when a field may be added. No call in either log had an input past 100,000 characters, so the branch that sent such a call to the classifier unjudged is removed and `isAnswered` is always set. `hooks/withhold.ts` keeps the patterns and `redact`; screening a result moves to `hooks/screen.ts` to stay within the file length limit, and the tests follow the same split.
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.
Three weeks of preallow's log on two machines, about 90,000 judged calls, showed three places where the plugin still cost a session something, and one branch no session ever reached. This is 0.0.12.
Saved output is redacted instead of withheld. When a large result leaves its full output in a file and the file holds a credential-shaped value, the whole output was withheld; most of these were full process listings in which one process carries a token in its arguments. The file is now redacted in place, after the file, the text, and the record have all been scanned, so a value found in one is redacted in the others. Only a file directly in the session's own
tool-resultsdirectory is rewritten, since a result is a tool's or a hook's to fill and could name any file the user keeps. The output is still withheld when the file cannot be read or rewritten.A stalled judge call no longer holds the tool call for 90 seconds. Each model call gets at most 45 of the judge's 90 seconds, and one that runs them out is made once more, as an empty reply is. The engine reports a call cut by its time limit and one the person interrupted the same way, so elapsed time tells them apart: every stalled call in the log ended past its limit and every interrupt well before it. The log labels the first
timeoutand keepsabortedfor the second.The log has one line for every ask the plugin is shown in auto mode, with the same fields whichever way the ask went, including a query without a
tool_use_id. A call run again after its output was redacted or withheld is logged asrerun,deniedis logged for any ask left to auto mode, awithheldline carries the caught failure's own message inerror, ajudgedline counts the user's messages the judge read, and aredactedline says whether the saved file was redacted. These are the questions the old log could not answer: why some outputs were withheld, how often a redacted call was run again, and what auto mode denied among calls the judge never saw. The mod's AGENTS.md now states what a line is for and when a field may be added.The 100,000-character input branch is removed. No call in either log came near it, and it only kept such a call from the judge.
hooks/withhold.tskeeps the patterns andredact, and screening a result moves to the newhooks/screen.tsto stay within the file length limit; the tests follow the same split.Two limits are left in place and listed under Known gaps: a redacted file is rewritten as text, so bytes in it that are not UTF-8 are replaced, and where Claude Code writes the saved path with
\, as on Windows, the output is withheld as before. Fact gathering after a latecheckreply is still not bounded by the judge's 90 seconds, as before this change.