Skip to content

fix(approval): any unattended deny wins when contexts stack - #159291

Open
c2h5oh wants to merge 4 commits into
mainfrom
fix/156677-unattended-any-deny
Open

c2h5oh wants to merge 4 commits into
mainfrom
fix/156677-unattended-any-deny

Conversation

@c2h5oh

@c2h5oh c2h5oh commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

With more than one unattended context active (e.g. cronjob run inside hermes chat -q, or a cron job running hermes chat -q through the terminal), check_execute_code_guard and _run_approval_gate took the first context's mode. Single-query is listed first, so single_query_mode: approve waived cron_mode: deny / unattended_mode: deny for execute_code, check_dangerous_command, request_tool_approval (plugins, computer_use) and the protected-file write gate. check_all_command_guards already blocked on any deny; these two now do the same through a shared _unattended_scan.

Every single-context and no-context case keeps its result, message and log line (checked across all 27 single-query × cron × webhook mode combinations against six gates); only the stacked approve-then-deny combinations change, from approved to blocked. When several contexts deny, the first in list order supplies the message.

The fix is @ej-sanmartin's commit, cherry-picked with authorship kept; the follow-ups tidy a docstring and pin the file-write gate in the stacked case. The stacked-deny tests fail on main.

Fixes #156677

@c2h5oh

c2h5oh commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

@greptileai review

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on ea89e25 — chore: map contributor email for ej-sanmartin

ℹ️ Info

CI caches · View report · View job

27 / 27 cache hits (0 misses)
4281.75 MiB restored
0 B not restored.

per-job cache results

hits

JobStepLogsRestoredΔ vs main
OS-specific tests / Windows-only tests (arm64, 2/2)Set up native ARM64 build dependencies / Cache ARM64 OpenSSL development filesview step26.23 MiB+0 B
OS-specific tests / Windows-only tests (arm64, 2/2)Set up locked Python and test dependencies / Restore verified PM tools without savingview step222.55 MiB+0 B
OS-specific tests / Windows-only tests (arm64, 2/2)Set up locked Python and test dependencies / Restore uv dependency downloads and buildsview step856.03 MiB+0 B
Repository guards / Repository guardsRun ./.github/actions/setup-pm / Restore verified PM tools without savingview step156.11 MiB+0 B
Repository guards / Repository guardsRun ./.github/actions/setup-pm / Restore uv dependency downloads and buildsview step43.14 MiB+0 B
Repository guards / Repository guardsRun ./.github/actions/setup-pm / Restore node dependency downloadsview step180.90 MiB+0 B
Catalog tests / Catalog testsSet up locked Python and test dependencies / Restore verified PM tools without savingview step83.12 MiB+0 B
Catalog tests / Catalog testsSet up locked Python and test dependencies / Restore uv dependency downloads and buildsview step43.14 MiB+0 B
Python tests / Run tests (1/3)Set up locked Python and test dependencies / Restore verified PM tools without savingview step154.75 MiB+0 B
Python tests / Run tests (1/3)Set up locked Python and test dependencies / Restore uv dependency downloads and buildsview step43.14 MiB+0 B
Python tests / Run tests (1/3)Run testsview step0.10 MiB-23 B
Python tests / Run tests (3/3)Set up locked Python and test dependencies / Restore verified PM tools without savingview step154.75 MiB+0 B
Python tests / Run tests (3/3)Set up locked Python and test dependencies / Restore uv dependency downloads and buildsview step43.14 MiB+0 B
Python tests / Run tests (3/3)Run testsview step0.10 MiB+65 B
Python tests / Run tests (2/3)Set up locked Python and test dependencies / Restore verified PM tools without savingview step154.75 MiB+0 B
Python tests / Run tests (2/3)Set up locked Python and test dependencies / Restore uv dependency downloads and buildsview step43.14 MiB+0 B
Python tests / Run tests (2/3)Restore per-file duration cacheview step0.10 MiB+0 B
Python lints / Python lintsRun ./.github/actions/setup-pm / Restore verified PM tools without savingview step83.12 MiB+0 B
OS-specific tests / macOS-only tests (2/2)Set up locked Python and test dependencies / Restore verified PM tools without savingview step107.16 MiB+0 B
OS-specific tests / macOS-only tests (2/2)Set up locked Python and test dependencies / Restore uv dependency downloads and buildsview step167.62 MiB+0 B
OS-specific tests / macOS-only tests (1/2)Set up locked Python and test dependencies / Restore verified PM tools without savingview step107.16 MiB+0 B
OS-specific tests / macOS-only tests (1/2)Set up locked Python and test dependencies / Restore uv dependency downloads and buildsview step167.62 MiB+0 B
OS-specific tests / Windows-only testsSet up locked Python and test dependencies / Restore verified PM tools without savingview step236.13 MiB+0 B
OS-specific tests / Windows-only testsSet up locked Python and test dependencies / Restore uv dependency downloads and buildsview step102.91 MiB+0 B
OS-specific tests / Windows-only tests (arm64, 1/2)Set up native ARM64 build dependencies / Cache ARM64 OpenSSL development filesview step26.23 MiB+0 B
OS-specific tests / Windows-only tests (arm64, 1/2)Set up locked Python and test dependencies / Restore verified PM tools without savingview step222.55 MiB+0 B
OS-specific tests / Windows-only tests (arm64, 1/2)Set up locked Python and test dependencies / Restore uv dependency downloads and buildsview step856.03 MiB+0 B

