mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 02:36:01 -10:00
fix(control): in yolo mode remember no longer asks for approval either, so neither memory tool prompts under the mode that skips every other approval
This commit is contained in:
1 parent
5b80976176
commit
26f72585ee
2 files changed
+9
-10
No files matched your search
@@ -211,9 +211,11 @@ func (c *Controller) newInteractiveGate() *permission.Gate {
|
||||
// `--allowed-tools remember` write memory with no prompt. Strip them so the
|
||||
// forced Ask rules below stay authoritative.
|
||||
policy.SessionAllow = rulesWithoutFreshHumanApproval(policy.SessionAllow)
|
||||
policy.Ask = append(policy.Ask, permission.Rule{Tool: memoryRememberTool})
|
||||
if mode != ToolApprovalYolo {
|
||||
policy.Ask = append(policy.Ask, permission.Rule{Tool: memoryForgetTool})
|
||||
policy.Ask = append(policy.Ask,
|
||||
permission.Rule{Tool: memoryRememberTool},
|
||||
permission.Rule{Tool: memoryForgetTool},
|
||||
)
|
||||
}
|
||||
var approver permission.Approver = gateApprover{c}
|
||||
if mode == ToolApprovalDontAsk {
|
||||
|
||||
@@ -212,18 +212,15 @@ func TestToolApprovalModeAutoForcesMemoryAskRules(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestToolApprovalModeYoloAsksBeforeRememberButNotForget(t *testing.T) {
|
||||
func TestToolApprovalModeYoloDoesNotAskBeforeMemoryWrites(t *testing.T) {
|
||||
c := New(Options{})
|
||||
c.SetToolApprovalMode(ToolApprovalYolo)
|
||||
|
||||
gate := c.newInteractiveGate()
|
||||
if got := gate.Policy.Decide("remember", false, json.RawMessage(`{}`)); got != permission.Ask {
|
||||
t.Fatalf("remember under yolo mode = %v, want ask", got)
|
||||
}
|
||||
// Forget archives a memory rather than destroying it, so the mode that
|
||||
// skips every other prompt skips this one too.
|
||||
if got := gate.Policy.Decide("forget", false, json.RawMessage(`{}`)); got != permission.Allow {
|
||||
t.Fatalf("forget under yolo mode = %v, want allow", got)
|
||||
for _, toolName := range []string{"remember", "forget"} {
|
||||
if got := gate.Policy.Decide(toolName, false, json.RawMessage(`{}`)); got != permission.Allow {
|
||||
t.Fatalf("%s under yolo mode = %v, want allow", toolName, got)
|
||||
}
|
||||
}
|
||||
// Verify that regular tools ARE auto-allowed in YOLO (sanity check).
|
||||
if got := gate.Policy.Decide("bash", false, json.RawMessage(`{"command":"go test ./..."}`)); got != permission.Allow {
|
||||
|
||||
Reference in new issue
Block a user