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 { type FileRenderedMsg struct {
FilePath string FilePath string
} }
type PermissionRespondedToMsg struct {
Response opencode.SessionPermissionRespondParamsResponse
}
func New( func New(
ctx context.Context, ctx context.Context,

View File

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

View File

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