fix: permission state hangs

This commit is contained in:
adamdotdevin
2025-07-31 11:36:08 -05:00
parent a5b20f973f
commit 936f4cb0c6
3 changed files with 7 additions and 2 deletions

View File

@@ -75,6 +75,9 @@ type SetEditorContentMsg struct {
type FileRenderedMsg struct {
FilePath string
}
type PermissionRespondedToMsg struct {
Response opencode.SessionPermissionRespondParamsResponse
}
func New(
ctx context.Context,

View File

@@ -200,6 +200,9 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case opencode.EventListResponseEventPermissionUpdated:
m.tail = true
return m, m.renderView()
case app.PermissionRespondedToMsg:
m.tail = true
return m, m.renderView()
case renderCompleteMsg:
m.partCount = msg.partCount
m.lineCount = msg.lineCount

View File

@@ -121,7 +121,6 @@ func (a Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
} else {
a.app.CurrentPermission = opencode.Permission{}
}
response := opencode.SessionPermissionRespondParamsResponseOnce
switch keyString {
case "enter":
@@ -144,7 +143,7 @@ func (a Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return toast.NewErrorToast("Failed to respond to permission request")
}
slog.Debug("Responded to permission request", "response", resp)
return nil
return app.PermissionRespondedToMsg{Response: response}
}
}
}