misses

none

Compressed archive bytes. Not-restored bytes use the main-size reference; missing sizes remain unknown.


debug info

CI timings

CI timings · View report · View job

Wall time 6m21s vs 6m23s (-0.5%). 7 job(s) slower, 6 faster,

  • Python lints / Python lints: +121.0s
  • OS-specific tests / Windows-only tests (arm64, 2/2): +47.0s
  • OS-specific tests / Windows-only tests: -26.0s
  • Python tests / Run tests (3/3): +23.0s
  • Catalog tests / Catalog tests: -22.0s

@alt-glitch alt-glitch added P3 Low — cosmetic, nice to have tool/code-exec execute_code sandbox tool/terminal Terminal execution and process management type/security Security vulnerability or hardening labels Nov 23, 2026
@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

The PR makes any active unattended deny block approval, even when an earlier context approves.

  • Approval checks now block when any active unattended context denies an action.
  • Contributor attribution now includes the author's email mapping.

No actionable new issues or repository-rule violations were found. The change since the previous review only adds the contributor mapping. Tests were not run.

Reviews (2) · Last reviewed commit: "chore: map contributor email for ej-sanm..." · Reviewed by Greptile

@alt-glitch alt-glitch added the comp/tools Tool registry, model_tools, toolsets label Nov 23, 2026

@Ooriginador Ooriginador left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review — COMMENT

No code-level correctness or security findings. _unattended_scan() now gives every active context a chance to deny before either approval gate can auto-approve, and the regression cases cover stacked single-query/cron and single-query/unattended contexts, message precedence, protected writes, and unchanged single-context behavior.

Repository status

The implementation’s Python test and lint lanes passed, but the required repository guard is red because contributor email edgar.sanmartinjr@gmail.com is not mapped. Please run python3 scripts/audit_pr_attribution.py --fix and commit the generated contributor mapping (or use the documented manual mapping flow) so required CI can pass.

The added-line security scan was clean.

@c2h5oh

c2h5oh commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

@Ooriginador the contributor email is mapped in ea89e25 (contributors/emails/edgar.sanmartinjr@gmail.com → ej-sanmartin, added with scripts/add_contributor.py).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have tool/code-exec execute_code sandbox tool/terminal Terminal execution and process management type/security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: check_execute_code_guard short-circuits unattended context evaluation, bypassing subsequent deny policies

4 participants