Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hermes-node-gateway
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lisa
hermes-node-gateway
Commits
645a7481
Commit
645a7481
authored
May 14, 2026
by
Lisa (Hermes AI)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: surface approval-required and denied node exec states
parent
3c675690
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
13 deletions
+62
-13
__init__.py
__init__.py
+62
-13
No files found.
__init__.py
View file @
645a7481
...
@@ -673,20 +673,32 @@ class NodeGateway:
...
@@ -673,20 +673,32 @@ class NodeGateway:
cmd_id
=
msg
.
get
(
'id'
)
cmd_id
=
msg
.
get
(
'id'
)
exec_status
=
msg
.
get
(
'status'
)
with
self
.
_commands_lock
:
with
self
.
_commands_lock
:
if
cmd_id
in
self
.
commands
:
if
cmd_id
in
self
.
commands
:
cmd
=
self
.
commands
[
cmd_id
]
cmd
=
self
.
commands
[
cmd_id
]
cmd
.
status
=
'completed'
if
msg
.
get
(
'exit_code'
)
==
0
else
'failed'
cmd
.
exit_code
=
msg
.
get
(
'exit_code'
)
cmd
.
exit_code
=
msg
.
get
(
'exit_code'
)
cmd
.
completed_at
=
time
.
time
()
cmd
.
completed_at
=
time
.
time
()
cmd
.
error
=
msg
.
get
(
'error'
)
cmd
.
error
=
msg
.
get
(
'error'
)
if
exec_status
==
'approval_required'
:
cmd
.
status
=
'approval_required'
elif
exec_status
==
'denied'
:
cmd
.
status
=
'denied'
else
:
cmd
.
status
=
'completed'
if
cmd
.
exit_code
==
0
and
not
cmd
.
error
else
'failed'
# Notify waiter
# Notify waiter
...
@@ -2057,11 +2069,19 @@ class NodeGateway:
...
@@ -2057,11 +2069,19 @@ class NodeGateway:
if
self
.
_matches_pattern
(
cmd_str
,
pattern
):
if
self
.
_matches_pattern
(
cmd_str
,
pattern
):
raise
PermissionError
(
return
{
'status'
:
'denied'
,
f
"Command denied: matches deny pattern '{pattern}'"
'exit_code'
:
126
,
'stdout'
:
''
,
)
'stderr'
:
''
,
'error'
:
f
"Command denied: matches deny pattern '{pattern}'"
,
'denial'
:
{
'type'
:
'deny'
,
'pattern'
:
pattern
,
'approved'
:
bool
(
approved
),
'command'
:
normalized_command
,
},
}
# Ask list - requires approval
# Ask list - requires approval
...
@@ -2072,11 +2092,18 @@ class NodeGateway:
...
@@ -2072,11 +2092,18 @@ class NodeGateway:
if
self
.
_matches_pattern
(
cmd_str
,
pattern
):
if
self
.
_matches_pattern
(
cmd_str
,
pattern
):
raise
PermissionError
(
return
{
'status'
:
'approval_required'
,
f
"Command requires approval: matches pattern '{pattern}'"
'exit_code'
:
2
,
'stdout'
:
''
,
)
'stderr'
:
''
,
'error'
:
f
"Command requires approval: matches pattern '{pattern}'"
,
'approval'
:
{
'required'
:
True
,
'pattern'
:
pattern
,
'command'
:
normalized_command
,
},
}
# Check allow list (if configured)
# Check allow list (if configured)
...
@@ -2153,7 +2180,7 @@ class NodeGateway:
...
@@ -2153,7 +2180,7 @@ class NodeGateway:
result
=
await
asyncio
.
wait_for
(
future
,
timeout
=
timeout
+
5
)
result
=
await
asyncio
.
wait_for
(
future
,
timeout
=
timeout
+
5
)
re
turn
{
re
sponse
=
{
'id'
:
result
.
id
,
'id'
:
result
.
id
,
...
@@ -2173,6 +2200,28 @@ class NodeGateway:
...
@@ -2173,6 +2200,28 @@ class NodeGateway:
}
}
if
result
.
status
==
'approval_required'
:
response
[
'approval'
]
=
{
'required'
:
True
,
'command'
:
normalized_command
,
}
elif
result
.
status
==
'denied'
:
response
[
'denial'
]
=
{
'type'
:
'deny'
,
'command'
:
normalized_command
,
}
return
response
except
asyncio
.
TimeoutError
:
except
asyncio
.
TimeoutError
:
cmd
.
status
=
'failed'
cmd
.
status
=
'failed'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment