Repository navigation
Add opt-in Jev Auto Mode for hard-to-undo tool calls - #77
Merged
Merged
Conversation
langchain 1.5 added AutoModeMiddleware: a decision model scores each guarded tool call for risk and, at P(risky) >= 0.5, returns an error result instead of running it. AUTO_MODE=1 (with TYPESAFE_API_KEY) wires a Jev-backed subclass into the coordinator and every sub-agent, right after argument validation so a rejected call costs no Jev request. The subclass changes three things about the stock class: - State: the stock class sends the last 30 messages verbatim, which on a real session overruns Jev's 32k-token budget and would 400 nearly every check. Ours sends the shape context pruning already measured: task and latest request (head and tail), recent reasoning, the clipped call. - Instructions: the stock wording lets only explicit user messages authorize a call; ours treats a sub-agent's delegated task as authorization and asks about irreversible changes the task does not call for. - Errors: a classifier failure blocks that call with an explanatory result (fail closed) instead of propagating and failing the run. Only hard-to-undo tools are guarded by default: patch_bytes, assemble_code, scripts, project_files, open/close_program, import_file, export_program, analysis_options/control, and sandbox execute/delete. AUTO_MODE_TOOLS replaces the set. On a seven-case live probe, ours classified all seven correctly; the stock instructions put the requested patch at 0.44 and let an unrequested analysis-settings change through at 0.33 (ours: 0.52, close to the line). Extract make_jev_classifier from JevJudge so both share construction.
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.
langchain 1.5 added AutoModeMiddleware: a decision model scores each guarded tool call for risk and, at P(risky) >= 0.5, returns an error result instead of running it. AUTO_MODE=1 (with TYPESAFE_API_KEY) wires a Jev-backed subclass into the coordinator and every sub-agent, right after argument validation so a rejected call costs no Jev request.
The subclass changes three things about the stock class:
Only hard-to-undo tools are guarded by default: patch_bytes, assemble_code, scripts, project_files, open/close_program, import_file, export_program, analysis_options/control, and sandbox execute/delete. AUTO_MODE_TOOLS replaces the set.
On a seven-case live probe, ours classified all seven correctly; the stock instructions put the requested patch at 0.44 and let an unrequested analysis-settings change through at 0.33 (ours: 0.52, close to the line).
Extract make_jev_classifier from JevJudge so both share construction.