From 8793202ef587a78c0316991b2b730a841d665340 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 9 Oct 2026 13:05:38 +0200 Subject: [PATCH] o: fix bypass agent filter to use agent ID instead of name OLLIE_UNAME in bypass requests is the agent ID, not name. Look up agent ID from idx before filtering. --- data/scripts/o | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/data/scripts/o b/data/scripts/o index af20df9..0eb0dfa 100755 --- a/data/scripts/o +++ b/data/scripts/o @@ -298,9 +298,13 @@ cmd_bypass() { local arr arr=$(echo "$pending" | jq 'if type == "array" then . else [.] end' 2>/dev/null) - # Filter by agent if agent context is set + # Filter by agent if agent context is set (need to look up agent ID) if [[ -n "$CTX_AGENT" ]]; then - arr=$(echo "$arr" | jq --arg agent "$CTX_AGENT" '[.[] | select(.env.OLLIE_UNAME == $agent)]' 2>/dev/null) + local agent_id + agent_id=$(ollie-9p read "session/$CTX_SESSION/agent/idx" 2>/dev/null | awk -F'\t' -v name="$CTX_AGENT" '$3 == name { print $2; exit }') + if [[ -n "$agent_id" ]]; then + arr=$(echo "$arr" | jq --arg agent "$agent_id" '[.[] | select(.env.OLLIE_UNAME == $agent)]' 2>/dev/null) + fi fi local count @@ -345,9 +349,13 @@ cmd_approve() { local arr arr=$(echo "$pending" | jq 'if type == "array" then . else [.] end' 2>/dev/null) - # Filter by agent if agent context is set + # Filter by agent if agent context is set (need to look up agent ID) if [[ -n "$CTX_AGENT" ]]; then - arr=$(echo "$arr" | jq --arg agent "$CTX_AGENT" '[.[] | select(.env.OLLIE_UNAME == $agent)]' 2>/dev/null) + local agent_id + agent_id=$(ollie-9p read "session/$CTX_SESSION/agent/idx" 2>/dev/null | awk -F'\t' -v name="$CTX_AGENT" '$3 == name { print $2; exit }') + if [[ -n "$agent_id" ]]; then + arr=$(echo "$arr" | jq --arg agent "$agent_id" '[.[] | select(.env.OLLIE_UNAME == $agent)]' 2>/dev/null) + fi fi # Find the request to approve @@ -413,9 +421,13 @@ cmd_deny() { local arr arr=$(echo "$pending" | jq 'if type == "array" then . else [.] end' 2>/dev/null) - # Filter by agent if agent context is set + # Filter by agent if agent context is set (need to look up agent ID) if [[ -n "$CTX_AGENT" ]]; then - arr=$(echo "$arr" | jq --arg agent "$CTX_AGENT" '[.[] | select(.env.OLLIE_UNAME == $agent)]' 2>/dev/null) + local agent_id + agent_id=$(ollie-9p read "session/$CTX_SESSION/agent/idx" 2>/dev/null | awk -F'\t' -v name="$CTX_AGENT" '$3 == name { print $2; exit }') + if [[ -n "$agent_id" ]]; then + arr=$(echo "$arr" | jq --arg agent "$agent_id" '[.[] | select(.env.OLLIE_UNAME == $agent)]' 2>/dev/null) + fi fi # Find the request to deny