commit 950b43012f42f25f00feeac218e35a43f22505a0
parent 0be6a8947ff15ca4febefd835910273bfae976aa
Author: William Casarin <jb55@jb55.com>
Date: Tue, 17 Feb 2026 12:08:24 -0800
persist permission responses as nostr events for all sessions
Local sessions were only sending permission responses through the
oneshot channel to the Claude process, without creating a nostr event.
On session reload, the permission_request events existed in ndb but
no matching permission_response events, so all requests appeared
unresolved.
Now both local and remote sessions publish permission response events,
so resolved state persists across reloads.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat:
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/crates/notedeck_dave/src/update.rs b/crates/notedeck_dave/src/update.rs
@@ -220,16 +220,13 @@ pub fn handle_permission_response(
PermissionResponse::Deny { .. } => crate::messages::PermissionResponseType::Denied,
};
- // Extract relay-publish info before we move `response`
- let relay_info = if is_remote {
- let allowed = matches!(&response, PermissionResponse::Allow { .. });
- let message = match &response {
- PermissionResponse::Allow { message } => message.clone(),
- PermissionResponse::Deny { reason } => Some(reason.clone()),
- };
- Some((allowed, message))
- } else {
- None
+ // Extract relay-publish info before we move `response`.
+ // Both local and remote sessions publish permission response events
+ // so that resolved state persists across session reloads.
+ let allowed = matches!(&response, PermissionResponse::Allow { .. });
+ let message = match &response {
+ PermissionResponse::Allow { message } => message.clone(),
+ PermissionResponse::Deny { reason } => Some(reason.clone()),
};
// If Allow has a message, add it as a User message to the chat
@@ -272,14 +269,10 @@ pub fn handle_permission_response(
}
}
- if let Some((allowed, message)) = relay_info {
- PermissionResponseResult::NeedsRelayPublish {
- perm_id: request_id,
- allowed,
- message,
- }
- } else {
- PermissionResponseResult::Local
+ PermissionResponseResult::NeedsRelayPublish {
+ perm_id: request_id,
+ allowed,
+ message,
}
}