Skip to content

Commit 123d62b

Browse files
committed
fix: permission not displaying for subagents
1 parent 8a54af6 commit 123d62b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lua/opencode/api.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ function M.respond_to_permission(answer)
531531

532532
ui.render_output(true)
533533
state.api_client
534-
:respond_to_permission(state.active_session.id, state.current_permission.id, { response = answer })
534+
:respond_to_permission(state.current_permission.sessionID, state.current_permission.id, { response = answer })
535535
:and_then(function()
536536
vim.schedule(function()
537537
state.current_permission = nil

lua/opencode/ui/session_formatter.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ function M.format_session(session)
7676
M.output:add_empty_line()
7777
end
7878

79-
if state.current_permission and state.current_permission.messageID == msg.id then
80-
return M._format_permission_request()
81-
end
82-
8379
if msg.error and msg.error ~= '' then
8480
M._format_error(msg)
8581
end
@@ -103,7 +99,7 @@ function M._format_permission_request()
10399
)
104100
)
105101
M.output:add_empty_line()
106-
return M.output:get_lines()
102+
-- return M.output:get_lines()
107103
end
108104

109105
---@param line number Buffer line number
@@ -546,7 +542,7 @@ function M._format_tool(part)
546542
local metadata = (part.state and part.state.metadata) or {}
547543
local output = (part.state and part.state.output) or ''
548544

549-
if state.current_permission and state.current_permission.messageID == state.current_message.id then
545+
if state.current_permission and state.current_permission.messageID == part.messageID then
550546
metadata = state.current_permission.metadata or metadata
551547
end
552548

@@ -574,6 +570,10 @@ function M._format_tool(part)
574570
M._format_callout('ERROR', part.state.error)
575571
end
576572

573+
if state.current_permission and state.current_permission.messageID == part.messageID then
574+
M._format_permission_request()
575+
end
576+
577577
M.output:add_empty_line()
578578

579579
local end_line = M.output:get_line_count()

0 commit comments

Comments
 (0)