Security gates and cleanup must be fail-closed and boundary-proven.

Apply these rules when implementing/adjusting secure workflows:

1) Authorization must not degrade

2) Re-sweep after PR-controlled lifecycle scripts

3) Prove the auth boundary with real requests

4) Make security tests hermetic (no global/system config influence)

Example (authorization routing + fail-closed execution):

# In the shell gate script
body_lc="${COMMENT_BODY,,}"
case "$body_lc" in
  *@qwen-code /verify*)
    # FAIL CLOSED: require BOTH principals to have permission
    # (e.g., should_run=false unless author_has_write && commenter_has_write)
    ;;
  *@qwen-code /tmux*)
    # Keep existing narrower gate
    ;;
  *)
    should_run=false
    ;;
esac

Example (post-PR lifecycle hygiene):

# In the agent step, immediately before upload/agent start
rm -rf "$RUNNER_TEMP/verify-results"
mkdir -p "$RUNNER_TEMP/verify-results"
start_openai_proxy