@@ -124,6 +124,50 @@ func TestACPAuthPermissionModes(t *testing.T) {
124124 }
125125 })
126126
127+ t .Run ("RequestPermission: Empty mode defaults to read-only behavior for permissions" , func (t * testing.T ) {
128+ agent := & ACPAgent {
129+ agentName : "test-acp" ,
130+ Command : "test-command" ,
131+ ReadOnlyMode : "plan" ,
132+ AutoApproveMode : "auto-approve" ,
133+ Mode : "" ,
134+ Model : "test-model" ,
135+ Timeout : 30 * time .Second ,
136+ }
137+
138+ client := & acpClient {
139+ agent : agent ,
140+ }
141+
142+ readKind := acp .ToolKind ("read" )
143+ readResponse , err := client .RequestPermission (context .Background (), acp.RequestPermissionRequest {
144+ Options : authTestPermissionOptions (),
145+ ToolCall : acp.RequestPermissionToolCall {
146+ Kind : & readKind ,
147+ },
148+ })
149+ if err != nil {
150+ t .Fatalf ("RequestPermission failed for read kind: %v" , err )
151+ }
152+ if readResponse .Outcome .Selected == nil || readResponse .Outcome .Selected .OptionId != authAllowAlwaysOptionID {
153+ t .Errorf ("Expected %q for non-destructive operation when mode is disabled, got '%v'" , authAllowAlwaysOptionID , readResponse .Outcome )
154+ }
155+
156+ editKind := acp .ToolKind ("edit" )
157+ editResponse , err := client .RequestPermission (context .Background (), acp.RequestPermissionRequest {
158+ Options : authTestPermissionOptions (),
159+ ToolCall : acp.RequestPermissionToolCall {
160+ Kind : & editKind ,
161+ },
162+ })
163+ if err != nil {
164+ t .Fatalf ("RequestPermission failed for edit kind: %v" , err )
165+ }
166+ if editResponse .Outcome .Selected == nil || editResponse .Outcome .Selected .OptionId != authRejectAlwaysOptionID {
167+ t .Errorf ("Expected %q for destructive operation when mode is disabled, got '%v'" , authRejectAlwaysOptionID , editResponse .Outcome )
168+ }
169+ })
170+
127171 t .Run ("RequestPermission: AutoApproveMode allows all known operations" , func (t * testing.T ) {
128172 // Create agent in auto-approve mode (agentic)
129173 agent := & ACPAgent {
0 commit comments