Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions cmd/task/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3514,8 +3514,10 @@ func handleNotificationHook(database *db.DB, taskID int64, input *ClaudeHookInpu
if input.Message != "" {
msg = "Waiting for permission: " + input.Message
}
// Append tool detail so the approval dialog shows what's being requested
if detail := formatPermissionDetail(input); detail != "" {
// The Notification hook doesn't include tool_name/tool_input, but the
// PreToolUse hook (which fires just before) stashes the detail as a
// "pending_tool" log entry. Retrieve and append to the permission message.
if detail := latestPendingToolDetail(database, taskID); detail != "" {
msg += "\n" + detail
}
}
Expand Down Expand Up @@ -3604,6 +3606,13 @@ func handlePreToolUseHook(database *db.DB, taskID int64, input *ClaudeHookInput)
database.AppendTaskLog(taskID, "system", "Claude resumed working")
}

// Store tool detail so the Notification(permission_prompt) handler can show it.
// The Notification hook doesn't include tool_name/tool_input, but PreToolUse
// fires right before it, so we stash the detail here for retrieval.
if detail := formatPermissionDetail(input); detail != "" {
database.AppendTaskLog(taskID, "pending_tool", detail)
}

return nil
}

Expand Down Expand Up @@ -3762,6 +3771,23 @@ func formatPermissionDetail(input *ClaudeHookInput) string {
return detail
}

// latestPendingToolDetail retrieves the most recent "pending_tool" log entry
// for a task. This is written by handlePreToolUseHook and consumed here by the
// notification handler to show what tool/command is requesting permission.
func latestPendingToolDetail(database *db.DB, taskID int64) string {
logs, err := database.GetTaskLogs(taskID, 5)
if err != nil {
return ""
}
// Logs are in DESC order (most recent first).
for _, l := range logs {
if l.LineType == "pending_tool" {
return l.Content
}
}
return ""
}

// tailClaudeLogs tails all claude session logs for debugging.
func tailClaudeLogs() error {
home, err := os.UserHomeDir()
Expand Down
4 changes: 4 additions & 0 deletions internal/ui/detail.go
Original file line number Diff line number Diff line change
Expand Up @@ -2550,6 +2550,10 @@ func (m *DetailModel) renderContent() string {
b.WriteString("\n\n")

for _, log := range m.logs {
// Skip internal-only log entries not meant for display
if log.LineType == "pending_tool" {
continue
}
icon := " "
switch log.LineType {
case "system":
Expand Down