Skip to content

feat(preallow): redact saved output, cap judge calls, log every ask - #33

Merged
liby merged 1 commit into
mainfrom
feature/preallow-decision-log-and-saved-output
Nov 19, 2026
Merged

liby merged 1 commit into
mainfrom
feature/preallow-decision-log-and-saved-output

Conversation

@liby

@liby liby commented Nov 19, 2026

Copy link
Copy Markdown
Member

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-results directory 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 timeout and keeps aborted for 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 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. 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.ts keeps the patterns and redact, and screening a result moves to the new hooks/screen.ts to 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 late check reply is still not bounded by the judge's 90 seconds, as before this change.

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.
@liby
liby merged commit 7dbe3ce into main Nov 19, 2026
4 checks passed
@liby
liby deleted the feature/preallow-decision-log-and-saved-output branch November 19, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant